Download PIPELINE.md from ZipLime/insider-trading: direct link, hf CLI and curl.
- Browser
- Download file 30.7 kB
-
https://huggingface.co/datasets/ZipLime/insider-trading/resolve/main/PIPELINE.md
- Command line
-
hf download hf://datasets/ZipLime/insider-trading/PIPELINE.md
-
curl -L -o PIPELINE.md https://huggingface.co/datasets/ZipLime/insider-trading/resolve/main/PIPELINE.md
ZipLime Insider Trading — pipeline contract
This document is the operational specification for building and publishing the
point-in-time SEC Form 4/Form 4/A dataset. The code in recipe/, the
data, this document, and manifest.json must be published from
the same repository revision.
How this build was loaded
Two routes reach the same filings, and the recipe carries both.
The dissemination feed delivers one archive per trading day holding every
submission EDGAR disseminated that day. It is authoritative and complete, and it
is expensive: roughly a terabyte and a half for two decades, of which Form 4 is
a low single-digit percentage. The code for it remains in recipe/feed.py and
recipe/backfill.py.
The quarterly extracts SEC republishes at
insider-transactions-data-sets carry the same filings as TSV tables from
2006 Q1 onwards: eighty-two archives, under a gigabyte. recipe/bulk_form345.py
shapes their rows into the same ParsedOwnershipDocument the XML parser
produces, so one normalisation computes every derived field and the two routes
cannot classify the same filing differently.
This build used the extracts. They were checked against the feed route on a shared quarter first: 65,957 submissions, identical Table I and Table II row counts with no per-filing discrepancy, every price agreeing to the cent, and matching value distributions across all 61 published fields.
Five differences surfaced in that comparison and were fixed in the adapter -- derivative values belong in the derivative columns, footnote text has to travel with the row, footnote references are cited from several fields and must be de-duplicated, the extract applies CSV quoting, and whitespace needs the same collapsing the XML parser applies. Two differences are inherent to the source and are documented in the dataset card: values are rounded to two decimals, and roughly 7% of rows carry fewer footnote references than the filing does.
What the extracts do not carry at all is the acceptance timestamp, which is why knowledge time is resolved separately -- see below.
Non-negotiable invariants
- SEC EDGAR is the source of truth. Third-party insider datasets may be used for QA, never to populate core facts.
- Event time and knowledge time remain separate.
event_dateis the transaction date;knowledge_dateis the EDGAR acceptance timestamp in UTC, or an explicitly marked conservative fallback. - Raw and PIT history are append-only. A later Form 4/A, parser release, or SEC index correction cannot silently rewrite what was knowable earlier.
- Parsing and classification are deterministic and versioned. No LLM is used to infer core facts, tickers, transaction types, or amendment links.
- Every output row is traceable. Accession number, source URL, source-row index/table, parser version, and insertion timestamp make a source filing recoverable.
- Publication follows validation.
update --publishstages all changes, rebuilds derived outputs, runs schema/quality/PIT checks, and calls the Hugging Face upload only if every gate passes.
Source and access policy
Discovery uses SEC EDGAR daily and quarterly/full indexes and keeps only exact
form types 4 and 4/A. Filing content is read from ownership XML; the
complete-submission header supplies metadata such as the acceptance timestamp.
HTML is a debugging/fallback representation, not the normal parser input.
EDGAR master indexes are pipe-delimited and use both YYYY-MM-DD (quarterly)
and YYYYMMDD (daily) dates. The same ownership accession may appear once for
the issuer and again for one or more reporting owners, so discovery deduplicates
by canonical accession number. It preserves the index Filename: the first ten
accession digits need not be the issuer/archive CIK. Within a complete
submission, the parser selects the <DOCUMENT> whose <TYPE> is 4/4/A
and whose payload is an ownership document; it does not guess that the first
.xml filename is the ownership XML.
All SEC requests must have a declared application/contact User-Agent, remain below 10 requests per second, retry transient failures with bounded backoff, and use the persistent cache. The shipped default is the project contact:
ZipLime insider-trading/1.0 algo@limex.com
SEC_USER_AGENT can override it, but validation rejects anonymous or
placeholder contacts. The default client rate is 6 requests/second and can be
lowered with SEC_REQUESTS_PER_SECOND. Do not raise it to 10 or above.
Unchanged filings are not downloaded again.
Official references:
- Accessing EDGAR Data
- SEC Developer Resources / Fair Access
- EDGAR APIs
- Ownership XML technical specifications
- Forms 3/4/5 guide and transaction codes
Runtime configuration
Python 3.11 or newer is required.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev,publish]'
cp .env.example .env
Load .env with your preferred environment manager. Do not commit it.
| Variable | Required | Meaning |
|---|---|---|
SEC_USER_AGENT |
for SEC access | Real application identity and monitored contact email. |
SEC_REQUESTS_PER_SECOND |
no | Client throttle; default 6, always < 10. |
SEC_CACHE_DIR |
no | Persistent source cache; default .cache/sec. |
DATA_DIR |
no | Output root; default data. |
HF_DATASET_REPO |
for publication | Destination; default ZipLime/insider-trading. |
HF_TOKEN |
for publication | Hugging Face write token. It must only be supplied as a secret. |
End-to-end stages
| Stage | Input | Output/contract |
|---|---|---|
| 0. Bootstrap update state | Existing Hugging Face revision when local data/filings is empty |
Authenticated download of prior data/** and manifest; non-404 download errors abort. |
| 1. Discover | EDGAR quarterly/full indexes for backfill; recent daily indexes for updates | Canonical accession, form type, filing date, CIK/path; unknown accessions enter the queue. |
| 2. Fetch | Filing/index queue | Cached complete submission and ownership XML. Existing immutable cache entries are reused. |
| 3. Parse | Submission header + ownership XML | Source-backed filing, owner, Table I, and Table II records. XML namespaces/schema age and unknown fields must not break the whole run. |
| 4. Normalize/classify | Parsed records | Stable IDs, nullable source facts, deterministic role/economic/signal classes, ticker policy, and quality flags. |
| 5. Append raw | Normalized records | filings, transactions, and owners; no update/delete of historical knowledge events. |
| 6. Reconcile amendments | New Form 4/A plus existing lineage | Conservative revision links/statuses; unresolved cases stay explicit. |
| 7. Build derived | Append-only transaction history | PIT representation and daily/trailing features calculated strictly in knowledge-time order. |
| 8. Validate | All staged configs | Schema, identity, quality, amendment, idempotency, and no-look-ahead gates. |
| 9. Publish | Validated staging tree | One Hugging Face dataset revision containing recipe, docs, manifest, and all configs. |
The expected data layout is:
data/
transactions/**/*.parquet
filings/**/*.parquet
owners/**/*.parquet
features/**/*.parquet
pit/**/*.parquet
run_log/*
Partitions may be split by filing year without changing the logical config.
filings, transactions, pit, and features partition on knowledge time.
owners has no knowledge timestamp of its own, so it currently partitions on
inserted_at; its knowledge_year= directories therefore record when a row was
written, not when the market could see it. Deduplication is by id and no query
path prunes owners by partition, so results are unaffected — but the directory
names should not be read as knowledge time, and a partition-scoped repair of
owners has to filter by accession instead.
EDGAR behaviours the recipe must handle
These were confirmed against live www.sec.gov and are covered by tests; each
one silently breaks a naive implementation.
A missing archive object answers 403, not 404. EDGAR serves the archive
from an object store that returns 403 AccessDenied for a key that does not
exist. Weekends, holidays, and the current day before the feed is published all
look like this, so a daily run that treated only 404 as "no index" would fail
every time it touched a non-publishing date.
A Fair Access block is also 403, and the two must never be confused:
| Missing object | Fair Access block | |
|---|---|---|
server |
Apache |
AkamaiGHost |
content-type |
application/xml |
text/html |
| body | <Error><Code>AccessDenied</Code> |
"Undeclared Automated Tool" |
x-amz-request-id |
present | absent |
SECObjectMissing is an ordinary skip; SECAccessBlocked aborts the run and is
never retried. A block must not be recorded as a per-filing parse error: that
would write a whole blocked window into append-only history as failures that
cannot later be corrected.
Ownership XML is wrapped in an SGML <XML> container. Live submissions nest
the document as <TEXT><XML><?xml ...?>...</XML></TEXT>, which puts the XML
declaration on line 2 and is rejected by any conforming parser. Extraction
unwraps the container, tolerating a missing closing tag so a truncated
submission still reaches the parser and is recorded as a visible parse error.
The dissemination feed hard-wraps lines at 1023 characters. The break
ignores markup, so a tag is split in half — Tyson Foods 0000100493-04-000080
carries </footn and ote> on separate lines. About 1% of 2004 filings are
unparseable until the wrap is undone. Fragments are rejoined without a
separator, because the wrap is a pure insertion at a byte offset.
There is a second rule on top of it: when the continuation would begin with a
hyphen, the feed prefixes it with - , making that line 1025 characters. Alliant
Energy 0000107832-04-000009 splits a date as <value>2004 + - -01-02</value>,
which must reassemble as 2004-01-02. The marker is stripped rather than
joined. This case is rarer — roughly 0.5% of 2004 filings — and depends on a
hyphen landing exactly on the wrap boundary, so a sample can easily miss it.
Two ingestion routes exist, and they differ in what they can prove.
The per-filing route reads the full .txt submission, whose SEC-HEADER
carries an authoritative ACCEPTANCE-DATETIME. It costs one request per
filing, and SEC's limit caps requests rather than bytes, so a historical run
leaves the link 99% idle while exhausting the request budget.
The feed route reads Archives/edgar/Feed/YYYY/QTRn/YYYYMMDD.nc.tar.gz, one
archive per day. On 2004-01-05 that is 28 MB holding 5,724 submissions, 4,300
of them Form 4/4-A — a thousand requests collapsed into one. Parsing those
members reproduced the per-filing route exactly: 4,296 filings in common, field
agreement 4,296/4,296.
Its cost profile is the mirror image. Measured on a 2006 day: 95% download,
2.3% untar, 2.5% parse (750 filings/s single-threaded). Parallelising the parse
would chase a rounding error; days are therefore fetched concurrently
(FEED_PREFETCH_DAYS), which is what actually moves the number.
The feed carries no acceptance timestamp. Its <SUBMISSION> header stops at
FILING-DATE. Neither do the master/form/company indexes. So the feed
route needs its timestamps from submissions.zip, whose historical records are
frequently Eastern local time stamped Z, with no field marking which encoding
a value uses.
Measured against 68,000 filings of SEC-HEADER ground truth, the corruption has
exact structure, and recipe/acceptance.py exploits it:
- the shift is always the Eastern offset for that date (+5h EST, +4h EDT);
- it is uniform per CIK record set within an era, and drifts across eras;
- the same filing appears under the issuer's and each owner's CIK, and those copies can disagree — where they do, the later is the true UTC, because the error only ever runs early.
EDGAR accepts filings 06:00-22:59 ET, which leaves UTC hours only one encoding can produce: 04:00-09:59 is impossible for a true UTC stamp, 23:00-03:59 for an Eastern one. Hours 10:00-22:59 decide nothing and the set abstains.
Two calibration results are load-bearing and were each found by being wrong first:
- The window ends at 22:59, not 22:00. Eleven of 68,000 filings land in the 22:00 ET hour. Treating hour 22 as proof of UTC misclassified whole record sets, leaving 3,083 filings five hours early — in the look-ahead direction.
- Eras must not be merged. Classifying a CIK across 2003-2005 gave 100% accuracy at 76.5% coverage; widening to 2003-2008 raised coverage to 84.2% and introduced errors. The index is therefore built per target year over a +/-1 year window and merged, never in one wide pass.
With those in place the correction reproduced ground truth exactly: 45,209
resolved, 0 wrong. Coverage on 2005-2010 is 82.4%; the remainder keeps an
empty accepted_at and takes the end-of-filing-day estimate, which errs late
and so cannot manufacture look-ahead. Corrected values carry
edgar_bulk_acceptance_corrected, never edgar_acceptance_datetime: an
inferred timestamp must stay distinguishable from a read one.
Resumption is day-level on the feed route. The accession filter runs only
after an archive is in memory, so a restart that checked accessions alone would
re-download hundreds of megabytes per finished day to discard every filing in
it. ingested_filing_days() skips them before the request.
One filing appears as several index rows. The master index carries one row per CIK — the issuer plus each reporting owner — so a Form 4 with two reporting owners appears three times. Discovery deduplicates by accession number, and index row counts are therefore roughly three times the number of filings. Do not size a backfill from raw index line counts.
Collection and identity contracts
The incremental collection boundary is conceptually:
async def fetch(since: datetime) -> pl.DataFrame:
"""Return knowledge events discovered since `since`."""
Collection discovers source events. Ingestion owns deduplication, append-only storage, derived rebuilds, manifest metadata, and publication.
Accession numbers are canonicalized as ##########-##-######. Transaction IDs
are independent of mutable facts such as ticker, date, shares, or price:
{accession_number}_{table I|II}_{one-based deterministic index}
The same source inputs and recipe version must produce the same IDs and values;
a second run must add no duplicates. Joint filings create one transaction row,
with owner arrays plus separate owners relations. Never multiply notional by
the number of reporting persons.
Ticker resolution order is:
- symbol disclosed in the Form 4;
- a Ziplime temporal security-master mapping valid at
knowledge_date; - null.
Issuer name matching or an LLM must not guess a ticker. issuer_cik remains the
stable source identity.
Point-in-time contract
For each transaction:
event_date = transaction_date
knowledge_date = accepted_at converted to UTC
EDGAR acceptance time is the reproducible disclosure proxy, not an exact
sec.gov first-availability timestamp. SEC says documents are often available
on sec.gov within roughly 1–3 minutes of the EDGAR timestamp, while
ownership-form submissions begun after the 22:00 ET cutoff may wait until the
next business day. If acceptance time is absent, the fallback is recorded as
filing_date_eod_fallback or first_seen_fallback, and knowledge_estimated = true. No artificial dissemination timestamp is added to the core data;
intraday users should apply a conservative policy appropriate to their study.
The filing-date fallback is 23:59:59.999999 in America/New_York converted to
UTC; if filing date is also absent, UTC first_seen_at is used.
A valid as-of result at simulation timestamp T can use only rows and
revisions with knowledge_date <= T. Derived features are aggregated by
(ticker/issuer, knowledge_day), never by transaction day. A chronological
replay and a build from the full input must produce the same feature values for
each as-of cutoff.
For daily features, knowledge_day is the America/New_York date of the input
events. feature_available_at/feature knowledge_date is midnight at the start
of the next calendar day in America/New_York, converted to UTC. Every row also
records input_max_knowledge_date so validation can prove that no future input
entered the feature.
Amendment contract
Form 4/A is not assumed to be a complete replacement for its original Form 4.
Its XML supplies dateOfOriginalSubmission, but not the original accession
number, and often includes only the changed rows. It may change one value,
add/remove a row, alter a role, or only change a footnote. Therefore:
- original and amended filings and transaction rows are retained;
- an amendment is visible only from its own acceptance timestamp;
logical_transaction_id,revision,supersedes_transaction_id,superseded_by, andamendment_statusexpress lineage;- possible statuses are
original,amended,added_by_amendment,removed_by_amendment,unchanged, andunresolved; - uncertain matching is
unresolved; it is never forced by fuzzy/LLM logic; - raw lineage points backward through
supersedes_transaction_id; the older raw row is not mutated with a futuresuperseded_byvalue; - omission from a partial amendment is never interpreted as deletion;
- a future amendment must not affect an earlier as-of query.
The structured aff10b5One flag is document-level and exists for Form 4/5 from
2023-04-01. A true value is attributed to a transaction only through its
footnote evidence or when the filing has exactly one transaction; ambiguous
rows in a mixed filing remain null. Filing-level false is not proof that an
individual row was discretionary. Older absence remains null. Any plan adoption
date must be supported by explanation/footnote text rather than fabricated
from the structured flag.
If improved reconciliation or parsing changes historical normalized values, it is a deliberate rebuild release with a new dataset revision. It is not an in-place mutation of an existing PIT release.
Failure policy
A bad filing must not erase or hide valid data, and it need not stop the rest of the parse queue:
discovered -> downloaded -> parse error
-> filings.parse_status = "error"
-> parse_error recorded
-> continue with next accession
Every discovered accession gets a filing-ledger row. There is no silent skip.
The cached source makes an error reproducible locally. first_seen_at,
last_seen_at, and sec_presence_status preserve the historical observation
even if an accession later disappears from a current SEC index.
Recoverable per-filing errors are recorded and summarized. Dataset-level failures stop publication, including:
- schema drift or a missing required config/column;
- duplicate accession or transaction IDs;
- invalid PIT ordering or future-knowledge leakage;
- an idempotency mismatch;
- a parser-wide failure/explosion;
- an unexpected missingness or unknown-code spike above the configured gate;
- a staged derived layer inconsistent with staged raw data.
Do not publish a partial staging tree after a failed gate. The previous Hugging Face revision remains the latest valid release.
Validation contract
The validator covers at least:
- unique accession numbers and transaction IDs;
form_type in {4, 4/A}and known enum domains;- nonnegative reported shares when present;
acquired_disposed in {A, D, null};P/AandS/Dsanity as flags, not destructive filters;- structurally impossible reported prices/notionals flagged, never edited;
- PIT visibility before/after an acceptance timestamp;
- original-before-amendment and amended-after-amendment as-of behavior;
- temporal ticker behavior across symbol changes;
- deterministic reruns and chronological feature replay.
Source fixtures cover 2003-era XML, modern XML, Table I/II, multiple rows and owners, missing tickers, grants/exercises/tax/gifts, 10b5-1, and several Form 4/A correction shapes.
Commands
Every command is exposed by one CLI, python -m recipe.cli (installed as
ziplime-insider). The same commands run locally and inside a Hugging Face Job.
Local checks
ruff check .
pytest
python -m recipe.cli validate --data-dir data
python -m recipe.cli diagnostics --data-dir data --output data/diagnostics.json
Historical backfill
Backfill is a separate operation from the live updater. It walks EDGAR quarterly full indexes one quarter at a time, so a multi-year run keeps bounded memory and resumes from the accessions already in the filing ledger:
python -m recipe.cli backfill \
--start 2003-06-30 \
--end "$(date -u +%F)" \
--data-dir data \
--cache-dir .cache/sec
Use --limit N only for development/smoke runs. It does not represent complete
historical coverage. Add --publish to upload the validated result.
Incremental update
python -m recipe.cli update \
--data-dir data \
--cache-dir .cache/sec \
--lookback-days 7
When data/filings is empty, the updater first calls authenticated
bootstrap_from_hf() for the selected --hf-repo/HF_DATASET_REPO, restoring
the prior published data/** and manifest before discovery. A missing dataset
repository is treated as an unpublished first release; authentication, network,
and other bootstrap errors fail closed when the run intends to publish. This
prevents an ephemeral runner from replacing history with only its lookback
window. Pass --no-bootstrap to work strictly against the local tree.
The lookback intentionally overlaps prior indexes; accession-level dedupe and the cache make reruns idempotent while protecting against delayed index appearance. An accession already present in the ledger is never re-downloaded, which is also what keeps observation timestamps stable under the append-only store.
For the first public release, run and validate the historical backfill before publication. A seven-day incremental update is not evidence of 2003-present coverage.
Rebuild derived configs
python -m recipe.cli build-derived --data-dir data
Validated publication
python -m recipe.cli update \
--data-dir data \
--cache-dir .cache/sec \
--lookback-days 7 \
--hf-repo ZipLime/insider-trading \
--publish
--publish requires HF_TOKEN. The command always validates the newly staged
raw and derived outputs before upload; validation failure returns nonzero and
no dataset revision is published.
Scheduled updates on Hugging Face Jobs
Scheduling and compute live on Hugging Face, next to the data. There is no external CI system in this project: the dataset, the recipe revision that produced it, and the machine that runs the recipe all stay in one place, and a run is not bound by an external runner's disk or wall-clock limits.
The scheduled job runs jobs/run.py, a self-contained
PEP 723 UV script fetched by URL from this
dataset repository. It restores the repository at one revision, then runs the
gates in a fixed order:
restore repository -> lint -> tests -> ingest -> validate -> publish
Lint and tests run before any SEC request, so a broken recipe costs neither SEC traffic nor compute. The CLI then re-validates the staged tree and refuses to upload if any gate fails, leaving the previous revision as the latest valid release.
Because a Job downloads exactly one file, the script must not import anything
from this repository, and its inline dependencies must match pyproject.toml.
Both properties are enforced by tests/test_jobs.py
rather than by review, along with a check that the arguments this recipe passes
are actually accepted by the installed huggingface_hub. The Jobs API requires
huggingface-hub>=1.19; earlier releases have no Jobs support at all.
Create and manage the schedule
export HF_TOKEN=... # write token for the dataset repo
export SEC_USER_AGENT="ZipLime insider-trading/1.0 you@your-domain"
python -m recipe.cli schedule create --schedule "17 6 * * *"
python -m recipe.cli schedule list
python -m recipe.cli schedule inspect <scheduled_job_id>
python -m recipe.cli schedule suspend <scheduled_job_id>
python -m recipe.cli schedule resume <scheduled_job_id>
python -m recipe.cli schedule delete <scheduled_job_id>
schedule run launches the same job once without registering a schedule, which
is the way to start a full backfill:
python -m recipe.cli schedule run --job backfill --start 2003-06-30
Credentials are validated locally first: a placeholder SEC contact or a missing
token fails before a Job is created. HF_TOKEN and SEC_USER_AGENT are passed
as encrypted Job secrets, never as plain environment variables.
| Job | Flavor | Timeout | Notes |
|---|---|---|---|
update |
cpu-upgrade (8 vCPU / 32 GB / 50 GB) |
3h | Daily lookback. |
backfill |
cpu-xl (16 vCPU / 124 GB / 1000 GB) |
24h | 2003-present needs the larger disk. |
The default 30-minute Job timeout would kill a real run mid-ingest, so both specs set an explicit one. Hardware flavors, pricing, and the scheduling syntax are documented in the Hugging Face Jobs guide.
Measured cost and scaling
Numbers below are from a real local run of 2026-01-01..2026-08-27 on this recipe: 131,221 filings, 300,850 transactions, zero parse failures, 7h32m wall clock at the configured 6 requests/second.
| Stage | Cost over 300,850 transactions |
|---|---|
| Download + parse | 5.4 filings/s, the SEC rate limit is the bound |
| Amendment reconciliation | 3.4 s, 1.8 GB peak |
| PIT build | under 0.1 s, no measurable allocation |
| Feature replay | 6.3 s, 1.2 GB peak, producing 205k rows |
| Full derived rebuild | 9.3 s, 2.5 GB peak |
| Published output | 75 MB Parquet |
Three properties keep the derived rebuild inside available memory, each verified to reproduce the previous implementation's output exactly on the 300,850-row corpus:
- PIT is a column projection, expressed in Polars rather than per-row Python objects. Row-wise construction cost 52 s and several GB for a pure rename.
- Reconciliation splits hot from cold. Only an issuer that filed a Form 4/A can have lineage, so other issuers' rows are settled vectorised; roughly a quarter of rows reach the row-wise path.
- Reconciliation reads a narrow projection. Lineage depends on about a third of the columns, so only those are expanded, and the resulting lineage columns are joined back onto untouched source rows.
- Feature replay is per entity. Entities replay independently, so each is expanded on its own instead of materialising the whole PIT frame.
Two further properties keep a long backfill from going quadratic:
Bounded reconciliation. Lineage is resolved against a fixed
RECONCILE_WINDOW_DAYS window (1095 days) rather than the whole history, and
AppendOnlyParquetStore.scan(since=...) prunes by knowledge_year/
knowledge_month partition so the read is bounded too. The window is a
constant, never a function of batch size, so a filing reconciles identically
however a run was chunked. It is justified by the data: measured against the
2026 corpus, amendments arrive a median of 13 days after their original, and a
1095-day window covers 99.5% of them. Amendments outside the window stay
unresolved, which is the documented conservative outcome, not silent loss.
Issuer-indexed candidate search. Only an issuer's own earlier filings can be
the parent of its amendment, so the search is indexed by issuer_cik instead of
scanning all prior filings. This is 2.7x faster on the 2026 corpus and was
verified to produce byte-identical lineage to the unindexed implementation
across all 300,850 rows.
Backfill therefore uses a larger batch (2000) than the updater, amortising the fixed per-batch reconciliation over more filings.
Filing volume is not flat across history: 2004-2008 runs about 242,000 filings a year against 197,000 for 2026, so the full 2003-present history is roughly 5M filings and over a week of download at the SEC rate limit. That is why the historical backfill runs in chunks rather than one process.
On a disk-constrained machine, backfill --no-cache-filings streams
submissions instead of caching them: the cache runs about ten times the size of
the Parquet it produces. --no-derived ingests raw configs only, leaving the
PIT and feature rebuild for build-derived on a machine with more memory.
Run observability
Each run writes a machine-readable summary to data/run_log/{mode}-{timestamp}.json,
which is published with the dataset revision. It records:
mode, run_started_at, run_finished_at, start_date, end_date
filings_discovered, filings_new, filings_downloaded, filings_parsed, filings_failed
filings_added, transactions_added, owners_added
amendments_added, amendments_unresolved
unknown_codes, missing_tickers
pit_events, feature_rows
bootstrapped_from_hf, quality_ok, recipe_hash, dataset_revision
warnings, errors
A run that raises still writes its summary before propagating the error, so a
failed scheduled run is diagnosable from the log rather than only from stdout.
python -m recipe.cli diagnostics produces the coverage and anomaly report
described below.
Diagnostics for a completed backfill include annual filing/transaction counts, transaction-code distribution, missing ticker/price/acceptance rates, amendment/derivative/10b5-1 shares, extreme notionals, impossible date order, unknown codes, and duplicate identity checks. Generated metrics belong to a specific revision; they must not be copied forward as timeless claims.