How kabiththananparan/meditimeline-ai works
Purpose and current entry point
MediTimeline AI is intended to ingest medical-record documents and build structured patient timelines for prescription, allergy, lab-trend, and clinical-reasoning analysis. The implemented repository is currently backend-focused; no React frontend, SQLite, ChromaDB, Groq integration, or dashboard source is present in the tree.
The FastAPI application entry point is backend/app/main.py. Upload handling begins at backend/app/api/upload.py.
API boundary and upload contract
backend/app/api/upload.py defines the HTTP-facing upload route(s), separating client file submission from document-processing logic. Request/response models are centralized in backend/app/schemas/upload_schema.py, providing the contract boundary between API consumers and internal services.
Flow: client uploads a document → API validates/normalizes through schema and route logic → service layer receives the file for processing.
Upload orchestration
backend/app/services/upload_service.py is the application service coordinating uploaded-file handling. It forms the primary control-flow boundary between transport concerns in api/ and document extraction in services/pdf_parser.py.
This layer is the natural future integration point for persistence, patient/document identifiers, asynchronous jobs, and downstream timeline/analysis stages described in the README.
PDF extraction stage
backend/app/services/pdf_parser.py is the document-ingestion/extraction component. It converts uploaded PDF content into text or parsed material usable by later structured extraction.
The implemented pipeline therefore currently reaches: Upload → file handling → PDF parsing. The README’s later stages—AI structured extraction, timeline generation, interaction checking, lab analysis, and clinical reasoning—are product-intended stages but do not have corresponding source modules in this tree.
Application runtime and cross-cutting configuration
The backend uses Python/FastAPI, with runtime dependencies declared in backend/requirements.txt. Application bootstrap is located at backend/app/main.py.
Cross-cutting settings and logging are isolated from business services:
• backend/app/core/config.py
• backend/app/core/logging.py
These modules are the expected boundaries for environment-provided settings (such as future Groq credentials, storage locations, and database URLs) and operational observability.
Data and external-service posture
Sample/source medical-record organization exists under data/DataSet YGC26/, grouped by patient and year, for example:
• data/DataSet YGC26/Patient x/Year 1
• data/DataSet YGC26/Patient y/Year 3
The README names Groq, SQLite, and ChromaDB as planned platform dependencies, but the visible code tree contains no adapters, migrations, vector-store clients, or LLM client modules. Treat them as intended infrastructure rather than implemented runtime dependencies.
Key architectural gap
The repository has a clean initial layering—API → schema/service → parser—with configuration and logging outside the request pipeline. To realize the stated product architecture, add explicit bounded components after parsing: normalized medical-record extraction, durable patient/document storage, timeline assembly, medication/allergy/lab analysis, and a reasoning/query API. Keep these behind service interfaces rather than embedding clinical or AI logic in backend/app/api/upload.py.
Main entry points: main.py FastAPI bootstrap · upload.py Upload routes · pdf_parser.py PDF parser · config.py Settings
Components 15
Backend Runtime
- FastAPI bootstrap
backend/app/main.py - Settings · Environment boundary for credentials, storage, and database settings.
backend/app/core/config.py - Logging
backend/app/core/logging.py - Python dependencies
backend/requirements.txt
Implemented Ingestion
- Upload routes
backend/app/api/upload.py - Upload contract · Defines the API boundary for upload payloads and responses.
backend/app/schemas/upload_schema.py - Upload orchestration · Coordinates file handling between transport and extraction.
backend/app/services/upload_service.py - PDF parser · Converts uploaded PDF content into usable parsed text or material.
backend/app/services/pdf_parser.py
Planned Clinical Pipeline
Product-intended stages not yet implemented.
- Normalized record extraction · Transforms parsed material into structured medical records.
- Timeline assembly · Builds chronological patient timelines from structured records.
- Medication, allergy & lab analysis · Supports interaction checks and lab-trend analysis.
- Reasoning/query API · Exposes clinical reasoning and timeline queries.
Data Sources & Storage
- Medical-record dataset · Patient and year-organized medical-record files.
- Patient/document storage · Persists patient identities, source documents, and normalized records.
Other components
- API client
Connections 16
- API client → FastAPI bootstrap: HTTP requests
- FastAPI bootstrap → Upload routes: registers
- Python dependencies → FastAPI bootstrap: runtime dependencies
- Settings → FastAPI bootstrap: settings
- Logging → FastAPI bootstrap: observability
- Upload routes → Upload contract: validates contract
- Upload routes → Upload orchestration: submits file
- Upload orchestration → PDF parser: extracts PDF content
- Medical-record dataset → PDF parser: representative PDFs
- PDF parser → Normalized record extraction: parsed material
- Normalized record extraction → Patient/document storage: persist records
- Patient/document storage → Timeline assembly: patient records
- Timeline assembly → Medication, allergy & lab analysis: timeline context
- Medication, allergy & lab analysis → Reasoning/query API: findings
- Reasoning/query API → API client: queries and results
- Settings → Patient/document storage: future storage settings