# adot-7/sansys architecture

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

- Interactive diagram: https://gitdiagram.com/adot-7/sansys
- Repository: https://github.com/adot-7/sansys

## Overview

This prototype lets a clinician select a patient episode and specialty, review an AI-generated discharge-summary draft, edit or regenerate sections, then approve and retrieve a locally stored summary. The main stages are patient/episode selection, clinical-data retrieval and normalization, specialty-aware drafting, clinician review, and approval/persistence. The graph includes the major documented UI, Sansys, specialty, and LLM-provider capabilities. Some internal calls are shown only where excerpts or the source index support them; unsampled details are omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/adot-7/sansys/blob/main/client/src/App.jsx) (Summary workspace), [`server/src/routes.js`](https://github.com/adot-7/sansys/blob/main/server/src/routes.js) (Summary REST API), [`server/src/llm/index.js`](https://github.com/adot-7/sansys/blob/main/server/src/llm/index.js) (LLM provider registry), [`server/src/llm/anthropic.js`](https://github.com/adot-7/sansys/blob/main/server/src/llm/anthropic.js) (Anthropic adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Clinician workflow"]
  node_app["Summary workspace<br/>[App.jsx]"]
  node_api_client["REST client<br/>[api.js]"]
  node_patient_select["Patient selection<br/>[PatientSelect.jsx]"]
  node_patient_banner["Patient banner<br/>[PatientBanner.jsx]"]
  node_section_nav["Section navigation<br/>[SectionNav.jsx]"]
  node_draft_panel["Draft review<br/>[DraftPanel.jsx]"]
  node_edit_panel["Section editing<br/>[EditPanel.jsx]"]
  node_approve_bar["Approval controls<br/>[ApproveBar.jsx]"]
  node_settings_modal["Summary settings<br/>[SettingsModal.jsx]"]
  node_specialty_modal["Specialty creation<br/>[SpecialtyModal.jsx]"]
  node_print_summary["Print summary<br/>[PrintSummary.jsx]"]
  node_print_format["Print formatting<br/>[printFormat.js]"]
end

subgraph group_clinical["Clinical data"]
  node_clinical_access["Patient data access<br/>[dataAccess.js]"]
end

subgraph group_generation["Draft generation"]
  node_specialties["Specialty registry<br/>[index.js]"]
  node_prompt_builder["Prompt and source data<br/>[prompts.js]"]
  node_llm_registry["LLM provider registry<br/>[index.js]"]
  node_anthropic_adapter["Anthropic adapter<br/>[anthropic.js]"]
  node_chat_adapter["Compatible chat adapter<br/>[chat.js]"]
  node_text_formatter["Section formatting<br/>[format.js]"]
end

subgraph group_server["API and persistence"]
  node_rest_api["Summary REST API<br/>[routes.js]"]
  node_summary_store[("Approved summaries<br/>[store.js]")]
end

node_clinician(("Clinician"))
node_sansys{{"Sansys clinical API"}}
node_llm_services{{"LLM services"}}

node_clinician -->|"uses"| node_app
node_app -->|"requests data"| node_api_client
node_app -->|"renders"| node_patient_select
node_app -->|"renders"| node_patient_banner
node_app -->|"renders"| node_section_nav
node_app -->|"renders"| node_draft_panel
node_app -->|"renders"| node_edit_panel
node_app -->|"renders"| node_approve_bar
node_app -->|"renders"| node_settings_modal
node_app -->|"renders"| node_specialty_modal
node_app -->|"renders"| node_print_summary
node_print_summary -->|"uses"| node_print_format
node_api_client -->|"calls"| node_rest_api
node_rest_api -->|"fetches patient"| node_clinical_access
node_clinical_access -->|"reads clinical data"| node_sansys
node_rest_api -->|"loads config"| node_specialties
node_rest_api -->|"builds source data"| node_prompt_builder
node_rest_api -->|"generates draft"| node_llm_registry
node_llm_registry -->|"dispatches"| node_anthropic_adapter
node_llm_registry -->|"creates compatible client"| node_chat_adapter
node_anthropic_adapter -->|"builds prompts"| node_prompt_builder
node_anthropic_adapter -.->|"sends requests"| node_llm_services
node_chat_adapter -.->|"sends requests"| node_llm_services
node_llm_registry -->|"formats sections"| node_text_formatter
node_llm_registry -->|"reconciles facts"| node_clinical_access
node_rest_api -->|"reads summary"| node_summary_store
node_rest_api -->|"saves approval"| node_summary_store

click node_app "https://github.com/adot-7/sansys/blob/main/client/src/App.jsx"
click node_api_client "https://github.com/adot-7/sansys/blob/main/client/src/api.js"
click node_patient_select "https://github.com/adot-7/sansys/blob/main/client/src/components/PatientSelect.jsx"
click node_patient_banner "https://github.com/adot-7/sansys/blob/main/client/src/components/PatientBanner.jsx"
click node_section_nav "https://github.com/adot-7/sansys/blob/main/client/src/components/SectionNav.jsx"
click node_draft_panel "https://github.com/adot-7/sansys/blob/main/client/src/components/DraftPanel.jsx"
click node_edit_panel "https://github.com/adot-7/sansys/blob/main/client/src/components/EditPanel.jsx"
click node_approve_bar "https://github.com/adot-7/sansys/blob/main/client/src/components/ApproveBar.jsx"
click node_settings_modal "https://github.com/adot-7/sansys/blob/main/client/src/components/SettingsModal.jsx"
click node_specialty_modal "https://github.com/adot-7/sansys/blob/main/client/src/components/SpecialtyModal.jsx"
click node_print_summary "https://github.com/adot-7/sansys/blob/main/client/src/components/PrintSummary.jsx"
click node_print_format "https://github.com/adot-7/sansys/blob/main/client/src/components/printFormat.js"
click node_rest_api "https://github.com/adot-7/sansys/blob/main/server/src/routes.js"
click node_specialties "https://github.com/adot-7/sansys/blob/main/server/src/specialties/index.js"
click node_clinical_access "https://github.com/adot-7/sansys/blob/main/server/src/dataAccess.js"
click node_prompt_builder "https://github.com/adot-7/sansys/blob/main/server/src/llm/prompts.js"
click node_llm_registry "https://github.com/adot-7/sansys/blob/main/server/src/llm/index.js"
click node_anthropic_adapter "https://github.com/adot-7/sansys/blob/main/server/src/llm/anthropic.js"
click node_chat_adapter "https://github.com/adot-7/sansys/blob/main/server/src/llm/chat.js"
click node_text_formatter "https://github.com/adot-7/sansys/blob/main/server/src/llm/format.js"
click node_summary_store "https://github.com/adot-7/sansys/blob/main/server/src/store.js"

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_app,node_api_client,node_patient_select,node_patient_banner,node_section_nav,node_draft_panel,node_edit_panel,node_approve_bar,node_settings_modal,node_specialty_modal,node_print_summary,node_print_format toneBlue
class node_clinical_access toneAmber
class node_specialties,node_prompt_builder,node_llm_registry,node_anthropic_adapter,node_chat_adapter,node_text_formatter,node_sansys toneMint
class node_rest_api,node_summary_store toneRose
class node_clinician,node_llm_services toneIndigo
```

## Components

### Clinician workflow

- [Summary workspace](https://github.com/adot-7/sansys/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [REST client](https://github.com/adot-7/sansys/blob/main/client/src/api.js): `client/src/api.js`
- [Patient selection](https://github.com/adot-7/sansys/blob/main/client/src/components/PatientSelect.jsx): `client/src/components/PatientSelect.jsx`
- [Patient banner](https://github.com/adot-7/sansys/blob/main/client/src/components/PatientBanner.jsx): `client/src/components/PatientBanner.jsx`
- [Section navigation](https://github.com/adot-7/sansys/blob/main/client/src/components/SectionNav.jsx): `client/src/components/SectionNav.jsx`
- [Draft review](https://github.com/adot-7/sansys/blob/main/client/src/components/DraftPanel.jsx): `client/src/components/DraftPanel.jsx`
- [Section editing](https://github.com/adot-7/sansys/blob/main/client/src/components/EditPanel.jsx): `client/src/components/EditPanel.jsx`
- [Approval controls](https://github.com/adot-7/sansys/blob/main/client/src/components/ApproveBar.jsx): `client/src/components/ApproveBar.jsx`
- [Summary settings](https://github.com/adot-7/sansys/blob/main/client/src/components/SettingsModal.jsx): `client/src/components/SettingsModal.jsx`
- [Specialty creation](https://github.com/adot-7/sansys/blob/main/client/src/components/SpecialtyModal.jsx): `client/src/components/SpecialtyModal.jsx`
- [Print summary](https://github.com/adot-7/sansys/blob/main/client/src/components/PrintSummary.jsx): `client/src/components/PrintSummary.jsx`
- [Print formatting](https://github.com/adot-7/sansys/blob/main/client/src/components/printFormat.js): `client/src/components/printFormat.js`

### Clinical data

- [Patient data access](https://github.com/adot-7/sansys/blob/main/server/src/dataAccess.js): `server/src/dataAccess.js`

### Draft generation

- [Specialty registry](https://github.com/adot-7/sansys/blob/main/server/src/specialties/index.js): `server/src/specialties/index.js`
- [Prompt and source data](https://github.com/adot-7/sansys/blob/main/server/src/llm/prompts.js): `server/src/llm/prompts.js`
- [LLM provider registry](https://github.com/adot-7/sansys/blob/main/server/src/llm/index.js): `server/src/llm/index.js`
- [Anthropic adapter](https://github.com/adot-7/sansys/blob/main/server/src/llm/anthropic.js): `server/src/llm/anthropic.js`
- [Compatible chat adapter](https://github.com/adot-7/sansys/blob/main/server/src/llm/chat.js): `server/src/llm/chat.js`
- [Section formatting](https://github.com/adot-7/sansys/blob/main/server/src/llm/format.js): `server/src/llm/format.js`

### API and persistence

- [Summary REST API](https://github.com/adot-7/sansys/blob/main/server/src/routes.js): `server/src/routes.js`
- [Approved summaries](https://github.com/adot-7/sansys/blob/main/server/src/store.js): `server/src/store.js`

### Other components

- **Clinician**
- **Sansys clinical API**
- **LLM services**

## Connections

- Clinician → Summary workspace: uses (evidence: `README.md`)
- Summary workspace → REST client: requests data (evidence: `client/src/App.jsx`)
- Summary workspace → Patient selection: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Patient banner: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Section navigation: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Draft review: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Section editing: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Approval controls: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Summary settings: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Specialty creation: renders (evidence: `client/src/App.jsx`)
- Summary workspace → Print summary: renders (evidence: `client/src/App.jsx`)
- Print summary → Print formatting: uses (evidence: `client/src/components/PrintSummary.jsx`)
- REST client → Summary REST API: calls (evidence: `README.md`)
- Summary REST API → Patient data access: fetches patient (evidence: `server/src/routes.js`)
- Patient data access → Sansys clinical API: reads clinical data (evidence: `README.md`)
- Summary REST API → Specialty registry: loads config (evidence: `server/src/routes.js`)
- Summary REST API → Prompt and source data: builds source data (evidence: `server/src/routes.js`)
- Summary REST API → LLM provider registry: generates draft (evidence: `server/src/routes.js`)
- LLM provider registry → Anthropic adapter: dispatches (evidence: `server/src/llm/index.js`)
- LLM provider registry → Compatible chat adapter: creates compatible client (evidence: `server/src/llm/index.js`)
- Anthropic adapter → Prompt and source data: builds prompts (evidence: `server/src/llm/anthropic.js`)
- Anthropic adapter → LLM services: sends requests (evidence: `server/src/llm/anthropic.js`)
- Compatible chat adapter → LLM services: sends requests (evidence: `README.md`)
- LLM provider registry → Section formatting: formats sections (evidence: `server/src/llm/index.js`)
- LLM provider registry → Patient data access: reconciles facts (evidence: `server/src/llm/index.js`)
- Summary REST API → Approved summaries: reads summary (evidence: `server/src/routes.js`)
- Summary REST API → Approved summaries: saves approval (evidence: `server/src/routes.js`)
