How kayessp-26/clearmed-ai works
ClearMed AI turns pasted clinical text or uploaded medical reports into plain-language explanations, using OCR for scanned or image reports and RAG context during simplification. The main user flow runs from the React workspace through the API to the backend simplifier, then returns an explanation with readability metrics. The product also includes corpus ingestion, request logging, and an evaluation dashboard/benchmark workflow. The graph uses README claims where backend routing or unsampled capabilities were not shown; those implementation details are not inferred beyond the documented relationships.
Main entry points: SimplifyWorkspace.jsx Simplify workspace · main.py FastAPI endpoints · simplifier.py Text simplifier · ingest.py Corpus ingestion
Components 25
User experience
- App composition
frontend/react/src/App.jsx - Simplify workspace
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - API client
frontend/react/src/services/api.js - Explanation results
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - Evaluation dashboard
frontend/react/src/features/evaluation/EvaluationDashboard.jsx - Landing guidance
frontend/react/src/features/landing/HowItWorks.jsx - App shell
frontend/react/src/components/layout/AppShell.jsx
Simplification service
- FastAPI endpoints
backend/app/main.py - Report OCR
backend/app/pipeline/ocr.py - Text simplifier
backend/app/pipeline/simplifier.py - Simplification prompt
backend/app/prompts/simplify_v2.txt - Gemini client
backend/app/gemini.py - Service settings
backend/app/config.py
Medical context
- Context retriever
backend/app/rag/retriever.py - Text embedder
backend/app/rag/embedder.py - Pinecone index
- Corpus ingestion
backend/app/rag/ingest.py - Ingestion runner
scripts/ingest_corpus.py
Supporting capabilities
- Request logger
backend/app/db/logger.py - Evaluation benchmark
eval/evaluate.py
Other components
- Report user
- Google Gemini
- Supabase logging
- Tesseract OCR
- PubMedQA corpus
Connections 26
- Report user → Simplify workspace: enters text or file
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - App composition → App shell: renders
frontend/react/src/App.jsx - App composition → Landing guidance: renders
frontend/react/src/App.jsx - App composition → Simplify workspace: renders
frontend/react/src/App.jsx - Simplify workspace → API client: submits input
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - API client → FastAPI endpoints: sends simplify request
README.md - Simplify workspace → Explanation results: renders response
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - Simplify workspace → Evaluation dashboard: renders
frontend/react/src/features/simplify/SimplifyWorkspace.jsx - FastAPI endpoints → Report OCR: processes uploaded reports
README.md - Report OCR → Tesseract OCR: extracts text
README.md - FastAPI endpoints → Text simplifier: simplifies clinical text
README.md - Text simplifier → Context retriever: retrieves context
backend/app/pipeline/simplifier.py - Text simplifier → Simplification prompt: fills template
backend/app/pipeline/simplifier.py - Text simplifier → Gemini client: requests generation
backend/app/pipeline/simplifier.py - Gemini client → Google Gemini: calls model
- Context retriever → Text embedder: embeds query
- Text embedder → Gemini client: requests embeddings
backend/app/rag/embedder.py - Context retriever → Pinecone index: queries vectors
README.md - Ingestion runner → Corpus ingestion: starts ingestion
scripts/ingest_corpus.py - Corpus ingestion → PubMedQA corpus: loads abstracts
backend/app/rag/ingest.py - Corpus ingestion → Text embedder: embeds chunks
backend/app/rag/ingest.py - Corpus ingestion → Pinecone index: upserts vectors
backend/app/rag/ingest.py - FastAPI endpoints → Request logger: logs requests
README.md - Request logger → Supabase logging: writes logs
README.md - Request logger → Service settings: reads credentials
backend/app/db/logger.py - Evaluation benchmark → FastAPI endpoints: evaluates responses
README.md