Bio: a personal biopharma data warehouse
Local-first warehouse for private research on shelved and deprioritised drug assets. It is built only from primary public sources (ClinicalTrials.gov, AACT, FDA, SEC EDGAR, Open Targets, ChEMBL, Federal Register). Every row carries source_url, fetched_at and content_hash. Every derived value names the rule that produced it.
Quick start
uv sync
uv run python -m bio build all # Phase 2 tables from every CT.gov pull on disk (about 11 min)
uv run python -m bio build3 # Phase 3 tables + views (about 40 s)
uv run python -m bio ui # explorer site: http://127.0.0.1:8765 (every dataset filterable, CSV export)
uv run python -m bio ui-classic # original table site, kept as a copy: http://127.0.0.1:8766
uv run python -m bio ui-plain # plain-language site, shelved copy: http://127.0.0.1:8767
uv run python -m bio export # data/parquet/<table>/part-0.parquet (zstd)
uv run pytest -q && uv run ruff check src tests && uv run --group analysis mypy src
uv run --group analysis python -m bio backtest # revival backtest (pandas/lifelines/statsmodels in the analysis group)
uv run python -m bio build-results # posted CT.gov results -> trial_readout (also run by build3)
uv run --group analysis python -m bio success # success model + graveyard scores (needs ot-pull-parts, below); retired from display 2026-11-12
uv run --group analysis python -m bio reading-list # evidence packs for the top graveyard assets + review rows
uv run --group analysis python -m bio postshelf # post-shelving information flag + its backtest (docs/postshelf.md)
uv run --group analysis python -m bio sec-flags # 8-K/6-K reprioritisation + negative-topline flags (docs/sec-flags.md)
uv run --group analysis python -m bio signals # per-asset OOPD status, post-shelving dates, SX flags
uv run --group analysis python -m bio pit # point-in-time backtest of the automated funnel (docs/pit-backtest.md)
uv run python -m bio build-shelved # shelved-drug database: graveyard_score/_review/_signal, v_shelved
Fetching (only needed to refresh the raw layer; each source keeps a manifest under data/raw/<source>/manifests/):
| command | source |
|---|---|
ctgov-pull <run_id> [--since YYYY-MM-DD] | ClinicalTrials.gov API v2, industry interventional trials first posted 2005 onwards |
aact-pull <ctgov_run_id> | AACT monthly flat-file snapshots (needs the AACT website login in .env) |
sec-pilot / sec-facts / sec-deals | SEC submissions, Exhibit 21, lineage citations; XBRL companyfacts; 8-K deal candidates |
sec-lineage-auto / sec-facts-all | lineage citations for widened candidates; XBRL companyfacts for every CIK-linked sponsor |
sec-press-plan / sec-press-all [--shard i --shards n] | every CIK-linked sponsor's 8-K (items 2.02/2.05/7.01/8.01) and 6-K list, then the first EX-99 of each (drug-developer SIC codes; resumable; shards share the 10 req/s budget) |
| (manual) | OOPD orphan designations: Excel export from accessdata.fda.gov into data/raw/fda/oopd/ |
chembl-pilot | ChEMBL exact-name lookups for pilot names Open Targets doesn't know |
ot-pull-parts association_by_datatype_direct | Open Targets target-disease scores per datatype (genetic support; 860 MB) |
fda-pull / fedreg-text / ot-pull | openFDA CRLs, FDA AdCom JSON, Federal Register notices / notice full text / Open Targets bulk parquet |
sec-press | 8-K item 7.01/8.01 press-release exhibits (PDUFA dates, CRL and designation disclosures) |
Weekly refresh: ctgov-pull inc-<date> --since <last pull date>, then build all and build3. Older copies of a trial stay as history observations.
Secrets (SEC User-Agent contact, openFDA key, AACT login) live in .env (gitignored), never in code.
Layout
src/bio/sources/ fetchers: raw payload + manifest, nothing else
src/bio/load/ raw -> staging / core tables (offline)
src/bio/resolve/ sponsors + lineage, assets (rules in config/resolution.toml)
src/bio/derive/ trial versions, asset state machine, events
src/bio/sql/ schema.sql (DDL), views.sql (gold views)
src/bio/ui.py read-only local browser
config/*.toml every rule and threshold; the file's sha256 is the rule_version on derived rows
curation/*.csv the few human decisions, each with a basis (sponsors, lineage hints, alias overrides)
docs/ recon, schema, and the per-phase checkpoint reports
data/ raw payloads, warehouse, logs (gitignored)
Reading the data
v_asset_current,v_holder_pipeline,v_graveyard: asset state overall and per holder. TheevidenceJSON shows the open trials, the last activity, the last stop (with its whyStopped text) and the other sponsor's trial behind an out-licensing call.v_trial_current,trial_version: CT.gov status history from 2017 (AACT monthly) plus the live pull.v_fda_decisions,v_catalyst_calendar,v_landscape,v_company_financials.v_shelved: the shelved-drug database (graveyard assets with model scores, evidence tier and review verdicts).trial_readout,trial_result_analysis: posted-results readouts (met / not_met / no_test) per trial.review_queue: everything the rules would not decide. Nothing uncertain is merged silently.source_coverage: known gaps per source, for example partial CRLs and the AACT months parsed unquoted.
Status
| phase | document |
|---|---|
| 0 BPW recon | docs/bpw-recon.md |
| 1 schema + source verification | docs/schema.md |
| 2 trials, entity resolution, assets, state machine (pilot) | docs/phase2-report.md |
| 3 regulatory, events, deals, landscape, financials | docs/phase3-report.md |
| 4 UI, gold-set validation, tests | docs/phase4-validation.md, tests/ |
| revival backtest (thesis check) | docs/backtest-revival.md, generated numbers in docs/backtest-revival-results.md |
| success model (P(approval) retired 2026-11-12), readouts, evidence tiers | docs/success-model.md, docs/success-model-results.md |
| shelved-drug database + manual review | v_shelved, UI /shelved, docs/graveyard-review.md, curation/graveyard_review.csv |
| post-shelving information, OOPD status | docs/postshelf.md, docs/postshelf-results.md |
| press-release flags (all CIK-linked sponsors) | docs/sec-flags.md, docs/sec-flags-results.md |
| point-in-time backtest (2018, 2020) | docs/pit-backtest.md, docs/pit-backtest-results.md |
| public dated predictions | docs/prereg/ |
Entity resolution covers every industry-led trial (111,552). Curated sponsors (Pfizer lineage, Ipsen/Epizyme, Spyre, Clovis, Carisma) carry hand-checked lineage and Exhibit 21 aliases. All other sponsors are resolved by exact name and SEC CIK (docs/phase2-report.md §8). SEC deal mining still covers the curated sponsors only; press-release mining covers every CIK-linked drug developer (sec-press-all, sec-flags).