A small, narrow demonstration of an evidence-first architecture for vendor financial assessment — built for the ArcellAI Open Source Engineering Fellowship project interview.
Given a vendor name and a fiscal period, can a system retrieve public evidence, extract structured claims, preserve provenance, reconcile conflicting information, and return either a defensible evidence packet or an explicit statement that the evidence is insufficient?
The system is evidence-first, not answer-first. A Claim may carry a
normalized value, but that value is never treated as authoritative unless
it references the Evidence object(s) it was derived from — the validator
enforces this at every claim, moving anything without a live evidence_id
to INSUFFICIENT_EVIDENCE regardless of how well-formed the claim looks.
If two comparable sources disagree, both values are preserved — never
averaged, never silently picked. If the evidence can't support a
conclusion, the system says so explicitly instead of guessing.
Company + Fiscal Period
│
▼
Entity Resolution (deterministic — app/entity_resolver.py)
│
▼
Evidence Retrieval (app/providers/* — SEC Company Facts / Filings / USAspending)
│
▼
Evidence Normalization (deterministic — app/normalization.py + app/evidence_ids.py)
│
▼
Typed Claim Extraction (deterministic first; LLM only on unstructured text — app/claim_extraction.py)
│
▼
Validation (deterministic — app/validator.py; enforces "no evidence, no claim")
│
┌────┴────┐
▼ ▼
Conflict Missing
Detection Evidence
└────┬────┘
▼
Assessment Engine (deterministic rules — app/assessment.py)
│
┌────┴────┐
▼ ▼
Evidence Abstention /
Packet Human Review
- ResolvedEntity — the resolved legal/reporting entity, or an explicit
AMBIGUOUS/NOT_FOUNDstatus. Identity is never guessed. - Evidence — a raw fact with full provenance: source, field/passage,
reporting period, retrieval method, and an explicit
is_fixtureflag so demo data can never be confused with a live retrieval. - Claim — a typed statement that references evidence IDs; never contains detached values.
- Conflict — only created when claims are genuinely comparable (same entity, claim type, period, unit, category) and materially disagree.
- Assessment — the final packet, with one of
SUPPORTED,SUPPORTED_WITH_LIMITATIONS,CONFLICTING_EVIDENCE,INSUFFICIENT_EVIDENCE, orREQUIRES_HUMAN_REVIEW.
Deterministic: entity resolution (app/entity_resolver.py), retrieval
(app/providers/*.py), unit/field normalization (app/normalization.py),
evidence-ID generation and deduplication (app/evidence_ids.py), claim
validation, conflict detection, and the final assessment rules.
LLM-assisted (mocked in this offline demo, see app/claim_extraction.py for
exactly where a real Claude API call would slot in): extracting a claim from
an unstructured filing passage. Any LLM-produced claim must carry an
evidence_id back to the source passage, or the validator marks it
INSUFFICIENT_EVIDENCE regardless of how well-formed the output looks.
python -m venv .venv && source .venv/bin/activate # optional
pip install -r requirements.txt
# Run all four demo scenarios end-to-end, no network required:
python demo.py
# Run the test suite:
pytest tests/ -v
# Run the API + visual dashboard:
uvicorn app.api:app --reload
# then open http://127.0.0.1:8000/ in a browser, or call the API directly:
curl -X POST http://127.0.0.1:8000/assess \
-H "Content-Type: application/json" \
-d '{"company_name": "Palantir Technologies", "fiscal_year": 2025}'
curl -X POST http://127.0.0.1:8000/assess/supported
curl -X POST http://127.0.0.1:8000/assess/conflict
curl -X POST http://127.0.0.1:8000/assess/insufficient
curl -X POST http://127.0.0.1:8000/assess/subsidiaryA .vscode/launch.json is included — open this folder in VS Code and use
the Run/Debug panel to launch the demo, the API, or the test suite directly.
GET / serves a single-page dashboard (app/static/dashboard.html) for
inspecting an evidence packet without reading raw JSON: it shows the
resolved entity, a color-coded assessment status, each claim with clickable
chips linking to the exact evidence item that supports it, the full
evidence ledger (source, field/passage, URL, fixture flag), conflicts,
missing evidence, and limitations — plus a raw-JSON toggle for the
machine-readable packet underneath. It calls POST /assess and the four
pinned /assess/<case> routes directly; no build step or extra dependency
is required beyond FastAPI serving the static file.
{"company_name": "Palantir Technologies", "fiscal_year": 2025}runs the full pipeline for whatever company/year is given, rather than
reproducing one pinned scenario. It only "knows about" the companies in
app/entity_resolver.py's registry and the fixtures in app/fixtures.py,
but the interface is the real one: swapping the fixture-backed classes in
app/providers/ for live SEC/USAspending httpx clients would not require
changing this endpoint, app/orchestrator.py's run_assessment(), or
anything downstream of it.
| Case | Scenario | Result |
|---|---|---|
examples/supported_case.json |
Single authoritative SEC revenue figure | SUPPORTED |
examples/conflict_case.json |
Two authoritative sources disagree on FY2025 revenue | CONFLICTING_EVIDENCE |
examples/insufficient_evidence_case.json |
USAspending procurement obligation exists, but no link to recognized revenue | INSUFFICIENT_EVIDENCE |
examples/subsidiary_case.json |
Named vendor is a subsidiary; SEC disclosures are made at the parent level; also covers the customer-concentration claim type | SUPPORTED_WITH_LIMITATIONS |
- Entity resolution is a small in-memory registry, not a live SEC lookup
(the sandbox this was built in has no network access to sec.gov /
usaspending.gov).
app/providers/*.pyimplements the real provider interface —get_revenue_fact(cik),get_passage(cik, key),get_obligation(cik)— but each class currently reads fromapp/fixtures.pyinstead of issuing anhttpxcall. Swapping inhttpx.get("https://data.sec.gov/...")inside each provider class is the only change a production build needs;app/normalization.py,app/orchestrator.py, and everything downstream stays the same. - LLM extraction is mocked with keyword matching rather than a real model call, for the same offline-reproducibility reason — the extraction contract (must return evidence-linked claims) is real.
- Only two companies and a handful of claim types are supported. That's deliberate: a narrow, inspectable system beats a broad, unreliable one.
Real SEC/USAspending httpx implementations behind the existing provider
classes, broader entity resolution (aliases, subsidiaries), passage-level
citation offsets, a richer evidence lineage graph, a labeled evaluation
dataset, and a human-review workflow for REQUIRES_HUMAN_REVIEW cases.