Skip to content
LouayYaPublic

About

Patient-controlled medical records platform with FHIR R4 integration, GPT-4o document parsing, and QR-based portable health summaries — built at Harvard Health-Tech Hackathon 2026.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MedTwin

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.

What It Does

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

Architecture

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

Getting Started

Prerequisites

  • Python 3.12+
  • Node.js 18+
  • A GitHub PAT with Models (read) permission (free GPT-4o access)
  • Azure FHIR server credentials

Setup

  1. Clone the repo

    git clone https://github.com/LouayYa/MedTwin.git
    cd MedTwin
  2. Configure environment

    cp .env.example .env
    # Edit .env with your credentials
  3. Start the backend

    pip install -r requirements.txt
    uvicorn app.main:app --reload --port 8000
  4. Start the frontend

    cd med-twin-app
    npm install
    npm run dev
  5. Open http://localhost:5173 in your browser.

How It Works

Document Ingestion

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.

QR Code Export

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.

AI Chat

Ask questions about your medical history. The AI assistant has access to your FHIR records and provides contextual, patient-friendly answers.

API Endpoints

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

Team

Built with care at the Harvard Health-Tech Hackathon 2026.

License

MIT

About

Patient-controlled medical records platform with FHIR R4 integration, GPT-4o document parsing, and QR-based portable health summaries — built at Harvard Health-Tech Hackathon 2026.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages