# trishathi/medclear architecture

> Architecture diagram of the GitHub repository trishathi/medclear, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trishathi/medclear
- Repository: https://github.com/trishathi/medclear

## Overview

MedClear is a single-file Streamlit patient portal: users upload prescription imagery, the app requests structured interpretation from Gemini, and the resulting care plan is shown in a comprehension dashboard. That dashboard presents plain-language guidance, safety warnings, and a medication timeline, with report download and simulated SMS reminders. Patients can also ask context-aware follow-up questions through MedBuddy. The README documents these capabilities; the sampled source confirms the dashboard, session context, report generation, simulated reminders, and chat behavior, but omitted sections limit certainty about some upload and extraction details.

Main entry points: [`prescription.py`](https://github.com/trishathi/medclear/blob/main/prescription.py) (Care Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Patient Portal"]
  node_portal_ui["Streamlit Portal<br/>[prescription.py]"]
  node_image_upload["Image Upload<br/>[prescription.py]"]
end

subgraph group_care["Care Interpretation"]
  node_gemini_client["Gemini Client<br/>[prescription.py]"]
  node_structured_result["Structured Result<br/>[prescription.py]"]
  node_session_context["Prescription Context<br/>[prescription.py]"]
  node_care_dashboard["Care Dashboard<br/>[prescription.py]"]
  node_plain_summary["Plain Summary<br/>[prescription.py]"]
  node_safety_flags["Safety Warnings<br/>[prescription.py]"]
  node_intake_timeline["Intake Timeline<br/>[prescription.py]"]
  node_reminder_mock["SMS Simulation<br/>[prescription.py]"]
  node_report_export["Care Plan Export<br/>[prescription.py]"]
end

subgraph group_engagement["Patient Follow-up"]
  node_medbuddy_chat["MedBuddy Chat<br/>[prescription.py]"]
  node_chat_history["Chat History<br/>[prescription.py]"]
end

node_patient(("Patient"))
node_gemini_service{{"Gemini API"}}

node_patient -->|"uses"| node_portal_ui
node_patient -->|"uploads image"| node_image_upload
node_portal_ui -->|"renders"| node_image_upload
node_portal_ui -->|"requests interpretation"| node_gemini_client
node_gemini_client -->|"sends request"| node_gemini_service
node_gemini_service -->|"returns JSON"| node_gemini_client
node_gemini_client -->|"provides result"| node_structured_result
node_portal_ui -->|"stores context"| node_session_context
node_portal_ui -->|"renders"| node_care_dashboard
node_care_dashboard -->|"shows summary"| node_plain_summary
node_care_dashboard -->|"shows warnings"| node_safety_flags
node_care_dashboard -->|"shows schedule"| node_intake_timeline
node_care_dashboard -->|"simulates reminders"| node_reminder_mock
node_care_dashboard -->|"generates report"| node_report_export
node_patient -->|"asks questions"| node_medbuddy_chat
node_medbuddy_chat -->|"reads context"| node_session_context
node_medbuddy_chat -->|"requests answer"| node_gemini_client
node_medbuddy_chat -->|"updates history"| node_chat_history

click node_portal_ui "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_image_upload "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_gemini_client "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_structured_result "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_session_context "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_care_dashboard "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_plain_summary "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_safety_flags "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_intake_timeline "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_reminder_mock "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_report_export "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_medbuddy_chat "https://github.com/trishathi/medclear/blob/main/prescription.py"
click node_chat_history "https://github.com/trishathi/medclear/blob/main/prescription.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_portal_ui,node_image_upload toneBlue
class node_gemini_client,node_structured_result,node_session_context,node_care_dashboard,node_plain_summary,node_safety_flags,node_intake_timeline,node_reminder_mock,node_report_export toneAmber
class node_medbuddy_chat,node_chat_history,node_gemini_service toneMint
class node_patient toneIndigo
```

## Components

### Patient Portal

- [Streamlit Portal](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Image Upload](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`

### Care Interpretation

- [Gemini Client](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Structured Result](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Prescription Context](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Care Dashboard](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Plain Summary](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Safety Warnings](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Intake Timeline](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [SMS Simulation](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Care Plan Export](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`

### Patient Follow-up

- [MedBuddy Chat](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`
- [Chat History](https://github.com/trishathi/medclear/blob/main/prescription.py): `prescription.py`

### Other components

- **Patient**
- **Gemini API**

## Connections

- Patient → Streamlit Portal: uses
- Patient → Image Upload: uploads image
- Streamlit Portal → Image Upload: renders
- Streamlit Portal → Gemini Client: requests interpretation
- Gemini Client → Gemini API: sends request
- Gemini API → Gemini Client: returns JSON
- Gemini Client → Structured Result: provides result
- Streamlit Portal → Prescription Context: stores context
- Streamlit Portal → Care Dashboard: renders
- Care Dashboard → Plain Summary: shows summary
- Care Dashboard → Safety Warnings: shows warnings
- Care Dashboard → Intake Timeline: shows schedule
- Care Dashboard → SMS Simulation: simulates reminders
- Care Dashboard → Care Plan Export: generates report
- Patient → MedBuddy Chat: asks questions
- MedBuddy Chat → Prescription Context: reads context
- MedBuddy Chat → Gemini Client: requests answer
- MedBuddy Chat → Chat History: updates history
