ChartLens
AI-powered clinical chart review tool that extracts structured patient data from unstructured clinical notes.
Overview
ChartLens is a full-stack clinical chart review tool that uses LLM-powered extraction to transform unstructured clinical notes into structured, queryable patient data — with built-in PHI protection.
Architecture
FastAPI backend handles extraction via Google's langextract library with few-shot examples. Notes are optionally de-identified using Microsoft Presidio before being sent to cloud LLM providers (Gemini, OpenAI). Extracted entities are re-identified and char intervals remapped to original text coordinates. Next.js frontend provides tabbed views for browsing structured data with source highlighting.
Extraction Pipeline
Clinical notes are parsed into 10 extraction classes: diagnosis, medication, lab_result, vital_sign, imaging, procedure, assessment, event, allergy, and social_history. Each extraction includes the source text, character interval for highlighting, and structured attributes (e.g., dose, route, frequency for medications). A summary builder groups extractions into clinical categories with timeline sorting.
PHI De-identification
For cloud providers, notes pass through a Presidio-based de-identification layer that detects PERSON, DATE_TIME, US_SSN, PHONE_NUMBER, EMAIL_ADDRESS, LOCATION, MEDICAL_RECORD_NUMBER, and AGE_OVER_89 entities. Custom pattern recognizers handle MRN formats and HIPAA age thresholds. Offset shift tracking enables accurate re-identification and char interval remapping after extraction.
Local Privacy Mode
When using Ollama (local models), notes never leave the machine — de-identification is skipped entirely. The app auto-discovers available Ollama models via the local API, making it easy to run fully private chart review with no cloud dependencies.