# manasacheeku/patient-360-copilot architecture

> Architecture diagram of the GitHub repository manasacheeku/patient-360-copilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manasacheeku/patient-360-copilot
- Repository: https://github.com/manasacheeku/patient-360-copilot

## Overview

Patient 360 is a synthetic-data clinical evidence dashboard. Users select a patient, inspect structured profile and timeline data, review rule-based risks, ask evidence-grounded Copilot questions, and open cited records or local documents. The graph follows the React-to-FastAPI workflow and its SQLite, risk, and document-retrieval services. Some UI and service behavior is represented from README documentation because the excerpts are partial; no external model or production clinical system is involved.

Main entry points: [`backend/app/main.py`](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py) (FastAPI routes), [`frontend/src/App.jsx`](https://github.com/manasacheeku/patient-360-copilot/blob/main/frontend/src/App.jsx) (Patient 360 dashboard), [`backend/app/services/copilot.py`](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/copilot.py) (Grounded answer service), [`backend/app/database.py`](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/database.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Patient workspace"]
  node_dashboard["Patient 360 dashboard<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and domain services"]
  node_fastapi["FastAPI routes<br/>[main.py]"]
  node_profile_timeline["Profile and timeline<br/>[main.py]"]
  node_risk_endpoint["Risk endpoint<br/>[main.py]"]
  node_copilot_endpoint["Copilot endpoint<br/>[main.py]"]
  node_document_endpoint["Document endpoint<br/>[main.py]"]
end

subgraph group_records["Synthetic records"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_patient_models["Patient record models<br/>[entities.py]"]
  node_sqlite[("SQLite records")]
  node_seed_service["Synthetic data seeding<br/>[seeding.py]"]
  node_patient_fixture["Synthetic patient fixture"]
end

subgraph group_evidence["Evidence and reasoning"]
  node_serializers["Record serializers and citations<br/>[serializers.py]"]
  node_risk_rules["Explainable risk rules<br/>[risk.py]"]
  node_copilot["Grounded answer service<br/>[copilot.py]"]
  node_document_retrieval["Local document retrieval<br/>[documents.py]"]
  node_document_corpus["Markdown evidence corpus"]
end

node_reviewer(("Healthcare reviewer"))

node_reviewer -->|"uses"| node_dashboard
node_dashboard -->|"requests data"| node_api_client
node_api_client -->|"calls JSON API"| node_fastapi
node_fastapi -->|"serves profile"| node_profile_timeline
node_fastapi -->|"serves risks"| node_risk_endpoint
node_fastapi -->|"routes questions"| node_copilot_endpoint
node_fastapi -->|"lists documents"| node_document_endpoint
node_profile_timeline -->|"queries records"| node_db_session
node_risk_endpoint -->|"calculates risks"| node_risk_rules
node_copilot_endpoint -->|"answers question"| node_copilot
node_document_endpoint -->|"lists evidence"| node_document_retrieval
node_db_session -->|"opens sessions"| node_sqlite
node_db_session -->|"creates schema"| node_patient_models
node_seed_service -->|"loads fixture"| node_patient_fixture
node_seed_service -->|"seeds records"| node_sqlite
node_risk_rules -->|"builds citations"| node_serializers
node_copilot -->|"evaluates risk"| node_risk_rules
node_copilot -->|"retrieves passages"| node_document_retrieval
node_copilot -->|"cites records"| node_serializers
node_document_retrieval -->|"indexes sections"| node_document_corpus
node_dashboard -->|"reviews risk"| node_risk_endpoint
node_dashboard -->|"opens evidence"| node_document_endpoint

click node_dashboard "https://github.com/manasacheeku/patient-360-copilot/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/manasacheeku/patient-360-copilot/blob/main/frontend/src/lib/api.js"
click node_fastapi "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py"
click node_profile_timeline "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py"
click node_risk_endpoint "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py"
click node_copilot_endpoint "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py"
click node_document_endpoint "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py"
click node_db_session "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/database.py"
click node_patient_models "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/models/entities.py"
click node_seed_service "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/seeding.py"
click node_patient_fixture "https://github.com/manasacheeku/patient-360-copilot/blob/main/data/synthetic_patients.json"
click node_serializers "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/serializers.py"
click node_risk_rules "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/risk.py"
click node_copilot "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/copilot.py"
click node_document_retrieval "https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/documents.py"
click node_document_corpus "https://github.com/manasacheeku/patient-360-copilot/tree/main/documents"

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_dashboard,node_api_client,node_reviewer toneBlue
class node_fastapi,node_profile_timeline,node_risk_endpoint,node_copilot_endpoint,node_document_endpoint toneAmber
class node_db_session,node_patient_models,node_sqlite,node_seed_service,node_patient_fixture toneMint
class node_serializers,node_risk_rules,node_copilot,node_document_retrieval,node_document_corpus toneRose
```

## Components

### Patient workspace

- [Patient 360 dashboard](https://github.com/manasacheeku/patient-360-copilot/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/manasacheeku/patient-360-copilot/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### API and domain services

- [FastAPI routes](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Profile and timeline](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Risk endpoint](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Copilot endpoint](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Document endpoint](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/main.py): `backend/app/main.py`

### Synthetic records

- [Database sessions](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/database.py): `backend/app/database.py`
- [Patient record models](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/models/entities.py): `backend/app/models/entities.py`
- **SQLite records**
- [Synthetic data seeding](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/seeding.py): `backend/app/services/seeding.py`
- [Synthetic patient fixture](https://github.com/manasacheeku/patient-360-copilot/blob/main/data/synthetic_patients.json): `data/synthetic_patients.json`

### Evidence and reasoning

- [Record serializers and citations](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/serializers.py): `backend/app/services/serializers.py`
- [Explainable risk rules](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/risk.py): `backend/app/services/risk.py`
- [Grounded answer service](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/copilot.py): `backend/app/services/copilot.py`
- [Local document retrieval](https://github.com/manasacheeku/patient-360-copilot/blob/main/backend/app/services/documents.py): `backend/app/services/documents.py`
- [Markdown evidence corpus](https://github.com/manasacheeku/patient-360-copilot/tree/main/documents): `documents`

### Other components

- **Healthcare reviewer**

## Connections

- Healthcare reviewer → Patient 360 dashboard: uses (evidence: `README.md`)
- Patient 360 dashboard → API client: requests data (evidence: `frontend/src/App.jsx`)
- API client → FastAPI routes: calls JSON API (evidence: `README.md`)
- FastAPI routes → Profile and timeline: serves profile (evidence: `backend/app/main.py`)
- FastAPI routes → Risk endpoint: serves risks (evidence: `backend/app/main.py`)
- FastAPI routes → Copilot endpoint: routes questions (evidence: `backend/app/main.py`)
- FastAPI routes → Document endpoint: lists documents (evidence: `backend/app/main.py`)
- Profile and timeline → Database sessions: queries records (evidence: `backend/app/main.py`)
- Risk endpoint → Explainable risk rules: calculates risks (evidence: `backend/app/main.py`)
- Copilot endpoint → Grounded answer service: answers question (evidence: `backend/app/main.py`)
- Document endpoint → Local document retrieval: lists evidence (evidence: `backend/app/main.py`)
- Database sessions → SQLite records: opens sessions (evidence: `backend/app/database.py`)
- Database sessions → Patient record models: creates schema (evidence: `backend/app/database.py`)
- Synthetic data seeding → Synthetic patient fixture: loads fixture (evidence: `backend/app/services/seeding.py`)
- Synthetic data seeding → SQLite records: seeds records (evidence: `backend/app/services/seeding.py`)
- Explainable risk rules → Record serializers and citations: builds citations (evidence: `backend/app/services/risk.py`)
- Grounded answer service → Explainable risk rules: evaluates risk (evidence: `backend/app/services/copilot.py`)
- Grounded answer service → Local document retrieval: retrieves passages (evidence: `backend/app/services/copilot.py`)
- Grounded answer service → Record serializers and citations: cites records (evidence: `backend/app/services/copilot.py`)
- Local document retrieval → Markdown evidence corpus: indexes sections (evidence: `README.md`)
- Patient 360 dashboard → Risk endpoint: reviews risk (evidence: `README.md`)
- Patient 360 dashboard → Document endpoint: opens evidence (evidence: `README.md`)
