Your Medical Digital Twin -- A secure platform that gives patients full ownership of their medical records through FHIR-based data aggregation, AI-powered document processing, and portable QR code exports.
Built for the Harvard Health-Tech Hackathon 2026.
MedTwin connects to hospital FHIR servers and consolidates a patient's scattered medical data into a single, patient-controlled profile. Patients can:
- View their complete medical history (conditions, medications, allergies, vitals, encounters)
- Upload medical documents (PDFs, FHIR bundles, HL7v2, C-CDA) that get automatically parsed and stored as structured FHIR resources
- Chat with an AI assistant that understands their medical context
- Export a portable PDF summary with a scannable QR code for easy sharing with new providers
med-twin-app/ React + Vite frontend
app/ FastAPI backend
api/ REST endpoints (patient, ingest, transfer, chat)
services/ Core logic (FHIR client, PDF extraction, PDF generation, QR codes)
models/ Pydantic schemas
| Component | Technology |
|---|---|
| Frontend | React 18, Vite |
| Backend | FastAPI, Uvicorn |
| Health Data | Azure FHIR R4 Server |
| AI (Document Parsing) | GPT-4o via GitHub Models |
| AI (Chat) | GPT-4o via GitHub Models |
| PDF Generation | fpdf2 |
| QR Codes | Nayuki QR Code Generator |
| Auth | API key + JWT transfer tokens |
- Python 3.12+
- Node.js 18+
- A GitHub PAT with Models (read) permission (free GPT-4o access)
- Azure FHIR server credentials
-
Clone the repo
git clone https://github.com/LouayYa/MedTwin.git cd MedTwin -
Configure environment
cp .env.example .env # Edit .env with your credentials -
Start the backend
pip install -r requirements.txt uvicorn app.main:app --reload --port 8000
-
Start the frontend
cd med-twin-app npm install npm run dev -
Open
http://localhost:5173in your browser.
Upload any medical document (PDF, FHIR JSON, HL7v2, C-CDA). PDFs are parsed by GPT-4o into structured FHIR R4 resources, which are validated and pushed to the Azure FHIR server.
Generate a portable patient summary: FHIR data is retrieved, summarized by GPT-4o into a clean PDF, and a QR code is generated for easy sharing. The PDF can be downloaded directly from the browser.
Ask questions about your medical history. The AI assistant has access to your FHIR records and provides contextual, patient-friendly answers.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/patients/lookup?emirates_id= |
Find patient by Emirates ID |
| GET | /api/v1/patients/{id}/summary |
Full medical summary |
| GET | /api/v1/patients/{id}/records |
Import history |
| GET | /api/v1/patients/{id}/export |
FHIR bundle export |
| POST | /api/v1/records/upload |
Upload medical document |
| POST | /api/v1/transfer/export |
Generate PDF + QR code |
| GET | /api/v1/transfer/pdf?token= |
Download PDF via transfer token |
| POST | /api/claude |
AI chat endpoint |
Built with care at the Harvard Health-Tech Hackathon 2026.
MIT