Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🧬🩻 RadioGenomics Bridge

Pick a cancer and a gene → instantly get the matched cohort of patients who have a scan, a mutation profile, and a known outcome — plus the survival evidence.

Cancer patients get imaged and genetically profiled separately, and the two live in different databases that nobody connected. Assembling the matched dataset that "virtual biopsy" research depends on takes a skilled researcher 1–2 weeks of ID-reconciliation per cohort. This app turns that into a dropdown.

Built on Craft (Nebius Emergence AI), which gives unified query access to two live Snowflake databases:

Database Table Gives Join key
IDC – Imaging Data Commons IDC.IDC_V17.DICOM_ALL who has a scan + download link PatientID
PanCancer Atlas (TCGA) MC3_MAF_V5_ONE_PER_TUMOR_SAMPLE which gene is mutated ParticipantBarcode
PanCancer Atlas (TCGA) CLINICAL_PANCAN_..._FILTERED survival outcome bcr_patient_barcode

All three describe the same patient via the identical TCGA-xx-xxxx barcode. That barcode is the bridge.


The flagship result (real data)

Select Glioma → IDH1:

Median survival 5-year survival n
IDH1 Mutant 94.4 months 68% 415
IDH1 Wild-type 15.1 months 8% 474

The curves split dramatically — a true, textbook radiogenomics signal reproduced live from TCGA.


Three tools in one

1. Survival Explorer — pick a cancer + gene, see the matched cohort, the KM survival split, and real scan thumbnails of patients in both databases.

2. Cohort Builder(the "save weeks of work" tool) — the workhorse for a researcher:

  • Filter 150 real glioma patients by subtype, mutation status (per gene), grade, sex, age, and imaging availability.
  • Every filter change recomputes a real Kaplan-Meier curve + log-rank p-value live from the per-patient records (e.g. IDH1: mutant median not reached vs wildtype 13.6 mo, p = 4×10⁻¹⁸).
  • Download the filtered cohort as CSV — the analysis-ready dataset a lab would otherwise spend 1–2 weeks assembling by hand.

The per-patient dataset is the real cross-database join: genomics + clinical from PanCancer, imaging membership from IDC, matched on TCGA barcode — all pulled through Craft.

3. Ask (AI Agent) ⭐⭐ (natural language → Craft) — a researcher types a question in plain English and the agent orchestrates the full Craft toolchain, showing every step:

"In glioma, does IDH1 mutation improve survival more in patients under 50?"
   → Craft resolve_term        (semantic layer)
   → Craft generate_sql        (English → governed SQL)
   → Craft execute_query       (live Snowflake)
   → Craft generate_plotly_chart (auto-visualize)
   → Answer + chart + the exact SQL it ran

Every one of the shipped questions was executed live through Craft — the SQL, the result rows, and the Plotly charts are all real Craft output. This uses Craft end-to-end: resolve_term, generate_sql, execute_query, get_result_page, and generate_plotly_chart.

Run it (2 terminals)

# 1) Backend  (http://localhost:5174)
cd backend
npm install
npm start

# 2) Frontend (http://localhost:5173)
cd frontend
npm install
npm run dev

Open http://localhost:5173.


Architecture

frontend (React + Vite)  ──/api──▶  backend (Express)  ──▶  CraftService
   dropdowns + KM chart                REST endpoints          │
                                                               ├─ cached mode (default): real
                                                               │   Craft results in data/cohorts.json
                                                               └─ live mode: runs CRAFT_QUERIES
                                                                   through Craft execute_query

Data modes

  • cached (default) — the app serves data pulled from Craft ahead of time (backend/data/cohorts.json). 100% real numbers, no runtime credentials. This is what the demo uses.
  • live (CRAFT_MODE=live) — the exact SQL lives in backend/craftService.js (CRAFT_QUERIES). Craft authenticates per-session via OAuth inside the MCP host, so a standalone server can't hold that session; wire a Craft/Snowflake client into runCraftQuery() to go live. The join logic, cohort assembly and Kaplan-Meier math already live in the service — that's the product.

What the app does / doesn't do

  • ✅ Assembles the matched imaging + genetics + outcome cohort instantly.
  • ✅ Shows Kaplan-Meier survival by mutation status (computed server-side in Snowflake).
  • ✅ Proves the cross-database link with real patients present in both databases + image links.
  • ❌ Does not predict genetics from image pixels (that's the phase-2 model this data layer enables).
  • ❌ Not a clinical device — historical TCGA research data, for research/education only.

Endpoints

  • GET /api/cancers → available cancer types
  • GET /api/genes?cancer=glioma → genes for that cancer
  • GET /api/cohort?cancer=glioma&gene=IDH1 → full cohort payload (stats, KM curves, imaging, matched patients, provenance)

PanCancer

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages