company-corpus
Created and maintained by Marc Jeulin, part of MyOpenFund.
An exhaustive, replicable, open-data corpus of company primary-source
documents — the bottom-up / micro layer that complements
central-bank-corpus. Both feed the
MyOpenFund stack (vault → data-orchestrator →
eigenmind/Qdrant). Today only the SEC EDGAR pillar reaches that chain; the EU
and register pillars are acquired and parsed but not yet exported to the vault
(tracked in the project notes).
Every document comes from the issuer's regulator of record (SEC, AMF, FCA,
CONSOB, …) — public, primary-source disclosures, with provenance recorded per
file. No proprietary datasets, no machine translation, no model-generated text.
Three pillars
| Pillar |
Region |
Source of record |
Identity |
Status |
| 🇺🇸 SEC |
United States |
EDGAR |
CIK |
complete (reports, ownership, XBRL financials) |
| 🇪🇺 EU |
14 jurisdictions |
national OAMs + Euronext + FCA NSM |
LEI / ISIN |
13 backend keys / 12 classes (IE reuses GB) + Euronext for PT |
| Register |
8 countries |
national business registers |
local entity ID |
8 registers merged — REGISTER_FINANCIALS.md |
All three pillars share the same discipline (official sources only, stable ids,
exhaustive discovery, never silently partial) and feed the same RAG contract. The
SEC and EU pillars cover listed issuers (CIK / GLEIF LEI); the register pillar
targets the credit and private-company universe of non-listed entities.
Structured financials
Beyond raw filings, a shared engine (financials.py) extracts curated metrics into
a unified per-period row schema (see docs/FINANCIALS.md):
| Layer |
Universe |
Source |
Status |
| SEC XBRL |
US listed issuers |
EDGAR companyfacts |
✅ done |
| EU ESEF / IFRS (Pillar B) |
EU listed issuers |
filings.xbrl.org json_url + Arelle (Tier B) |
✅ done — EU_FINANCIALS.md |
| Register financials |
Private / credit universe (non-listed) |
8 national registers: 🇳🇴 NO · 🇬🇧 UK · 🇧🇪 BE · 🇱🇺 LU · 🇫🇮 FI · 🇩🇰 DK · 🇪🇪 EE · 🇸🇰 SK |
✅ all eight registers merged — REGISTER_FINANCIALS.md |
Derived quarters (0.3.0). On the SEC path and for store readers, issuers that file their
cash flows year to date (3, 6, 9 months, then the year) get standalone quarters computed from
them: Q2 = 6M − Q1, Q3 = 9M − 6M, Q4 = FY − 9M (Q4 for every issuer). They are ordinary quarterly
values marked derived with their formula, money flow concepts only, a filed quarter always wins,
and a derived quarter exists only once both inputs are public (point in time). The 6-month YTD
rows of a quarterly filer become derivation inputs (hidden_semiannual). Documents and rows
never show a derived value as reported: the formula sits next to it ((derived: FY - 9M)), and
a metric resting on one is marked derived = "derived input". A derived value subtracts the
latest vintages of its inputs (a restated FY minus an unrestated 9M is possible), and a summary's
publication date is the period's first publication: only as_of on the selection is point in
time. Migration: outputs gain derived rows; filed rows unchanged; read derived with
.get. Details: docs/FINANCIALS.md — Derived
quarters.
The register pillar targets issuers that never file ESEF — bond obligors, private
companies, bank counterparties. Output lands in data/financials_register/ (never
merged with data/financials_eu/), labelled by basis (legal-entity vs.
consolidated). It is governed by a no-false-data discipline: any value that
cannot be confirmed from structural anchors is suppressed, not guessed. Leverage
rows carry a leverage_basis field ("borrowings" or "total_liabilities")
because registers differ — some expose real financial borrowings (BE/LU/SK/DK-ESEF),
others only total liabilities (NO/UK/EE/DK-FSA) — so consumers cannot compare
debt_to_equity across registers without knowing the basis.
Install
pip install "myopenfund-company-corpus" # the corpus tool and the `company-corpus` command
pip install "myopenfund-company-corpus[store]" # + the open-data-store writer, for `store-batches`
pip install "myopenfund-company-corpus[live]" # + contract schemas and MarkItDown, for live mode
The PyPI distribution is myopenfund-company-corpus (the myopenfund- prefix groups the MyOpenFund
packages); the import name (company_corpus), the command (company-corpus) and the repository
name are unchanged. Other extras: [be] (Belgium backend) and [eu-financials] (Arelle).
If this environment installed the old distribution (company-corpus, from a clone or a git URL), run
pip uninstall -y company-corpus before installing myopenfund-company-corpus: both own the same
import package.
To try the latest main before a release (dependencies still come from PyPI):
pip install "myopenfund-company-corpus @ git+https://github.com/MyOpenFund/company-corpus"
Working across repos
Clone the repos side by side and install this package editable over the PyPI version in the
consumer's environment: pip install -e ../company-corpus. A consumer change that needs an
unreleased version waits for this package's release before the consumer's PR merges.
How to release
Bump __version__ in company_corpus/__init__.py in a PR (the version is read from there). Run pip install -e . again locally so the installed metadata follows. After the PR merges, go to Actions, then release, then Run workflow: pick the main branch and target pypi. Approve the pypi deployment. The workflow builds the package, checks it, publishes it, then creates the tag v<version> and the GitHub Release itself.
It fails before publishing if it is not run on the default branch or if that tag already exists. Target testpypi is a rehearsal: it publishes to TestPyPI and creates no tag and no release.
Pushing a tag v<version> by hand still works: the workflow checks that the tag equals the package version and is on the default branch, then publishes and attaches the files to the Release.
If PyPI got the package but the tag or the Release is missing, re-run the failed github-release job from Actions; do not push the tag by hand (the re-run would fail at the PyPI upload).
To raise the cap of a sibling dependency ([store]), edit its range in pyproject.toml (floor >=X.Y.Z, cap the next breaking version) and the exact pins in requirements-*.txt; the tests check the rule, not a number.
Quick start
pip install -r requirements.txt # runtime-only
pip install -r requirements-dev.txt # adds pytest-socket, the pinned myopenfund-vault-contract (tests only)
python -m pytest -q # network-free test suite
export COMPANY_CORPUS_CONTACT="you@example.com" # required before any live crawl
There is no default contact — without it the User-Agent carries only the
tool name, so cloning the repo never leaks anyone's address. Regulators ask for a
real contact, so set it before crawling.
# SEC: build a tiny universe, discover + download
python -m company_corpus build-universe --tickers AAPL,MSFT --name demo --write
python -m company_corpus discover --universe demo --download --since 2015-01-01 --write
# EU: acquire one issuer's regulated filings by ISIN (resolves the LEI via GLEIF);
# dry-run by default (discovery only, nothing written), --write downloads
python -m company_corpus eu-acquire --isins FR0010193052
python -m company_corpus eu-acquire --isins FR0010193052 --write
# Register financials: Norwegian statutory accounts (Brreg, no key required)
python -m company_corpus register-financials --orgnrs 923609016 --write
# UK Companies House bulk iXBRL (Arelle required; --limit for a bounded test run)
python -m company_corpus register-financials --ch-bulk accounts_monthly_2024_01.zip --limit 100
Feeding the vault (documents contract)
Every SEC manifest line (data/manifest/<cik>.jsonl, families A–E) is a row of the
vault's documents contract 1.0.0 (corpus: company, source_code: sec, doc_type = the
form code, sha256 = the primary document as the SEC served it, local_path = the rendered
PDF else the cleaned text, entity_scheme: cik), and data/vocabulary.json declares its
codes; the vault ingests both as they are. F1 summaries are not vault documents: they live in
data/derived/f1/<cik>.jsonl. Every command reads the contract form only: a manifest row in
the pre-contract form (a clone whose data predates the contract) stops the command with
ManifestNeedsMigration, naming migrate-contract. Such a corpus is migrated once, and the
migration is a one-way door: code from before the contract cannot read the new rows and its
next write would rewrite a manifest from almost nothing.
# 0. back up: APFS snapshot (tmutil localsnapshot) or a copy of data/manifest and data/derived
# no `xbrl --write` between the code update and the end of the migration
python -m company_corpus migrate-contract # dry run: read the counts
python -m company_corpus migrate-contract --write # then: re-run -> rows_rewritten=0 f1_moved=0
python -m company_corpus verify --hash # 0 findings
pip install -r requirements-dev.txt # then the vault's checker, exit 0:
python -m vault_contract.check data/manifest --corpus company --vocabulary data/vocabulary.json --no-transition --strict
After --write, only code that knows the contract may run with --write on that corpus;
rollback = restore the backup, never check out older code. The counters and the provenance
check: docs/INGESTION_RAG.md.
Details, the artefact rule and the checks: docs/INGESTION_RAG.md.
Feeding open-data-store (store-batches)
store-batches turns layer 0 (the stored companyfacts.json and the EDGAR
submissions archive) into open-data-store
batches. For each issuer it emits one entity_observations batch, one fundamentals 3.1.0
batch (facts as filed, by tag) and one filing_statements 1.0.0 batch (which tag is on which
statement) and one filings 1.0.0 batch (each report filing's form and reportDate, from the
submissions archive), always the full history; replaying the same inputs is a no-op in the store.
company-corpus statements --universe <name> --write first archives the SEC bulk files
(5.7 GB under raw/_sec_statements/) and extracts the positions per issuer. Which tag answers
which concept is decided when reading: see docs/FINANCIALS.md.
store-batches writes into a landing zone and never publishes: you run
open-data-store publish afterwards. It is a dry run unless --write.
A fundamentals.filing_ref can lack a filings row when EDGAR lists the filing under another
accession number than the one companyfacts cites (3 of 40,049 on the 672-issuer corpus,
2026-11-09): a reader treats an unmatched filing_ref as form unknown.
Run with --write and without --offline to refresh stale archives: offline, filings made after
the last archive fetch are missing from filings and their facts carry the fallback known_at.
Before PyPI, the store was installed under its former names (my-open-data, renamed 2026-11-22,
then open-data-store from a git URL): run pip uninstall -y open-data-store (or my-open-data)
before it is installed again as myopenfund-open-data-store, and rename MYOPENDATA_* variables to
OPEN_DATA_STORE_* in your shell profile (an unset OPEN_DATA_STORE_DATA_ROOT turns the --landing
below into /landing).
Details: the store's
docs/MIGRATION.md.
# open-data-store writer (optional extra); publishing needs myopenfund-open-data-store[publisher]
pip install "myopenfund-company-corpus[store]"
company-corpus --contact "$SEC_CONTACT" store-batches --universe sp_curated \
--landing "$OPEN_DATA_STORE_DATA_ROOT/landing" --write
open-data-store publish
The CLI stays importable without the extra; store-batches then fails cleanly
(exit 1) and says what to install.
Submissions archive. Identity observations come from raw/<cik>/submissions/
(the main submissions JSON plus its paginated files, each with a sidecar). A
missing archive is fetched on --write; --refresh-submissions re-fetches it to
pick up new observations; --offline never fetches, so an issuer without an archive
fails. --refresh-submissions with --offline is a usage error. verify treats
the archive as layer 0, like companyfacts.json. A dry run reports an issuer
without an archive as pending_fetch and writes nothing.