Skip to content

About

TOA Healthcare Hack

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Hospital Node Boilerplate

A lightweight FastAPI application that simulates a single, siloed hospital database node for The Open Accelerator Healthcare Hackathon — Track 1: Federated Medical Imaging Search.

First time? Start with the Pre-Hackathon Setup Guide to get Python, Git, and everything else installed before the event.

What This Is

This boilerplate represents an intentionally "dumb" hospital edge node. Each instance:

  • Blindly serves its own local study data
  • Has zero awareness of other hospitals
  • Lacks any authentication
  • Intentionally leaks PII (patient names, birthdates)

You will run three separate instances on different ports to simulate a disconnected, multi-hospital network. Your challenge is to build the overarching aggregation, privacy, and access-control layer on top.

┌──────────────┐   ┌──────────────┐   ┌──────────────┐
│  BCH  :8001  │   │  MGH  :8002  │   │  BWH  :8003  │
│  900 studies │   │  900 studies │   │  900 studies │
│  No auth     │   │  No auth     │   │  No auth     │
│  PII exposed │   │  PII exposed │   │  PII exposed │
└──────────────┘   └──────────────┘   └──────────────┘
       ↑                  ↑                  ↑
       └──────────────────┼──────────────────┘
                          │
                    YOUR SOLUTION
              (aggregator, auth, redaction)

Quick Start

1. Install dependencies

cd hospital-node-boilerplate
pip install -r requirements.txt

2. Start the three hospital nodes

Open three separate terminal windows:

# Terminal 1 — Boston Children's Hospital
HOSPITAL_NODE=BCH uvicorn main:app --port 8001 --reload

# Terminal 2 — Massachusetts General Hospital
HOSPITAL_NODE=MGH uvicorn main:app --port 8002 --reload

# Terminal 3 — Brigham and Women's Hospital
HOSPITAL_NODE=BWH uvicorn main:app --port 8003 --reload

3. Verify they're running

curl http://localhost:8001/health
# {"status":"healthy","node":"BCH"}

curl http://localhost:8002/health
# {"status":"healthy","node":"MGH"}

curl http://localhost:8003/health
# {"status":"healthy","node":"BWH"}

API Reference

Each node exposes three endpoints. All responses are JSON.

Method Endpoint Description
GET /health Health check — returns node name and status
GET /api/studies Returns all study records on this node
GET /api/studies/{study_id} Returns a single study by StudyID, or 404

Examples:

# Get all studies from BCH
curl http://localhost:8001/api/studies

# Get a specific study by ID
curl http://localhost:8001/api/studies/BR-7721

Note: There is no search endpoint — that's intentional. Building search, filtering, and cross-node querying is part of your challenge.

Interactive API Docs

FastAPI auto-generates interactive Swagger UI docs for each running node:

Data Schema

Each study record contains these fields (all strings):

Field Format Example
PatientName LastName^FirstName Harrington^Lucas
PatientID PREFIX-NNNNN CHB-99214
PatientBirthDate YYYYMMDD 20181104
PatientAge NNNY / NNNM / NNND 007Y
PatientSex M / F M
InstitutionName Full hospital name Boston Children's Hospital
StudyID PREFIX-NNNN BR-7721
StudyInstanceUID DICOM UID format 1.3.12.2.1107.5.2.19.45152...
StudyDate YYYYMMDD 20260715
Modality DICOM modality code MR
BodyPartExamined BRAIN / HEART / FETAL BRAIN
Diagnosis Full radiology report Multi-paragraph clinical text

Data Overview

Each hospital has 900 pre-generated study records (300 brain, 300 heart, 300 fetal):

  • BCH (Boston Children's Hospital) — Pediatric patients, ages 0–21
  • MGH (Massachusetts General Hospital) — Adult patients, ages 22–85
  • BWH (Brigham and Women's Hospital) — Adult patients, ages 18–75

Conditions overlap across hospitals, so a federated search for something like "hydrocephalus" will return results from multiple nodes.

Architecture

hospital-node-boilerplate/
├── main.py              # FastAPI app — reads HOSPITAL_NODE env var to pick data file
├── models.py            # Pydantic StudyRecord schema
├── requirements.txt     # Runtime dependencies (fastapi, uvicorn, pydantic)
├── data/
│   ├── bch_data.json    # 900 records — Boston Children's Hospital
│   ├── mgh_data.json    # 900 records — Massachusetts General Hospital
│   └── bwh_data.json    # 900 records — Brigham and Women's Hospital
└── scripts/
    ├── generate_data.py # Gemini-powered data generator
    └── requirements.txt # Generation-only dependencies

The HOSPITAL_NODE environment variable controls which JSON file gets loaded into memory at startup. The app is completely stateless — no database, no external services.

Tech Stack

  • Python 3.10+
  • FastAPI
  • Uvicorn
  • Pydantic

About

TOA Healthcare Hack

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages