All work
2026/ Healthcare · AI/ Harvard HSIL Hackathon

ByteMed

A clinical triage pipeline for overloaded emergency intake. Cases arrive as free-text complaints, vitals, and photographs; a FastAPI service scores them against triage criteria and reorders the queue so the person most likely to deteriorate is seen first, not the person who arrived first.

Interactive demo

Six waiting patients · arrival order vs. triage order

bytemed · POST /triage/batch

Queue in arrival order · not yet scored.

At a glance

My role
Backend + scoring fusion
Stack
FastAPI · Gemini · Python
Built at
Harvard HSIL Hackathon
Hard rule
Can promote, never demote

How scoring works

Two signals, one clamp

Intake vitals · text · photo Vitals rules deterministic thresholds Gemini vision observable findings only Combine clamped to arrival Queue re-ordered + reasons model raises a score, it can never lower one
The rules decide; the model only contributes evidence that can move a patient up.

Code

The safety property, and the test that pins it

scoring/combine.py fusion with a one-way clamp

def combine(vitals_score, vision_findings, arrival_rank):
    score = vitals_score

    # vision can only ever ADD urgency, never subtract it
    for finding in vision_findings:
        score += URGENCY_WEIGHTS.get(finding.label, 0) * finding.confidence

    score = min(score, 100)

    # and the result can never place a patient later than they arrived
    return TriageResult(
        score=score,
        rank_ceiling=arrival_rank,
        reasons=explain(vitals_score, vision_findings),
    )
tests/test_no_demotion.py makes the guarantee impossible to regress

def test_vision_never_demotes(random_cases):
    for case in random_cases:
        baseline = combine(case.vitals, [], case.arrival)
        withimg  = combine(case.vitals, case.findings, case.arrival)

        assert withimg.score >= baseline.score
        assert withimg.final_position <= case.arrival

A triage tool that can push someone down the queue is worse than no tool.

Inside the repo

Structure

  • api/FastAPI service
  • main.pyapp + route registration
  • routes_triage.py/triage, /triage/batch
  • schemas.pypydantic request/response models
  • deps.pyauth + rate limiting
  • scoring/the triage logic
  • vitals_rules.pythreshold scoring on vitals
  • vision.pyGemini vision calls
  • combine.pyfuses both, never demotes
  • explain.pywhy a case scored what it did
  • tests/safety-critical paths
  • test_no_demotion.pyasserts the ordering guarantee
  • test_vitals_rules.pythreshold boundary cases
  • requirements.txtfastapi, uvicorn, pydantic
  • README.mdrun locally + sample payloads

Skills, in context

Where each one actually showed up

FastAPI Service layer; pydantic rejects malformed vitals at the boundary instead of scoring on a missing field.
Gemini Vision on intake photos: asked what it can see, never for a diagnosis.
Python The clamp in combine.py and the test that pins it, both above.
Next project WhatsApp Fire-Reporting