How abelmou/healthcare-assistant works
Purpose and Entry Points
This is a local, Python-based healthcare assistant combining document-question answering, prescription OCR, and pharmacy discovery. It exposes several independently runnable UIs:
• Main Streamlit portal: main.py
• Document/RAG Streamlit assistant: app_streamlit.py
• Conversational Chainlit assistant: app_chainlit.py
• Prescription OCR UI: ocr.py
• Pharmacy locator UI: pharmascysol.py
RAG Knowledge Pipeline
The retrieval layer is centered in rag.py, with persisted Chroma vector-store artifacts under chroma_db/chroma.sqlite3 and chroma_db/55367a26-0c7a-497d-8e7f-3675c6b8c9f0/. It is intended to ingest, chunk, embed, and retrieve health-document context before generation. Seed/source materials reside in data/World-Health-Organization.pdf and corrected prescription text files in data/.
LLM Orchestration Boundary
LangChain provides the application’s LLM/RAG orchestration, while Ollama is the local model-serving dependency (the README specifies llama3.2). UI applications should delegate health-query answering to the retrieval layer rather than treating Streamlit or Chainlit as model backends. This creates a clear boundary between interaction shells (app_streamlit.py, app_chainlit.py) and retrieval/generation (rag.py).
Document Assistant Interfaces
Two interfaces serve the question-answering workflow:
• app_streamlit.py provides a browser-oriented document assistant.
• app_chainlit.py, with supporting chat content in chainlit.md, provides a chat-focused interface.
Both are alternate delivery surfaces for multilingual health queries (Darija, Arabic, English) over the RAG knowledge base.
Prescription OCR Flow
ocr.py is a separate Streamlit workflow for uploading/scanning prescription images, applying image processing and handwriting/OCR extraction, then producing usable prescription text. The repository includes OCR-related experiments in notebooks/Prescription_Handwritten_Text_Recognition.ipynb and corrected OCR outputs under data/corrected_ordonnance_*.txt, indicating a pipeline boundary between raw image recognition and downstream clinical-document use.
Pharmacy Discovery Flow
pharmascysol.py implements the pharmacy-locator capability. Its responsibility is distinct from RAG: it uses user geolocation and external map/place data or browser-accessible location services to identify nearby pharmacies/providers. It is launched independently, rather than as a required step in document retrieval.
Runtime and Persistence
Material runtime dependencies are Python 3.9+, Streamlit, Chainlit, LangChain, ChromaDB, Ollama, OpenCV, PDF parsing/processing libraries, and optionally ElevenLabs for text-to-speech. Persistent local state is committed under chroma_db/; source documents and derived prescription text are stored under data/. No server-side healthcare-provider API integration is evidenced; provider API integration is described as future work.
Main entry points: rag.py RAG pipeline · ocr.py Image processing & OCR · main.py Main portal · pharmascysol.py Pharmacy locator
Components 17
Runnable interfaces
Independent local UI entry points.
- Main portal
main.py - Document assistant · Browser-oriented health question interface.
app_streamlit.py - Chat assistant · Chat-focused multilingual health interface.
app_chainlit.py - Chat content
chainlit.md - Pharmacy locator · Independent nearby-pharmacy discovery workflow.
pharmascysol.py
Knowledge & generation
Local retrieval and answer-generation boundary.
- RAG pipeline · Ingests, chunks, embeds, retrieves, and generates answers.
rag.py - Local LLM
- Chroma vector store
chroma_db/chroma.sqlite3 - Vector artifacts
- WHO health source
data/World-Health-Organization.pdf
Prescription OCR
Prescription recognition and correction workflow.
- Prescription OCR UI
ocr.py - Prescription images · Input images supplied through the OCR workflow.
- Image processing & OCR · Extracts prescription text from scanned images.
ocr.py - Corrected prescriptions · Corrected OCR output available for downstream document use.
- OCR experiment
notebooks/Prescription_Handwritten_Text_Recognition.ipynb
Other components
- User geolocation
- Map/place services · External or browser-accessible nearby-place lookup.
Connections 17
- Main portal → Document assistant: launches
- Main portal → Prescription OCR UI: launches
- Main portal → Pharmacy locator: launches
- Document assistant → RAG pipeline: health query
- Chat assistant → RAG pipeline: health query
- Chat content → Chat assistant: supports
- WHO health source → RAG pipeline: ingest and chunk
- Corrected prescriptions → RAG pipeline: optional source text
- RAG pipeline → Chroma vector store: stores and retrieves embeddings
- Chroma vector store → Vector artifacts: persists collection
- RAG pipeline → Local LLM: generation
- Prescription images → Image processing & OCR: scan input
- Prescription OCR UI → Image processing & OCR: runs extraction
- Image processing & OCR → Corrected prescriptions: produces text
- OCR experiment → Image processing & OCR: experiments with
- User geolocation → Pharmacy locator: location
- Pharmacy locator → Map/place services: nearby lookup