cd /news/artificial-intelligence/building-trialbridge-an-ai-clinical-… · home › topics › artificial-intelligence › article
[ARTICLE · art-147478] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Building TrialBridge: An AI clinical trial matcher built in a single hack day

Team Latent built TrialBridge, an AI-powered clinical trial screening aid, in a single hack day at Hacktoberfest Hack Day Coimbatore. The Next.js app uses Google's open-weight gemma-4-26b-a4b-it model via the Gemini API to extract structured patient profiles from uploaded medical reports and judge them against atomic inclusion and exclusion rules pulled from the ClinicalTrials.gov v2 API, while unit-tested code makes the final match decision. Switching Gemma to minimal thinking mode with medical hints cut a 4-trial batch from about 3 minutes to 42 seconds.

by read3 min views2 publishedOct 8, 2026

We, Team Latent, built TrialBridge during the Hacktoberfest Hack Day Coimbatore x (INIT Club & IDEA Club). We wanted to tackle a problem that actually matters: cancer treatments often push Indian families into debt, while slots for free, cutting-edge clinical trials go unfilled. The barrier is the data—eligibility rules are dense pages of medical jargon that patients can't understand and busy oncologists rarely have time to read.

Here is how our team built an AI-powered screening aid to bridge that gap.

How it works**

Our stack is Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS 4, and zod.

Intake: Users upload photos of their medical reports, scans, and current prescriptions. To stay within Vercel's hosting request-size limits, we shrink the photos directly in the browser before they hit the backend.

Registry Data: We pull active, recruiting trials with open (or opening soon) Indian sites directly from the ClinicalTrials.gov v2 API.

The Logic: We built a custom text splitter (lib/criteria.ts) to break down the massive blocks of registry text into atomic inclusion and exclusion rules.

The Output: The app generates a printable summary for the oncologist, complete with a ✓ / ✗ / ? checklist for every rule. It even checks trial rules against the patient's current medicines (accounting for end dates and washout periods) to generate specific questions for the doctor.

Safety First: The app never claims true medical eligibility—it only says "may qualify, confirm with your oncologist".

We submitted this for the Best Use of Gemma challenge. We used Google's open-weight gemma-4-26b-a4b-it model via the Gemini API to do the heavy lifting.

First, Gemma performs multimodal extraction, reading the uploaded images to build a structured patient profile (cancer type, stage, biomarkers, ECOG, labs, current medicines) alongside the exact quotes it used as evidence. The user manually checks this profile before any matching happens.

Then, Gemma judges the patient against each eligibility rule separately. A crucial architectural decision we made was keeping the AI strictly as a rule-judge, while plain, unit-tested code decides the final trial outcome (likely match, possible match, or not eligible).

Building this in a day meant hitting a lot of walls. Here is what we learned:

Latency: Our first parallel runs took about 3 minutes per trial. We fixed this by switching Gemma to minimal thinking mode and writing medical hints directly into the prompt (e.g., "stage IV means metastatic"). This dropped a 4-trial batch down to 42 seconds with no thinking tokens used.

Double Negatives: Asking the AI "does the patient pass this exclusion rule?" was ambiguous and caused errors. We changed the prompt to simply ask "does this exclusion apply?" and flipped the boolean in our code.

Free-Tier Rate Limits: On our first live run, Gemma's free tier got busy and threw 429 errors. We handled this by building automatic retries with a UI countdown. We also added a "quick first look" prompt to filter out obvious mismatches early, which narrowed 20 trials down to 4 full checks.

Drug Washout Windows: The model initially treated completed drug courses as current. Injecting today's exact date into the prompt fixed it, allowing Gemma to correctly calculate washout periods.

Messy Registry Text: Real registry criteria are full of escaped characters, mixed headings, and nested sub-rules. We had to refine our text splitter against a sanity run of 33 trials and 579 rules to finally get clean data.

Huge thanks to the team for surviving the sprint!

(Built for Hacktoberfest Hack Day Coimbatore x (INIT Club & IDEA Club) 2026)

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @team latent 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/building-trialbridge…] indexed:0 read:3min 2026-10-08 · —