Skip to content

Repository files navigation

TracHeal — AI Patient Care Continuity Agent

Catching patients before they fall through the cracks between hospital discharge and follow-up care.

Team Cache Hit Dubai · HSIL Hackathon 2026 · Challenge #7: Fragmented Care Pathways

Live Demo tests Status License: MIT

TracHeal Demo


The problem

Every year, millions of patients are discharged from hospital with complex follow-up plans (referrals, appointments, medication changes) that never get executed. Thirty days later, they are back in the ER.

  • 22.8% of patients miss their first follow-up appointment (Ambade et al., BMJ Open 2025)
  • $21 billion annual cost of preventable readmissions in the US (Vizient 2025 / CMS HRRP)
  • 27% of hospital readmissions are entirely preventable (van Walraven et al., CMAJ 2011)

Discharge is not the finish line. It is where fragmented health systems lose track of patients.

What TracHeal does

TracHeal ingests unstructured discharge notes, identifies patients at risk of falling through the cracks, and surfaces actionable interventions for care coordinators, with source attribution and clinician-in-the-loop review.

  1. Ingestion — unstructured clinical text via paste or PDF upload (FHIR planned, not built)
  2. AI risk profiling — hidden barriers: medication complexity, missed referrals, jargon, social determinants
  3. Coordinator view — prioritised interventions and alerts (the timeline panel in the demo is a static design mock-up, labelled as such)

Live demo

trachealhackathon.vercel.app/demo

Paste a discharge summary and you get a risk score and level, barriers by category, prioritised interventions with rationale, retrieval source attribution with relevance scores, and patient-facing insight tags. A mode chip shows whether you are seeing live AI or the deterministic demo fallback; without configured API keys the app runs fully in demo mode and says so.

Input + RAG retrieval Risk assessment output
Input Output
Barriers + interventions Source attribution
Barriers RAG

Architecture

Clinical notes (text or PDF via PyPDF2)
          │
          ▼
┌─────────────────────┐
│   RAG retrieval      │  TF-IDF cosine similarity over the demo record corpus
└─────────┬───────────┘
          ▼
┌─────────────────────┐
│   LLM inference      │  Gemini → DeepSeek → deterministic mock, in that order
└─────────┬───────────┘
          ▼
┌─────────────────────┐
│  Structured output   │  risk_score, barriers, interventions, sources, audit
└─────────────────────┘
          │
          ▼
   Clinician review     Human-in-the-loop, non-negotiable

Design decisions and their trade-offs (including why retrieval is TF-IDF rather than embeddings: Vercel's 50 MB serverless bundle limit) are documented in docs/ARCHITECTURE.md.

Stack: static HTML/CSS/JS frontend on Vercel CDN; Python Flask as a Vercel serverless function; Gemini primary with DeepSeek and deterministic-mock fallbacks; pure-Python TF-IDF retrieval; PyPDF2.

Synthetic data statement

Every patient in this repository is fictional. The RAG corpus ("Ahmed Al-Rashidi", MRN SYNTH-00421) and the demo dashboard are fabricated records written for the hackathon, marked [SYNTHETIC RECORD] in the source. No real patient data was used at any point.

Running locally

git clone https://github.com/riyashet-hds/trachealhackathon.git
cd trachealhackathon
pip install -r requirements.txt pytest

# Optional: without keys the app serves the deterministic mock and labels it
export GEMINI_API_KEY="your_key_here"
export DEEPSEEK_API_KEY="your_key_here"

python api/index.py            # backend on :5000
python -m http.server 8000     # static pages

Open http://localhost:8000/demo.html. Run the test suite with:

pytest

API

POST /api/generate — accepts application/json with {"note": "discharge text..."} or multipart/form-data with a PDF file.

{
  "success": true,
  "source": "gemini|deepseek|mock",
  "summary": "...",
  "risk_score": 78,
  "risk_level": "high",
  "risk_factors": [], "barriers": [], "interventions": [],
  "symptom_checks": [], "escalation_triggers": [], "risk_drivers": [],
  "rag_sources": [{ "source": "...", "score": 0.41, "excerpt": "..." }],
  "audit": { "documents_scanned": 3, "chunks_used": 3, "retrieval_method": "TF-IDF Cosine Similarity" }
}

Errors: 400 for missing/too-short input or non-PDF uploads, 413 for input over 50k characters.

GET /api/health — returns {"status": "ok"}.

What this is, honestly

A 48-hour hackathon MVP: functional, deployed, and tested at smoke level, not production-grade.

Works today: live deployment with AI inference; end-to-end text/PDF → risk analysis → source-attributed output; graceful three-layer fallback; smoke-test suite in CI; clinician-in-the-loop by design (outputs are decision support, never decisions).

Not built (roadmap): FHIR/NABIDH integration; authentication and role-based access; UAE Federal Law No. 2 of 2019 compliance audit; embedding-based retrieval; Arabic UI. The pilot plan, business model, and stakeholder map describe the intended path, and they are proposals, not commitments.

Team — Cache Hit Dubai

Built at the HSIL Dubai hub, April 10–11, 2026, by merging four prototypes into one deployable service:

  • Riya Shet — output schema and risk framework; integration of the four prototypes into the unified api/index.py; Vercel deployment; pilot plan, business model, and stakeholder map; this repository.
  • Om — the TF-IDF RAG prototype (originally FastAPI + NumPy; rewritten in pure Python during integration to fit the serverless bundle limit).
  • Wenhui Yang — the PDF-upload pipeline (PyPDF2).
  • Xu Liu — the risk-driver analysis (risk_drivers output: jargon, cost, complexity, psychological barriers).

Ethics and safeguards

Clinician-in-the-loop review before any action; source-attributed outputs; no data egress beyond the institutional boundary by design; bias auditing planned per model version; designed to operate within UAE Federal Law No. 2 of 2019 and DHA data governance.

References

  1. Ambade, P. et al. (2025) 'Hospital discharge communication problems in 10 high-income nations', BMJ Open, 15, e094724. doi: 10.1136/bmjopen-2024-094724
  2. van Walraven, C. et al. (2011) 'Proportion of hospital readmissions deemed avoidable: a systematic review', CMAJ, 183(7), E391–E402. doi: 10.1503/cmaj.101860
  3. Laurent, A. (2025) 'Hospital readmission rates by state: US data & analysis', IntuitionLabs.

License

MIT © 2026 team Cache Hit Dubai.

Releases

Packages

Contributors

Languages