48 lines
1.9 KiB
Markdown
48 lines
1.9 KiB
Markdown
NarrativeWeave — idea70-narrativeweave-real-time
|
|
|
|
NarrativeWeave is a portable Python library and service for assembling auditable, deterministic market research narratives from streaming inputs. It implements a minimal canonical NarrativeBlock model, an append-only event log, a deterministic replay engine, and a lightweight tamper-evident ledger for provenance.
|
|
|
|
This repository contains a focused, production-minded foundation for the broader NarrativeWeave project described in the original idea. It provides:
|
|
|
|
- A Pydantic-backed NarrativeBlock data model
|
|
- SQLite-based append-only event log and normalized block storage
|
|
- Two adapter stubs (news feed, transcript importer) to show integration points
|
|
- Deterministic replay function that regenerates NarrativeBlocks from the event log
|
|
- A simple hash-chain ledger that anchors block versions
|
|
- A FastAPI app to ingest events and query blocks
|
|
- Deterministic claim graph construction, redaction-aware Markdown rendering, and block-to-block audit diffs
|
|
- Tests and a build-ready pyproject/setup.cfg
|
|
|
|
Getting started
|
|
|
|
Install dependencies (recommended inside a virtualenv):
|
|
|
|
python3 -m pip install -e .
|
|
|
|
Run tests and build (the repository includes test.sh to run both):
|
|
|
|
./test.sh
|
|
|
|
Run the API locally for development:
|
|
|
|
uvicorn idea70_narrativeweave_real_time.api:app --reload
|
|
|
|
Useful endpoints:
|
|
|
|
- `POST /ingest`
|
|
- `POST /build_block`
|
|
- `GET /block/{block_id}`
|
|
- `GET /block/{block_id}/render?redacted=true`
|
|
- `GET /block/{left_block_id}/diff/{right_block_id}`
|
|
|
|
Project layout
|
|
|
|
- idea70_narrativeweave_real_time/: python package
|
|
- tests/: pytest tests
|
|
- pyproject.toml + setup.cfg: packaging metadata
|
|
- AGENTS.md: repository rules and notes for future AI contributors
|
|
|
|
Limitations
|
|
|
|
This initial implementation focuses on correctness, deterministic replay, and auditable ledger semantics. It intentionally leaves advanced NLP, production adapters for FIX/WebSocket, and UI components for follow-on work.
|