How tensormax/medai works
MedAI is a Django clinical dashboard for doctors. Its main workflow runs from patient and visit management through document upload/indexing, patient-scoped retrieval, and AI-assisted chat or reports; separate paths produce deterministic clinical PDFs and manage follow-ups. The graph includes documented product features whose views or generators were not sampled. Edges cite explicit README descriptions or source evidence; unsampled implementation details are not inferred beyond those descriptions.
Main entry points: facade.py AI orchestrator · documents/services.py Upload processing · models.py Visit workspace · visits/services.py Visit chat service
Components 21
Clinical workflow
- Doctor accounts
apps/accounts/models.py - Patient records
apps/patients/models.py - Tasks dashboard
apps/tasks/views.py - Tasks and follow-ups
apps/tasks/models.py - Visit workspace
apps/visits/models.py - Visit chat service
apps/visits/services.py
Document pipeline
- Upload processing
apps/documents/services.py - PDF extraction and chunking
apps/ai/chunking.py - PHI de-identification
apps/ai/deidentify.py - Document chunks
apps/documents/models.py
AI and retrieval
- AI orchestrator
apps/ai/facade.py - RAG retrieval and reranking
apps/ai/retrieval.py - Local embeddings
apps/ai/embeddings.py - Vector search
apps/ai/vectorstore.py - Prompt templates
apps/ai/prompts.py
Clinical outputs
- Clinical PDF builders
apps/documents/clinical_docs.py - AI report generation
apps/ai/report_generation.py - Document analyses and reports
apps/documents/models.py - Report PDF rendering
apps/documents/pdf.py
Other components
- Doctor
- OpenRouter LLM
Connections 27
- Doctor → Doctor accounts: registers
- Doctor → Patient records: manages
- Doctor → Tasks dashboard: uses
- Tasks dashboard → Tasks and follow-ups: manages
- Doctor → Visit workspace: starts
- Visit workspace → Visit chat service: posts messages
apps/visits/services.py - Visit chat service → Visit workspace: saves messages
apps/visits/services.py - Visit chat service → AI orchestrator: requests reply
apps/visits/services.py - AI orchestrator → RAG retrieval and reranking: retrieves context
apps/ai/facade.py - AI orchestrator → Prompt templates: builds prompts
apps/ai/facade.py - AI orchestrator → OpenRouter LLM: requests completion
apps/ai/facade.py - RAG retrieval and reranking → Local embeddings: embeds queries
apps/ai/retrieval.py - RAG retrieval and reranking → Vector search: queries vectors
apps/ai/retrieval.py - Vector search → Document chunks: searches chunks
apps/ai/vectorstore.py - Doctor → Upload processing: uploads documents
- Upload processing → PDF extraction and chunking: extracts and chunks
apps/documents/services.py - Upload processing → PHI de-identification: de-identifies text
apps/documents/services.py - Upload processing → Document chunks: stores chunks
apps/documents/services.py - Upload processing → Local embeddings: creates vectors
apps/documents/services.py - Doctor → Clinical PDF builders: requests document
- Doctor → AI orchestrator: requests report
- AI orchestrator → AI report generation: generates report
apps/ai/facade.py - AI report generation → OpenRouter LLM: requests completion
- Upload processing → AI orchestrator: requests analysis
apps/documents/services.py - AI orchestrator → Document analyses and reports: returns analysis data
apps/ai/facade.py - Doctor → Report PDF rendering: downloads report PDF
- Visit workspace → Tasks and follow-ups: creates follow-up
apps/visits/services.py