Phase 7: Connector framework + EDGAR (Tier 1 reference)#8
Merged
Conversation
- Thin framework: types, registry, shared ingest helper that writes
documents/document_versions. Each connector owns its client + auth +
fetch primitives; framework only standardizes the ingest tail.
- documents.source_connector + source_ref jsonb with a unique partial
index on (connector, accession_number, document_role) for dedupe.
- EDGAR client: ticker lookup, recent-filings list, filing index +
document fetch. Requires EDGAR_USER_AGENT (SEC fair-use policy).
- EDGAR connector: ingest primary doc (HTML transcoded to PDF for
citation parity), optional exhibits, optional XBRL.
- edgar_facts table + pure XBRL instance parser. Phase 8 consumes
these facts directly — no LLM in the producer path.
- /connectors/edgar/{lookup,filings,ingest} routes; backend-only by
design (no UI this phase). connector_fetch audit row per ingest.
- htmlToPdf in convert.ts (LibreOffice).
See decisions.md (2026-05-20) for scope decisions.
Verification: backend tsc --noEmit clean; vitest 84/84 (11 new).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
edgar_factstable populated by a pure XBRL instance parser — Phase 8 will consume these facts directly to cross-check prose-extracted numbers./connectors/edgar/{lookup,filings,ingest}routes; backend-only by design (no UI this phase). Each ingest emits aconnector_fetchaudit row.See
decisions.md(2026-05-20) for full scope rationale.Test plan
tsc --noEmitcleanbackend/migrations/connectors_phase7.sqlto staging SupabaseEDGAR_USER_AGENTenv var (must contain a contact email per SEC fair-use)POST /connectors/edgar/lookupwith{"ticker":"AAPL"}returns the right CIKPOST /connectors/edgar/ingestwith a known accession +extract_xbrl: truelands documents + populatesedgar_factsdeduped: true)🤖 Generated with Claude Code