Inspiration

Some of us have family members who've lived through serious brain disease, and one of us is training to be a doctor. We wanted to take on something ambitious: better outcomes for people with brain cancer.

For many brain tumor patients, a clinical trial is the best option left. But getting into one is a mountain of admin work. Glioblastoma, one of the deadliest brain tumors, strikes about 14,000 Americans a year. There are 198 open glioblastoma trials in the US, each with around 24 eligibility rules. That's roughly 5,000 checks per patient, done by hand, while the team also plans the right tests and races enrollment deadlines. So most patients only hear about the few trials their team already knows, and only about 1 in 10 glioblastoma patients ever enrolls in one.

What it does

Cortexa is an agentic care-management platform for the oncology team. We took the clinical flowchart doctors already follow, from MRI to biopsy to treatment, and turned it into a workflow where agents do the legwork and a doctor approves every step.

  • MRI intake: a ResNet classifier we trained sorts the scan into glioma, meningioma, pituitary tumor or no tumor, with a calibrated confidence and a Grad-CAM heatmap showing where it looked. Google's MedGemma then writes a plain-language medical explanation of that assessment for the care team. The output is always a suspected type, never a diagnosis, and the doctor confirms or corrects it.
  • Biopsy planning: before surgery, the agent lists which lab results will decide the most trials (IDH, 1p/19q, MGMT, grade). It also flags trials that need enrollment before the operation, so no deadline slips by.
  • The "dirty-bomb detector": for recurrent tumors, we borrowed the math radiation portals use to find hidden nuclear material. Normal aging mutations are the background, and chemo damage is the hidden source. For our demo patient, Gary, it finds that about 61% of his 600 mutations came from his earlier chemo. Those mutations don't predict an immunotherapy response, so his doctor knows the high count isn't a reason to try it. The check adds context; it never decides eligibility.
  • Trial matching that cuts the noise: Cortexa pulls trials from ClinicalTrials.gov and the NCI trials API and splits each into individual rules. It checks them with deterministic code, not an LLM: every rule is met, not met or unknown, and cites the patient field and trial text it used. Missing data stays "unknown" with a reason; it's never guessed.
  • Shortlist review: the doctor gets a short, cited list of trials the patient can actually join, sorted nearest first, with recruiting status and drive time. Only the ZIP code ever goes to the map service.
  • Kanban board: every patient is a card showing who it's waiting on (the doctor, the lab or the agent), so a care team can see its bottlenecks at a glance.
  • Rules as config: clinic staff edit trial-status filters and thresholds in a YAML file, and Cortexa's behavior changes with no code change. Every agent action and doctor approval is written to an audit log.

How we built it

  • Workflow engine: a Python / FastAPI backend that runs the clinical decision tree as a state machine. Doctor approval gates are enforced in code, not in a prompt.
  • Vision: a fine-tuned PyTorch ResNet on a public 7,023-image brain MRI dataset. We removed exact and near-duplicate scans with perceptual hashing before splitting, calibrated confidence with temperature scaling, and generated Grad-CAM heatmaps. Google's MedGemma, via Hugging Face, turns the classifier's assessment into a coherent medical explanation the doctor can read alongside the heatmap.
  • Trials: ClinicalTrials.gov API v2 and the NCI Clinical Trials Search API, merged by trial ID, with responses cached for a reliable demo.
  • Eligibility: a deterministic rule engine with 31 rule types. It reads diagnosis, IDH status, grade, prior treatments, recurrence count and more, and returns met / not met / unknown with evidence.
  • Mutation check: a Poisson likelihood test against COSMIC mutational signatures (NumPy / SciPy), tuned to a 1% false-alarm rate. Thousands of simulations show how many mutations a call needs before it can be trusted. Our nuclear engineer adapted the method from gamma-ray spectroscopy.
  • Frontend: React + Vite with a Leaflet / OpenStreetMap trial map, deployed on Vercel.
  • Test patients: 23 synthetic patients covering every branch of the decision tree, with hand-labeled eligibility calls from our premed teammate to measure the agent against.

Challenges we ran into

  • The dataset leaks. The public MRI dataset repeats the same scans across train and test. One no-tumor slice appears 35 times. Hashing alone wrongly merged different patients, because dark scans look alike to a hash, so we added an image-correlation check and inspected the borderline pairs by eye.
  • Fragile first model. Our first model called 86 of 264 noisy copies of real tumors "no tumor". Retraining with blurred, noisy and motion-blurred copies fixed it: 98.5% on noisy test copies.
  • Confident mistakes. 19 of the classifier's 32 test errors were made with 95% or higher confidence. That's exactly why the doctor confirms every case, and why our "uncertain" flag is a warning, not a safety net.
  • Free-text eligibility criteria. Trial rules are written in plain English. Turning them into checks that never guess meant accepting "unknown: doctor review" when no rule fits, instead of letting an LLM improvise.
  • Not drowning the doctor. 200 "maybes" just moves the paperwork onto the doctor. One failed rule removes a trial, and near misses are labeled with the test that would unlock them.

Accomplishments that we're proud of

  • 97.0% classifier accuracy on 1,051 test MRIs with duplicates removed first, so no test scan was ever trained on. We report the weak spots too: meningioma is lowest at 91.5%.
  • Explainable at two levels: a heatmap shows where the model looked, and MedGemma explains what it found in medical language. The doctor gets reasoning to check, not just a label.
  • A detector borrowed from nuclear security, applied to tumor DNA and validated with simulations: below about 50 mutations it honestly answers "inconclusive" instead of guessing.
  • An agent that knows what it doesn't know. Every eligibility call cites its evidence, and missing data is never filled in.
  • Doctor gates enforced in code, a full audit trail, and clinic rules editable in plain YAML.
  • Four people with backgrounds in computer engineering, premed and nuclear engineering built it end to end in a day.

What we learned

  • In healthcare AI, the hard part isn't getting an answer. It's being honest about the confidence behind it, and building the workflow so a human can catch the mistakes.
  • Benchmark numbers can lie. Deduplicating the dataset was the difference between an inflated score and an honest one.
  • Ideas travel. The statistics used to find dirty bombs in shipping containers carry over almost directly to finding chemo damage in tumor DNA.
  • Deterministic code plus "unknown" beats an LLM that sounds confident.

What's next for Cortexa

  • Test MedGemma on its own across the full test set, to see whether it can serve as an independent second opinion rather than only explaining the classifier's call.
  • Point the mutation detector at blood. This chemo carries a known risk of later blood cancers, and the same method could flag it early.
  • Expand the rule library to cover more of the free-text criteria, and add more tumor types beyond glioblastoma.
  • Trial alerts, so the team hears when a new trial opens that the patient qualifies for.
  • Connect to hospital records through FHIR, and pilot with real oncology teams to measure what matters: more patients offered a trial, sooner.

Built With

Share this project:

Updates

Submission history