# navyachhoker/symptom-checker architecture

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

- Interactive diagram: https://gitdiagram.com/navyachhoker/symptom-checker
- Repository: https://github.com/navyachhoker/symptom-checker

## Overview

MedTriage is a conversational symptom-triage application. A patient sends symptoms through the chat UI; the API restores or creates a session and invokes the LangGraph workflow. The agent gathers and assesses symptom details, may ask follow-up questions or consult specialists and clinical tools, then produces an urgency and advice for a safety review. The API persists conversation and completed outcomes and returns them for display; the UI also supports session history. The README documents these capabilities, while several agent and frontend implementation details were not sampled, so uncertain internal wiring is omitted.

Main entry points: [`backend/app/api/routes.py`](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/api/routes.py) (REST routes), [`backend/app/agent/orchestrator.py`](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/orchestrator.py) (Assessment orchestrator), [`frontend/src/pages/Chat.jsx`](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/pages/Chat.jsx) (Chat experience), [`frontend/src/api.js`](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Patient interface"]
  node_chat["Chat experience<br/>[Chat.jsx]"]
  node_session_ui["Session list<br/>[SessionList.jsx]"]
  node_result_ui["Triage display<br/>[TriageResult.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_app["App entry<br/>[App.jsx]"]
end

subgraph group_service["API and persistence"]
  node_api["REST routes<br/>[routes.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_db_session["Database session<br/>[database.py]"]
  node_db_models["Persistence models<br/>[models.py]"]
end

subgraph group_agent["Triage workflow"]
  node_graph["Compiled agent graph<br/>[graph.py]"]
  node_orchestrator["Assessment orchestrator<br/>[orchestrator.py]"]
  node_state["Triage state<br/>[state.py]"]
  node_specialists["Specialist agents<br/>[specialists.py]"]
  node_tools["Clinical tools<br/>[tools.py]"]
  node_safety["Safety review<br/>[safety.py]"]
end

subgraph group_integrations["External systems"]
  node_postgres[("PostgreSQL")]
  node_groq["Groq LLM"]
end

node_patient(("Patient"))

node_patient -->|"enters symptoms"| node_chat
node_app -->|"renders"| node_chat
node_chat -->|"requests chat and history"| node_api_client
node_api_client -->|"calls REST API"| node_api
node_api -->|"validates and responds"| node_schemas
node_api -->|"reads and writes"| node_db_session
node_db_session -->|"persists records"| node_postgres
node_api -->|"invokes triage"| node_graph
node_graph -->|"dispatches workflow"| node_orchestrator
node_orchestrator -->|"consults specialist"| node_specialists
node_orchestrator -->|"runs clinical checks"| node_tools
node_orchestrator -->|"requests final review"| node_safety
node_orchestrator -.->|"requests reasoning"| node_groq
node_safety -.->|"requests review"| node_groq
node_specialists -.->|"requests assessment"| node_groq
node_api -->|"returns session data"| node_session_ui
node_api -->|"returns triage outcome"| node_result_ui
node_chat -->|"displays assessment"| node_result_ui
node_chat -->|"loads and selects sessions"| node_session_ui

click node_chat "https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/pages/Chat.jsx"
click node_session_ui "https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/components/SessionList.jsx"
click node_result_ui "https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/components/TriageResult.jsx"
click node_api_client "https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/api.js"
click node_app "https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/api/routes.py"
click node_schemas "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/models/schemas.py"
click node_db_session "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/db/database.py"
click node_db_models "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/db/models.py"
click node_graph "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/graph.py"
click node_orchestrator "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/orchestrator.py"
click node_state "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/state.py"
click node_specialists "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/specialists.py"
click node_tools "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/tools.py"
click node_safety "https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/safety.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_chat,node_session_ui,node_result_ui,node_api_client,node_app toneBlue
class node_api,node_schemas,node_db_session,node_db_models toneAmber
class node_graph,node_orchestrator,node_state,node_specialists,node_tools,node_safety toneMint
class node_postgres,node_groq toneRose
class node_patient toneIndigo
```

## Components

### Patient interface

- [Chat experience](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Session list](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/components/SessionList.jsx): `frontend/src/components/SessionList.jsx`
- [Triage display](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/components/TriageResult.jsx): `frontend/src/components/TriageResult.jsx`
- [API client](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [App entry](https://github.com/navyachhoker/symptom-checker/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### API and persistence

- [REST routes](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Request schemas](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`
- [Database session](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Persistence models](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/db/models.py): `backend/app/db/models.py`

### Triage workflow

- [Compiled agent graph](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/graph.py): `backend/app/agent/graph.py`
- [Assessment orchestrator](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/orchestrator.py): `backend/app/agent/orchestrator.py`
- [Triage state](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/state.py): `backend/app/agent/state.py`
- [Specialist agents](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/specialists.py): `backend/app/agent/specialists.py`
- [Clinical tools](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/tools.py): `backend/app/agent/tools.py`
- [Safety review](https://github.com/navyachhoker/symptom-checker/blob/main/backend/app/agent/safety.py): `backend/app/agent/safety.py`

### External systems

- **PostgreSQL**
- **Groq LLM**

### Other components

- **Patient**

## Connections

- Patient → Chat experience: enters symptoms
- App entry → Chat experience: renders
- Chat experience → API client: requests chat and history
- API client → REST routes: calls REST API
- REST routes → Request schemas: validates and responds
- REST routes → Database session: reads and writes
- Database session → PostgreSQL: persists records
- REST routes → Compiled agent graph: invokes triage
- Compiled agent graph → Assessment orchestrator: dispatches workflow
- Assessment orchestrator → Specialist agents: consults specialist
- Assessment orchestrator → Clinical tools: runs clinical checks
- Assessment orchestrator → Safety review: requests final review
- Assessment orchestrator → Groq LLM: requests reasoning
- Safety review → Groq LLM: requests review
- Specialist agents → Groq LLM: requests assessment
- REST routes → Session list: returns session data
- REST routes → Triage display: returns triage outcome
- Chat experience → Triage display: displays assessment
- Chat experience → Session list: loads and selects sessions
