How aashik1701/fact-layer works
Fact Layer extracts evidence-grounded, qualifier-rich facts from PDFs, then finds cross-document candidates and compares them only after a deterministic comparability gate. Its workflow spans parsing and triage, extraction and verification, normalization and resolution, storage and retrieval, then relational adjudication and API/UI inspection. The README documents additional graph, lineage, temporal, investigation, and diagnostics capabilities; their internal wiring is not fully shown in the sampled source, so those links are omitted. The frontend and some pipeline relationships are represented from README statements and import references rather than complete implementation excerpts.
Main entry points: api.py FastAPI service · extract.py Fact extraction · api.ts API client · App.tsx Fact Layer UI
Components 24
User interface
- Fact Layer UI
frontend/src/App.tsx - API client
frontend/src/lib/api.ts - Fact and relation review
frontend/src/components/relations/RelationInspectorModal.tsx - Evidence viewer
frontend/src/components/evidence/EvidenceModal.tsx
Service layer
- FastAPI service
api.py
Fact ingestion
- PDF parsing
fact_layer/parse.py - Page triage
fact_layer/triage.py - Fact extraction
fact_layer/extract.py - Quote verification
fact_layer/value_verify.py - Normalization
fact_layer/normalize.py - Canonical resolution
fact_layer/resolve.py
Comparison and retrieval
- Candidate retrieval
fact_layer/retrieval/index.py - Comparability gate
fact_layer/comparability.py - Relation adjudication
fact_layer/adjudicate.py - Knowledge graph projection
fact_layer/graph.py - Comparability investigation
fact_layer/investigate.py - Evidence lineage
fact_layer/lineage.py - Temporal knowledge
fact_layer/temporal.py - Pipeline diagnostics
fact_layer/diagnostics.py
State and evidence
- Fact and evidence model
fact_layer/models.py - Dedup and clustering
fact_layer/store.py - Fact storage contract
fact_layer/storage.py - SQLite backend
fact_layer/sqlite_storage.py
Other components
- Analyst
Connections 26
- Analyst → Fact Layer UI: uses
README.md - Fact Layer UI → API client: requests data
frontend/src/App.tsx - Fact Layer UI → Fact and relation review: renders
frontend/src/App.tsx - API client → FastAPI service: calls REST API
README.md - FastAPI service → PDF parsing: starts ingestion
README.md - PDF parsing → Page triage: feeds pages
README.md - Page triage → Fact extraction: selects pages
README.md - Fact extraction → Quote verification: verifies spans
fact_layer/extract.py - Fact extraction → Normalization: normalizes values
fact_layer/extract.py - Fact extraction → PDF parsing: uses parsed text
fact_layer/extract.py - Canonical resolution → Normalization: uses normalization
fact_layer/resolve.py - Dedup and clustering → Relation adjudication: adjudicates clusters
- Candidate retrieval → Comparability gate: gates candidates
fact_layer/retrieval/adaptive.py - Comparability gate → Relation adjudication: supplies verdict
fact_layer/adjudicate.py - FastAPI service → Candidate retrieval: serves candidate queries
api.py - FastAPI service → Dedup and clustering: serves fact data
api.py - FastAPI service → Knowledge graph projection: serves graph view
api.py - FastAPI service → Comparability investigation: serves investigations
api.py - FastAPI service → Evidence lineage: serves lineage
api.py - FastAPI service → Temporal knowledge: serves temporal data
api.py - FastAPI service → Pipeline diagnostics: serves diagnostics
api.py - Fact storage contract → SQLite backend: implements contract
fact_layer/sqlite_storage.py - Fact storage contract → Fact and evidence model: serializes records
fact_layer/storage.py - Dedup and clustering → Fact storage contract: persists snapshot
- Evidence viewer → API client: loads evidence
- Fact and relation review → API client: loads relations