How sairohith28/medsuggestions works
Project type and purpose
• This is a backend-only Medical AI Assistant microservice written in Python (Flask).
• It exposes a single HTTP API (/api/suggest) that ingests a patientId and doctorId and returns structured medical suggestions.
• It combines data from MongoDB, a semantic-similarity module, an external ICD-11 code API, and a Language Learning Model (LLM) API.
File structure
• Top level contains:
• med5.py (the main Flask application)
• A series of Python modules/scripts: extract.py, suggestions.py, past_history.py, agentic.py, etc., each encapsulating a slice of business logic (data extraction, prompt construction, few-shot example formatting, LLM invocation, etc.)
• No frontend directory—this is purely backend.
• Configuration is externalized via environment variables (.env → MONGO_URI, LLM_API_URL, etc.).
README for additional insights
• Core dependencies: Flask, PyMongo (MongoDB driver), a semantic model library (e.g., HuggingFace embeddings), and an LLM API client.
• Workflow:
a) Fetch patient and doctor data from MongoDB
b) Compute semantic similarity to find analogous past visits and preferences
c) Format a prompt (few-shot examples)
d) Call the LLM API
e) Fetch ICD-11 codes from external API
f) Assemble and return the JSON response
Summary
• Break the system into the smallest meaningful components (API layer, data layer, logic modules, external services).
• How data flows between them in sequence.
• Technologies and call out configuration.