An AI-powered clinical intake and documentation assistant built with FastAPI and OpenAI.
Patients complete a structured web form before their consultation. The backend pipeline processes the input through an LLM and returns three outputs for the clinician:
- Intake Summary — a concise 2-3 sentence overview of why the patient is presenting
- Structured Patient Information — key fields extracted and organised in a clean format
- Draft SOAP Clinical Note — a pre-filled Subjective section with editable fields for Objective, Assessment, and Plan
⚠️ This is a simulated demo using fake patient data. It is not intended for use in real clinical settings.
- Backend — Python, FastAPI
- Templating — Jinja2
- AI — OpenAI API (
gpt-4o-mini) - Frontend — Plain HTML + CSS (single page)
clinicflow-ai/
├── main.py # FastAPI app + POST /generate-note endpoint
├── templates/
│ └── index.html # Intake form and result display
├── .env.example # Environment variable template
├── requirements.txt
└── README.md
git clone https://github.com/your-username/clinicflow-ai.git
cd clinicflow-aipython -m venv venv
# Mac/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate.batpip install -r requirements.txtcp .env.example .envOpen .env and add your OpenAI API key:
OPENAI_API_KEY=sk-your-key-here
uvicorn main:app --reloadOpen your browser at http://127.0.0.1:8000
- Patient fills in the intake form (name, age, symptoms, history, medications, allergies)
- Form is submitted to
POST /generate-note - Backend constructs a prompt and calls the OpenAI API
- LLM returns a structured JSON response
- The page displays the intake summary, structured info, and a draft SOAP note
- Clinician can fill in the Objective, Assessment, and Plan fields directly on the page
Patient Form Input
↓
Input Validation
↓
Prompt Construction
↓
OpenAI API Call (gpt-4o-mini)
↓
JSON Response Parsing
↓
┌─────────────────────────────┐
│ intake_summary │
│ structured_info │
│ draft_clinical_note (SOAP) │
└─────────────────────────────┘
Given a patient presenting with a persistent headache, the system generates:
Intake Summary
A 45-year-old patient presents with a persistent throbbing headache lasting 3 days, accompanied by nausea and light sensitivity. The patient has a history of hypertension and is currently taking Lisinopril 10mg. An allergy to Penicillin has been noted.
Structured Info
Name, age, presenting complaint, symptoms list, relevant history, medications, allergies — all extracted and formatted.
Draft SOAP Note
Subjective pre-filled from patient data. Objective, Assessment, and Plan left as editable fields for the clinician to complete after consultation.
- Missing or invalid form input returns inline validation messages
- OpenAI API failures return a user-facing error message
- Malformed LLM responses are caught and surfaced gracefully
- No database — results are not saved between sessions
- No authentication or user accounts
- Intended for demonstration purposes only