[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110097":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":39,"updatedAt":40,"readmeContent":41,"aiSummary":42,"trendingCount":16,"starSnapshotCount":16,"syncStatus":43,"lastSyncTime":44,"discoverSource":45},110097,"medradar","ChazY11\u002Fmedradar","ChazY11","An evidence-first research platform for observing and studying early signals in medical technology development.","https:\u002F\u002Fchazy11.github.io\u002Fmedradar\u002F",null,"Python",395,25,18,1,0,20,114,298,99,94.14,"Other",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38],"clinicaltrials","data-science","evidence-based","fda","medical-devices","medical-technology","openfda","python","regulatory-data","research","sec-edgar","time-series","2026-11-20 16:37:54","2026-11-23 20:06:04","# MedRadar\n\n[![Built with DeepSeek Harness · deepseek-flash](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbuilt%20with-DeepSeek%20Harness%20%C2%B7%20deepseek--flash-4D6BFE)](https:\u002F\u002Fgithub.com\u002FChazY11\u002Fmedradar\u002Fblob\u002Fmain\u002Fdocs\u002FATTRIBUTION.md)\n\n\n**An open-source radar for FDA device & drug industry direction — built for people who need to know\nwhat US majors are actually building next, not what they said in an earnings call.**\n\nMedRadar turns free public FDA data into a weekly, quantified, Chinese-language intelligence\nbrief: which technology tracks are heating up, which majors are quietly re-allocating their\nportfolio, what appeared for the first time, and where China still has a gap.\n\n> The stable core through `v0.2.2` was built with DeepSeek Harness using `deepseek-flash`.\n> The research foundation (`medradar\u002Ftkg`, `forecast_registry`) and the Market-to-R&D lane were\n> authored in independent Kimi Code sessions; `v0.3.0` consolidates their branches after an\n> independent forensic audit and defect-fix pass. Authorship is recorded per increment in\n> [docs\u002FATTRIBUTION.md](docs\u002FATTRIBUTION.md) and the merge\u002Faudit\u002Ffix decisions in\n> [docs\u002FINTEGRATION_2026-11-02.md](docs\u002FINTEGRATION_2026-11-02.md).\n\n> 中文文档 → [README.zh-CN.md](README.zh-CN.md) · Methodology → [docs\u002FMETHODS.md](docs\u002FMETHODS.md)\n\n![MedRadar dashboard](docs\u002Fpreview.png)\n\n### What one run produces (snapshot, 2026‑10‑31)\n\n| | |\n|---|---|\n| Events ingested | **375,378** (510(k) 176,466 · PMA 57,372 · recalls 59,646 · trials 55,592 · drug approvals 5,326 · EDGAR catalysts 20,976) |\n| Coverage | 89 companies, 60 tracks, **204 device product families**, 7,097 product codes, **1.2 GiB SQLite** |\n| Strongest track right now | 心脏节律 THI 1.94 (P=98.2%) · 可穿戴监测 1.80 · 结构性心脏病 1.57 · 手术机器人 1.54 |\n| Signals emitted | 281 (→ tradable subset) |\n| Case library | The historical snapshot contains **2,384 traceable cases**; v0.3.0 recomputes studies under the corrected taxonomy and extreme-return audit instead of carrying forward old category counts |\n| Replay | **400-step, 7-year timeline** (2019–2026) with 10\u002F25\u002F50 bps cost tiers; 1-minute fills for the last 7 days |\n| Frontier radar | **50 device tracks across 23 domains**; AdCom schedules\u002Fmaterials, first-posted trials, pre-submissions and designations in one feed |\n| Research integrity | Clinical holds, RTF, CRL, pre-submissions and designations are separate; absolute abnormal returns above 100% are audited and excluded from inference |\n| Market-to-R&D | **6,701 continuation + 41,003 dormant→active entry examples** (25\u002F24 quarterly origins) from 55,090 FDA events + 43,420 SEC facts + 3,453 procurement awards; purged multi-window evaluation and a 7-source ablation, honest negative result (below) |\n| Research infrastructure | Bitemporal knowledge store (valid time vs knowledge time) and an immutable forecast registry with as-of scoring; deterministic point-in-time export |\n| Forecast cycle | Canonical registry with a separate `nowcast` cohort; continuous cycle registers 25 real forecasts, verifies matured windows, exports a deterministic artifact; idempotent re-run |\n| Temporal graph | 55,090 events imported read-only → **57,381 nodes \u002F 114,419 edges**; PIT snapshot hash stable, idempotent re-import, read-only pair context\u002Ftimeline queries |\n| Research agent | Deterministic 8-tool workflow with cited evidence, 5 question templates, conflict detection and counter-evidence; real demo: 5 questions \u002F 55 claims \u002F 224 unique citations \u002F 0 missing |\n| Simulated book | in-sample, long-only, not investment advice |\n| Tests | **678 offline tests**, no network, no API key |\n| Report | 19 chapters, self-contained HTML dashboard (no CDN, no external assets) |\n| Products | 204 families, **2,740 Chinese product names** |\n| Research | event-time model, point-in-time signals, block bootstrap, Holm correction |\n| Timing scope | Public-time quality is explicit (`datetime` \u002F `date` \u002F `estimated` \u002F `unknown`). Only real `datetime`\u002F`date` availability enters return studies; historical decision dates without a public timestamp remain descriptive only |\n| Database | 1.2 GiB SQLite, 1966–2026 drug approvals, 1999–2026 trials |\n| Calibration | 25 hand-labelled real 8‑Ks: type accuracy **1.00 vs 0.60**, direction **0.92 vs 0.72** for the LLM judge |\n\n> Numbers move every week; every one of them is reproducible from `medradar run`.\n\n---\n\n## Try it in 60 seconds\n\n```bash\n# 1) clone the repository (or download the Release ZIP) and enter its root\n# 2) install and run the offline demo\npip install -e .\nmedradar demo           # offline, uses the committed snapshot, no API key, \u003C60s\n# open out\u002Fdemo\u002Findex.html (interactive dashboard: out\u002Fdemo\u002Fdashboard.html)\n```\n\nOr open the **interactive dashboard** directly: [`docs\u002Fdashboard.html`](docs\u002Fdashboard.html) — 7 views\n(overview, tracks, companies, products, cases, replay, data), live search, sortable tables,\ncase-evidence drawer, replay cost-tier switch and URL routing. It is a single self-contained HTML\nfile (3.3 MB, zero external requests), so it also works offline and on GitHub Pages.\n\nThen, for a live data run:\n\n```bash\nmedradar run --months 24 --with-trade    # ~3 min, free public data only\nmedradar replay --days 30                # event-to-fill timeline with cost tiers\nmedradar replay --start 2019-01-01 --end 2026-10-31 --source events   # 7-year, 400 steps\nmedradar cases --limit 20                # traceable case library with evidence quotes\nmedradar products --limit 10             # product families + new-product radar, in Chinese\nmedradar dashboard                       # rebuild docs\u002Fdashboard.html from the latest metrics\n```\n\n## What it answers\n\n| Question | Metric | Output |\n|---|---|---|\n| What happens before approval? | AdCom meetings\u002Fmaterials, first-posted trials, pre-submissions and designations | `out\u002Ffrontier.json` + `out\u002Ffrontier.md` |\n| Which device tracks are accelerating? | `THI` — shrinkage-adjusted recent rate ÷ baseline rate | Track heat table |\n| Is a specific major changing direction? | Jensen-Shannon divergence of its product-code mix | Migration table (\"who is re-allocating\") |\n| What is genuinely new? | First-ever `(company, product_code)` occurrences | \"First seen\" weekly list + product-family radar |\n| Which device product families are rising? | 204 families, 2,000 Chinese product names | Product radar chapter |\n| Is pharma shifting therapeutic focus? | Trial-start rates + phase mix per area | Drug radar |\n| Where is the China gap? | US activity share vs loaded NMPA registrations | `cn_gap` table (honest `unavailable` when no CN data) |\n| Does any of it predict equity returns? | Event study: direction-aligned abnormal returns at +1\u002F+5\u002F+20\u002F+60, block bootstrap + Holm | [Case library](docs\u002FCASES.md) + `out\u002Ftrading.json` (simulation only) |\n\n## Frontier lane: public signals before approval\n\n```bash\npython -m medradar collect --sources adcom,trials --months 24\npython -m medradar frontier\n```\n\nThe frontier feed combines FDA Advisory Committee schedules and briefing materials, first-posted\nclinical trials, pre-submissions and breakthrough\u002Fpriority designations from SEC filings. Its 50\ntracks cover life support (ventilation, ECMO, oxygen, resuscitation, monitoring), IVD (NGS, liquid\nbiopsy, MRD, companion diagnostics, microbiology, digital pathology), BCI, neuromodulation,\ncardiovascular, imaging, robotics, SaMD\u002FAI, renal and diabetes.\n\nThis is public-source monitoring, not a pending-application oracle. Non-public 510(k)\u002FPMA review\nstatus is confidential, so the machine-readable output explicitly sets\n`pending_510k_pma_monitoring=false` rather than manufacturing a pipeline from decision dates.\n\n**Known limitation (2026-11):** FDA renders the Advisory Committee calendar rows client-side, so a\nstatic fetch currently parses zero meetings. `collect --sources adcom` therefore returns\n`status=\"empty\"`\u002F`\"source_changed\"` with a warning instead of a silent `\"ok\"`, and the source is\nmarked experimental in [docs\u002FDATA.md](docs\u002FDATA.md). The other frontier inputs (first-posted trials,\n8-K pre-submissions\u002Fdesignations) are unaffected.\n\n## Live lane: event alerts + simulated trading (5–15 min)\n\nThe batch radar answers *\"what is the industry doing\"*. The live lane answers *\"what just happened\"*.\n\n```bash\npython -m medradar live --once --since-hours 2              # one cycle (cron \u002F DSH automation)\npython -m medradar live --interval 600                      # loop every 10 minutes\npython -m medradar live --once --backfill-days 7 --no-trade # seed recent catalysts (never traded)\npython -m medradar live --reset                             # wipe the simulated book\n```\n\nEach cycle: SEC EDGAR 8-K feed (seconds) → EDGAR full-text backfill → FDA press RSS →\nClinicalTrials.gov status changes → keyword classifier → **simulated order at the latest real\nYahoo quote plus 10 bps slippage** → mark-to-market → alert (console + `out\u002Flive_alerts.jsonl` +\noptional `MEDRADAR_WEBHOOK_URL`).\n\nHonest latency, measured 2026‑10‑31:\n\n| Source | Latency | Tradable? |\n|---|---|---|\n| SEC 8-K filings | seconds | ✅ |\n| FDA press RSS | ~8 days stale at the time of writing | ❌ informational |\n| ClinicalTrials.gov updates | hours | terminations only |\n| openFDA 510(k)\u002FPMA | 12 days | ❌ slow lane only |\n| FDA submissions under review | **not public** | physically impossible |\n\nLong-only, ≤5% per name, ≤25% per track, −20% stop, 60‑trading‑day exit. Shorts are **alerted but\nnot traded**: borrow fees and squeeze-outs would turn the P&L into fiction. This is a simulation —\nno broker, no orders, no money at risk.\n\n**Execution guards** (added after a pre‑release review):\n\n* only the fresh EDGAR feed can open a position — backfill, FDA RSS and trial updates are alert‑only;\n* a quote older than 30 minutes may mark the book but never fills an order;\n* position size is computed on the *slipped fill price*, so cash cannot go negative;\n* `--no-trade` freezes exits as well as entries;\n* duplicate alerts for the same `(ticker, day, kind)` are collapsed across sources.\n\n**Timing honesty**: `signal_date = event_date + 1`, and the fill is the open of the next trading day —\nroughly **two trading days after the event**. Conservative, not same‑day. Alerts whose public\ntimestamp is only date‑level are excluded from the trading study.\n\n### LLM judgement of the filing text (decides position size)\n\nA keyword classifier can say \"positive\". It cannot tell a first‑in‑class approval from a label\ntweak — and that difference is exactly what should scale a position from 1% to 5%. So the live lane\nsends the 8‑K text to an LLM and asks for a **structured, evidence‑quoted verdict**:\n\n```json\n{\"direction\": 1, \"materiality\": 0.82, \"confidence\": 0.9, \"catalyst_type\": \"approval\",\n \"asset\": \"Keytruda\", \"indication\": \"first-line NSCLC\", \"is_pivotal\": true,\n \"revenue_relevance\": \"high\", \"evidence_quotes\": [\"...\"], \"rationale_zh\": \"...\"}\n```\n\n* **Provider-agnostic**: any OpenAI-compatible endpoint.\n  `MEDRADAR_LLM_BASE_URL` (default `https:\u002F\u002Fapi.deepseek.com`), `MEDRADAR_LLM_API_KEY`,\n  `MEDRADAR_LLM_MODEL` (default `deepseek-chat`).\n* **Cached** by content hash — the same filing never costs tokens twice.\n* **Budgeted** — `--llm-budget 4` calls per cycle; over budget it falls back to the keyword judge.\n* **Evidence-first** — a verdict without a verbatim quote is down-weighted to half confidence.\n* **Sizing** — `position = 5% × clamp(materiality, 20%, 100%)`, so a routine earnings 8-K gets ~1%\n  and a first-in-class approval gets the full 5%.\n\n```bash\n# without a key it uses the deterministic fallback and says so (\"judge\": \"heuristic(no-llm-key)\")\npython -m medradar judge --file filing.txt --headline \"Company 8-K\"\n\n# with a key\nexport MEDRADAR_LLM_API_KEY=sk-...\npython -m medradar judge --url https:\u002F\u002Fwww.sec.gov\u002FArchives\u002F... --headline \"Company 8-K\"\n```\n\nCalibrated on **25 hand-labelled real 8‑Ks** (approvals \u002F CRLs \u002F trial readouts \u002F earnings) —\nfull report in [docs\u002FCALIBRATION.md](docs\u002FCALIBRATION.md):\n\n| metric | LLM judge | keyword baseline |\n|---|---|---|\n| catalyst_type accuracy | **1.00** | 0.60 |\n| direction accuracy | **0.92** | 0.72 |\n| materiality Spearman ρ | **0.80** | 0.58 |\n| high-materiality F1 (≥0.5) | **0.94** | 0.67 |\n| buys a CRL (should short) | **0** | 2 of 5 |\n\nThe baseline labels 4\u002F9 trial readouts and 5\u002F5 earnings as \"approval\" — and `earnings` is the\n\"do not trade\" switch, so that error matters. Materiality runs ~+0.15 high versus human labels;\nuse it for ranking, or shrink by 0.85 before sizing.\n\n## Quickstart\n\n```bash\n# from the repository root (clone it or unpack the Release ZIP first)\n# no API key, no dependencies beyond Python 3.10+\n\nmedradar demo                 # 60-second offline demo (snapshot, no network)\n# open out\u002Fdemo\u002Findex.html\n\n# 24 months is the quick start (~2-3 min); use --months 120 for ten years\npython -m medradar run --months 24 --with-trade --with-dashboard\n\n# outputs\n#   out\u002Findex.html          (also copied to docs\u002Findex.html for GitHub Pages)\n#   docs\u002Fdashboard.html     (interactive 7-view dashboard)\n#   out\u002Freport_zh.md        (Chinese research report)\n#   out\u002Fsummary.csv         (flat metrics for Excel)\n```\n\nEverything is resumable: every HTTP response is cached under `data\u002Fcache\u002F`, every stage can be\nre-run on its own.\n\n```bash\npython -m medradar collect --sources device,drug,trials,adcom --months 120\npython -m medradar frontier --out-dir out\npython -m medradar analyze --window-quarters 8 --baseline-quarters 20\npython -m medradar report\npython -m medradar trade --capital 100000\npython -m medradar status\npython -m medradar selftest        # offline, no network\n```\n\n## Data sources (all free, no credentials)\n\n| Source | Content | Freshness (measured 2026‑10‑31) |\n|---|---|---|\n| openFDA `device\u002F510k` | 510(k) clearances, 176k records | updated 2026‑10‑19 (T−12d) |\n| openFDA `device\u002Fpma` | PMA & supplements, 57k | T−12d |\n| openFDA `device\u002Frecall` | device recalls, 60k | T−2d |\n| openFDA `device\u002Fclassification` | ~6.5k product codes → regulated definitions | static |\n| openFDA `drug\u002Fdrugsfda` | NDA\u002FBLA\u002FANDA review & approvals, 29k | T−2d |\n| ClinicalTrials.gov API v2 | trial registrations (drug **and** device) | posted ≤21 days after enrollment starts |\n| FDA Advisory Committee Calendar | Public meetings, agendas and briefing materials | page-date estimates; descriptive only |\n| SEC EDGAR full-text search | 8-K regulatory, clinical and designation event stream (optional) | near real time |\n\n**NMPA (China) is deliberately not scraped.** `www.nmpa.gov.cn` answers HTTP 412 and `www.cmde.org.cn`\nHTTP 202 behind a JavaScript WAF. MedRadar ships an honest adapter instead: drop a CSV export at\n`data\u002Fnmpa_registrations.csv` and the China-gap table lights up; without it every CN value is `null`\nand the report says *\"不可用（NMPA 数据未加载）\"*. It never fabricates a zero.\n\n## How the numbers are computed (short version)\n\n* **Shrinkage first.** A company with 2 clearances this quarter has an infinite growth rate and no\n  information. Every rate is a Gamma–Poisson posterior with the entity's own baseline as prior\n  (strength: 3 quarters). `THI = posterior mean ÷ baseline rate`; `prob_up` is the posterior\n  probability that the true rate beats the baseline.\n* **Direction = mix, not volume.** A company can clear fewer devices while decisively moving into a\n  new category. We measure the product-code mix shift with Jensen–Shannon divergence and report the\n  tracks that moved ≥8 percentage points.\n* **Novelty = first occurrence.** A new `product_code` for a given company is the earliest visible\n  trace of a new product line.\n* **Signals carry an explicit `signal_date`** (event date + 1 day) so the trading study cannot peek\n  at the future.\n\nFull definitions, assumptions and threats to validity: [docs\u002FMETHODS.md](docs\u002FMETHODS.md).\n\n## Research-grade guarantees\n\n| Guarantee | How it is enforced |\n|---|---|\n| **No lookahead** | every event carries public-time metadata; return studies require real `available_at` plus `datetime`\u002F`date` quality, while `estimated`\u002F`unknown` and missing timestamps are counted and excluded |\n| **Point-in-time features** | the \"is this new?\" test and the track-popularity boost use only history published before the event |\n| **Honest latency** | EDGAR seconds, FDA RSS days, openFDA 12 days — each source is labelled with what it can actually support |\n| **Cost sensitivity** | replay reports 10 \u002F 25 \u002F 50 bps tiers instead of a single flattering number |\n| **Multiple testing** | track claims are Holm-corrected; sample splits (dev \u002F validation \u002F holdout) are reported |\n| **Survivorship** | tickers without price coverage are flagged, not silently dropped |\n| **Reproducible calibration** | `medradar.calibration` replays recorded LLM responses by content fingerprint; drift makes the score script fail |\n| **Assumption registry** | every modelling assumption is listed with status in [docs\u002FASSUMPTIONS.md](docs\u002FASSUMPTIONS.md) |\n| **Bitemporal separation** | every TKG assertion carries `valid_time` and a knowledge time (`recorded_at`); as-of queries never return a fact whose knowledge time is later than the cutoff, and corrections never resurrect old revisions |\n| **Immutable forecasts** | the forecast registry is physically append-only (SQL triggers reject UPDATE\u002FDELETE and key-rebind INSERT-OR-REPLACE); corrections are new versions; scoring uses only forecasts\u002Fresolutions known by `as_of` |\n| **Purged evaluation** | rolling-origin training uses only examples whose 12-month label window closed at or before the origin; the old leaky-label numbers are kept as a labelled diagnostic block, not as headline results |\n| **Independent leakage replay** | the Market-to-R&D audit re-derives all 21 features from the source tables through a separate as-of SQL path and compares them with the stored values (6,701 examples \u002F 140,721 values \u002F 0 mismatches), instead of re-reading a self-declared field |\n| **Naive baselines** | every forecast comparison includes constant \u002F company \u002F track \u002F per-pair historical base-rate baselines with a paired bootstrap CI |\n| **Semantics guards** | SEC revenue stays consolidated company facts (never product sales); USAspending amounts are obligations, not revenue, and the current snapshot is excluded from historical gain claims |\n\n## Market-to-R&D \u002F Horizon forecasting\n\nThe research lane adds SEC XBRL Company Facts, USAspending awards, official openFDA bulk ingestion,\npoint-in-time company–track examples, purged rolling-origin Reverse R&D baselines and a persistent\n12-month forecast registry. It predicts **future public R&D\u002Fregulatory milestones**, not stock\nreturns and not the unobservable date internal research began.\n\n```bash\npip install -e '.[bulk]'          # only extra: ijson, for streaming the official openFDA ZIPs\npython -m medradar.intelligence.pipeline collect --source fda --months 120\npython -m medradar.intelligence.pipeline collect --source sec\npython -m medradar.intelligence.pipeline collect --source procurement --start-date 2016-01-01\npython -m medradar.intelligence.pipeline research --horizon 12\n```\n\n### Frozen real-data runs (rebuilt 2026-11-02)\n\n**v1** (`experiments\u002Freverse_rd_v1\u002F`): 55,090 in-window FDA events · 43,420 SEC facts over 32\ncompanies · 3,453 procurement awards (obligations, 0 point-in-time usable) · 6,701 examples over 25\nquarterly origins · holdout 2025-10-01 (307 rows \u002F 129 positives).\n\n**v2** (`experiments\u002Freverse_rd_v2\u002F`): purged multi-window evaluation (3 chronological holdouts\n2025-04 \u002F 2025-07 \u002F 2025-10) plus a harder **dormant→active track-entry** target — 41,003 examples\nover 24 origins, 503 positives (1.23% base rate), with an explicit left-censoring statement.\n\n| Holdout 2025-10-01 | Continuation (307 rows \u002F 129 pos) | Entry (1,716 rows \u002F 26 pos) |\n|---|---:|---:|\n| PR-AUC, R&D only | 0.7935 | 0.1139 |\n| PR-AUC, + consolidated financials | 0.7922 | 0.1163 |\n| Brier, R&D only \u002F + financials | 0.1721 \u002F 0.1721 | 0.0143 \u002F 0.0143 |\n| ECE-10, R&D only \u002F + financials | 0.0811 \u002F 0.0737 | 0.0041 \u002F 0.0046 |\n\n**Source ablation (A–G on identical purged rows, 3 windows).** Market features (8, from the local\ndaily price lane), OpenAlex publication features (5) and consolidated financials were each added on\ntop of the R&D-only baseline. **No added source produces a statistically detectable ranking gain.**\nOn continuation every marginal PR-AUC delta is negative (financial −0.0013, market −0.0015,\npublication −0.0001, all −0.0068) while the all-source model improves calibration (ECE 0.0811→0.0628)\nand FPR (0.2753→0.2472) — better calibrated, not better ranking. On entry the final holdout favours\nthe shared-only baseline over the entry-specific\u002Fnew-feature specifications, while the three-window\nmean favours the richer specs; the differences sit inside the 0.014–0.026 window std, so they are not\na stable effect. Procurement is excluded (its snapshot is not point-in-time usable) and patents were\n**not evaluated** (USPTO Open Data Portal requires an API key); hiring is deferred. The continuation\nheadline is still mostly persistence: a per-pair base-rate baseline scores AP 0.7913 vs the model's\n0.7935 (Δ +0.0022, 95% CI [−0.032, +0.037]).\n\n```bash\npip install -e '.[bulk]'          # only extra: ijson, for streaming the official openFDA ZIPs\npython -m medradar.intelligence.pipeline collect --source fda --months 120\npython -m medradar.intelligence.pipeline collect --source sec\npython -m medradar.intelligence.pipeline collect --source procurement --start-date 2016-01-01\npython -m medradar.intelligence.pipeline collect --source market --prices-db \u002Fpath\u002Fto\u002Fbase-medradar\u002Fdata\u002Fmedradar.sqlite\npython -m medradar.intelligence.pipeline collect --source publications\n# v1 aggregates\npython -m medradar.intelligence.pipeline research --horizon 12\n# v2: entry dataset + multi-window metrics, then one cell per source specification\npython experiments\u002Freverse_rd_v2\u002Frun_v2.py --db data\u002Fmedradar.sqlite --holdouts 3\npython experiments\u002Freverse_rd_v2\u002Frun_ablation.py --db data\u002Fmedradar.sqlite --target continuation --spec C --out cells\u002Fcontinuation_C.json\npython experiments\u002Freverse_rd_v2\u002Fmerge_ablation.py --cells cells --out experiments\u002Freverse_rd_v2\u002Fablation_metrics.json\n```\n\nA separate two-layer research foundation sits under this lane: a **bitemporal knowledge store**\n(`medradar\u002Ftkg`) with independent valid-time \u002F knowledge-time queries, deterministic point-in-time\nexport and a read-only `events` adapter; and an **immutable forecast registry**\n(`medradar\u002Fforecast_registry.py`) with 3\u002F6\u002F12\u002F24 calendar-month windows, append-only resolutions and\nas-of Brier \u002F log-loss \u002F ECE evaluation.\n\n## Phase 3: closed research loop\n\n- **One forecast ledger.** The canonical registry is the system of record. It gained an immutable\n  `nowcast` record kind for forecasts registered while their window is already open (the quarterly\n  Horizon case), scored in a separate cohort and never mixed into the pure-future headline.\n  `medradar\u002Fintelligence\u002Fforecasting\u002Fregistry_adapter.py` maps Horizon records through stable\n  idempotency keys and resolves matured forecasts from the real events table with coverage guards.\n- **Continuous cycle.** `scripts\u002Fforecast_cycle.py` trains the frozen model, scores the current\n  quarter, registers nowcasts, verifies matured windows and exports a deterministic artifact + cycle\n  log. Real run: 25 nowcasts registered, 25 pending (windows end 2027-10), calibration\n  `insufficient_matured_forecasts`, second run fully idempotent. A weekly GitHub workflow is\n  committed (`forecast-cycle.yml`) but was not executed here — no green run is claimed.\n- **Temporal graph.** `scripts\u002Ftkg_import_research.py` imports the 55,090-event history read-only into\n  the bitemporal store (171,800 assertions → 57,381 nodes \u002F 114,419 edges; source hash unchanged),\n  exports a deterministic PIT snapshot and proves idempotent re-import. `graph_context.py` exposes\n  read-only pair context\u002Ftimeline under independent known-time\u002Fvalid-time cutoffs.\n- **Research agent.** `medradar\u002Fresearch_agent.py` is a deterministic, evidence-grounded workflow (not\n  a chatbot): plan → 8 point-in-time tools → evidence table → 5 conflict rules → labelled hypothesis\n  → counter-evidence → baseline\u002Fstatistical validation → cited synthesis → uncertainty → research log\n  → stop condition. Every claim cites a stored id; probabilities come only from the model\u002Fregistry.\n  Real demo (`experiments\u002Freverse_rd_v2\u002Fagent_demo.json`): 5 questions, 55 claims, 224 unique cited\n  ids, 314 citation checks, 0 missing, 3 cross-source conflicts.\n\nWhat is **not** claimed: no matured forecast yet (calibration is `insufficient_data`), the TKG\nknowledge clock for the current import is the backfill time (not historical publication time), the\nagent narrates stored evidence rather than establishing causality, and patents\u002Fhiring remain absent\nevidence gaps. Details: [docs\u002FPHASE3.md](docs\u002FPHASE3.md), [docs\u002FPHASE3_REGISTRY.md](docs\u002FPHASE3_REGISTRY.md),\n[docs\u002FPHASE3_AGENT.md](docs\u002FPHASE3_AGENT.md), [docs\u002FTKG_INTEGRATION.md](docs\u002FTKG_INTEGRATION.md).\n\n```bash\npython scripts\u002Fforecast_cycle.py --db data\u002Fresearch.sqlite --registry data\u002Fregistry.sqlite \\\n  --out out\u002Fforecast_cycle --horizon 12 --top-n 25 --coverage-end 2026-10-15 --offline\npython scripts\u002Ftkg_import_research.py --db data\u002Fresearch.sqlite --tkg data\u002Ftkg.sqlite \\\n  --known-at 2026-12-31T00:00:00Z --report-out experiments\u002Freverse_rd_v2\u002Ftkg_import_report.json\npython -m medradar.research_agent ask --company medtronic --track spine \\\n  --template market_leading_indicator --as-of 2026-11-02 \\\n  --db data\u002Fresearch.sqlite --registry data\u002Fregistry.sqlite --tkg data\u002Ftkg.sqlite\n```\n\nSEC revenue stays consolidated (never relabelled product sales). USAspending obligations are not\nrevenue and its current snapshot is excluded from historical gain claims. See\n[Reverse R&D methodology](docs\u002FREVERSE_RD.md), the [integration record](docs\u002FINTEGRATION_2026-11-02.md),\n[docs\u002FTKG.md](docs\u002FTKG.md), [docs\u002FFORECAST_REGISTRY.md](docs\u002FFORECAST_REGISTRY.md),\n[docs\u002FPHASE1.md](docs\u002FPHASE1.md), [docs\u002FPHASE2.md](docs\u002FPHASE2.md), [docs\u002FPHASE3.md](docs\u002FPHASE3.md),\nand the frozen experiment configuration\u002Fresults under `experiments\u002Freverse_rd_v1\u002F` (v1) and\n`experiments\u002Freverse_rd_v2\u002F` (v2 multi-window + source ablation + Phase-3 reports).\n\n## Simulated US-equity study (not investment advice)\n\n`medradar trade` runs a **paper** portfolio on the generated signals: next-open entry, 60-day hold,\n−20% stop, ≤5% per name, ≤25% per track, 20 bps + \\$1 per fill, long only. It reports an event study\n(abnormal return vs SPY) with t-statistics and bootstrap confidence intervals rather than a\ndecorative equity curve.\n\nDeliberately **not** modelled in v1: short borrow fees, merger squeeze-outs, delisting returns.\nLong-only v1 therefore overstates what a real strategy could do. The report says so on every page.\n\n## Repository layout\n\n```\nconfig\u002F         curated knowledge: parent→subsidiary aliases, Chinese track dictionary, source notes\nmedradar\u002F       standard-library-only package\n  util.py       dates, text normalisation, Gamma–Poisson \u002F bootstrap \u002F JS-divergence\n  http.py       polite HTTP: rate limit, retries, response cache, offline replay\n  db.py         one unified `events` table + registries + prices + signals + paper tables\n  config.py     CompanyRegistry \u002F TrackRegistry fuzzy matching\n  collect_*     openFDA \u002F ClinicalTrials.gov collectors\n  nmpa.py       honest pluggable China adapter (CSV \u002F demo \u002F off)\n  analyze.py    metrics engine → out\u002Fmetrics.json (contract: docs\u002FSCHEMA.md)\n  products.py   device product families, Chinese catalog, new-product radar\n  families.py   keyword-based family builder (regenerates config\u002Fproduct_families.json)\n  replay.py     event-to-fill replay: 1m (last ~7d) or daily, 3 cost tiers, standalone HTML\n  stats.py      block bootstrap, Holm\u002FBonferroni, time splits, survivorship, power\n  calibration.py reproducible LLM-judge calibration (recorded fixtures, no key needed in CI)\n  onboarding.py demo \u002F doctor \u002F watchlist\n  report.py     Chinese report + self-contained HTML dashboard\n  prices.py     Yahoo daily bars (research use)\n  eventstudy.py abnormal-return study\n  paper.py      simulate-only portfolio with frictions\n  tkg\u002F          bitemporal store: valid-time vs knowledge-time, as-of query, deterministic PIT export\n  forecast_registry.py  append-only forecast ledger + as-of Brier\u002Flog-loss\u002FECE evaluation\n  intelligence\u002F Market-to-R&D lane: SEC XBRL, USAspending, openFDA bulk, PIT examples, Reverse R&D models\n  adcom.py      FDA Advisory Committee calendar (currently experimental: JS-rendered rows)\n  frontier.py   pre-approval frontier feed (AdCom + first-posted trials + 8-K pre-submissions)\ndocs\u002F           schema contract, methodology, GitHub Pages demo\ntests\u002F          offline tests (synthetic fixtures, no network)\n```\n\n## Extending it\n\n* **Add a company** → `config\u002Fcompanies_device.json` (parent key + subsidiary aliases). Measured\n  impact: J&J resolves from 2 to 100+ 510(k) per two years once Ethicon\u002FDePuy\u002FBiosense Webster are\n  listed.\n* **Add a track** → `config\u002Ftracks_device.json` with Chinese name + English keywords. Product-code\n  mapping is generated from openFDA classification on the next collect run.\n* **Add a data source** → write `collect_\u003Cname>(db, fetcher, months, limit)` that only touches the\n  `events` table. Analysis, report and trading need no changes.\n\n## Roadmap\n\n- [x] `v0.3.0` — consolidated research foundation (bitemporal TKG + immutable forecast registry) and\n  Market-to-R&D lane (SEC XBRL \u002F USAspending \u002F openFDA bulk, point-in-time dataset, purged\n  rolling-origin baseline, independent leakage replay, naive\u002Fpersistence baselines)\n- [x] `v0.4.0` Phase 1 — harder target: dormant→active track entry (left-censored, documented);\n  purged multi-window evaluation (`holdouts=K`) with per-window baselines and bootstrap CIs\n- [x] `v0.4.0` Phase 2 — market features from the local daily price lane (12m return, volatility,\n  drawdown, relative SPY\u002FXBI, regime) and OpenAlex publication features, all point-in-time; frozen\n  A–G source ablation (patents key-blocked, procurement excluded; both documented)\n- [x] `v0.5.0` Phase 3 — unified canonical registry with a separate nowcast cohort, Horizon adapter and\n  idempotent continuous forecast cycle; TKG imported from the real 55,090-event history with\n  deterministic PIT snapshots; deterministic evidence-grounded research agent with cited synthesis and\n  counter-evidence\n- [ ] Phase 3 remainder — execute the weekly workflow on GitHub once windows mature (needs ≥20 matured\n  forecasts before calibration claims); feed graph features into the models rather than only the agent\n- [ ] Phase 2 remainder — patent features once a USPTO ODP API key is available; versioned historical\n  track taxonomy instead of the current curated mapping\n- [ ] Causal designs (DiD \u002F synthetic control) once a defensible point-in-time demand shock exists\n- [ ] NMPA CSV importer UI + province-level gap analysis\n- [ ] FDA statistical-review PDF mining (trial-design red flags straight from FDA reviewers)\n- [ ] SHAP-style attribution for \"why did this track's THI move\"\n- [ ] Short-side event study once borrow-fee data is available\n\n## License & disclaimer\n\nMIT. Source data belongs to its publishers (openFDA is public domain; ClinicalTrials.gov and SEC\nEDGAR have their own terms). Nothing here is investment advice. This is a research and\neducation project.\n","MedRadar 是一个面向医疗技术早期信号监测的开源研究平台，基于 FDA、SEC-EDGAR、临床试验等多源公开监管数据，提供量化、时序化的技术趋势分析与产业动向洞察。其核心功能包括：多源监管事件（510(k)、PMA、临床试验、召回、药物审批、SEC文件）的自动采集与结构化；按设备技术轨道（如心脏节律、手术机器人）的热度指数计算与异常信号识别；支持回溯验证的双时间维度知识图谱（valid time + knowledge time）及不可变预测注册表；生成中英文双语、可审计的周度情报简报。适用于医疗器械企业战略规划、投融资尽调、监管政策研究及创新差距分析等场景。",2,"2026-11-24 04:38:04","CREATED_QUERY"]