# ghioc-mihai-bogdan/zero-trust-medical-agent architecture

> Architecture diagram of the GitHub repository ghioc-mihai-bogdan/zero-trust-medical-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghioc-mihai-bogdan/zero-trust-medical-agent
- Repository: https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent

## Overview

This is a clinical chat application whose main workflow turns a physician’s text and optional image or file into a clinical report: the browser prepares the input, the Flask orchestrator runs clinical agents in parallel, and a language model synthesizes their results. The UI also supports session history, while the backend stores session state in Redis. The README documents Istio/mTLS protection for mesh traffic and host-based Ollama inference; unsampled deployment manifests and acuity implementation limit detail about those internals.

Main entry points: [`app.py`](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/app.py) (Clinical API), [`clinical-mesh-ui/src/app/services/chat.service.ts`](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/services/chat.service.ts) (Chat service), [`clinical-mesh-ui/src/app/app.component.ts`](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/app.component.ts) (Chat interface), [`coder.py`](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/coder.py) (Medical coder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Clinical chat UI"]
  node_app["Chat interface<br/>[app.component.ts]"]
  node_chat["Chat service<br/>[chat.service.ts]"]
  node_config["HTTP client setup<br/>[app.config.ts]"]
end

subgraph group_backend["Orchestration"]
  node_orchestrator["Clinical API<br/>[app.py]"]
end

subgraph group_agents["Clinical agents"]
  node_coder["Medical coder<br/>[coder.py]"]
  node_diagnostician["Diagnostician<br/>[diagnostician.py]"]
  node_acuity["Acuity analyzer<br/>[acuity.py]"]
  node_educator["Patient educator<br/>[educator.py]"]
end

subgraph group_runtime["Inference and state"]
  node_redis[("Session store")]
  node_ollama{{"Ollama inference"}}
  node_istio{{"Istio mTLS mesh"}}
end

node_physician(("Attending physician"))

node_physician -->|"enters case"| node_app
node_app -->|"compresses and sends"| node_chat
node_chat -->|"posts requests"| node_orchestrator
node_chat -->|"loads history"| node_orchestrator
node_orchestrator -->|"requests codes"| node_coder
node_orchestrator -->|"requests diagnoses"| node_diagnostician
node_orchestrator -->|"requests acuity"| node_acuity
node_orchestrator -->|"requests explanation"| node_educator
node_orchestrator -->|"reads and writes sessions"| node_redis
node_orchestrator -->|"synthesizes report"| node_ollama
node_coder -->|"requests coding inference"| node_ollama
node_diagnostician -->|"requests diagnostic inference"| node_ollama
node_educator -->|"requests education inference"| node_ollama
node_acuity -.->|"reads session state"| node_redis
node_orchestrator -->|"traffic protected by"| node_istio

click node_app "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/app.component.ts"
click node_chat "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/services/chat.service.ts"
click node_config "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/app.config.ts"
click node_orchestrator "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/app.py"
click node_coder "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/coder.py"
click node_diagnostician "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/diagnostician.py"
click node_acuity "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/acuity.py"
click node_educator "https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/educator.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_app,node_chat,node_config toneBlue
class node_orchestrator toneAmber
class node_coder,node_diagnostician,node_acuity,node_educator toneMint
class node_redis,node_ollama,node_istio toneRose
class node_physician toneIndigo
```

## Components

### Clinical chat UI

- [Chat interface](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/app.component.ts): `clinical-mesh-ui/src/app/app.component.ts`
- [Chat service](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/services/chat.service.ts): `clinical-mesh-ui/src/app/services/chat.service.ts`
- [HTTP client setup](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/clinical-mesh-ui/src/app/app.config.ts): `clinical-mesh-ui/src/app/app.config.ts`

### Orchestration

- [Clinical API](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/app.py): `app.py`

### Clinical agents

- [Medical coder](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/coder.py): `coder.py`
- [Diagnostician](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/diagnostician.py): `diagnostician.py`
- [Acuity analyzer](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/acuity.py): `acuity.py`
- [Patient educator](https://github.com/ghioc-mihai-bogdan/zero-trust-medical-agent/blob/main/educator.py): `educator.py`

### Inference and state

- **Session store**
- **Ollama inference**
- **Istio mTLS mesh**

### Other components

- **Attending physician**

## Connections

- Attending physician → Chat interface: enters case (evidence: `README.md`)
- Chat interface → Chat service: compresses and sends (evidence: `clinical-mesh-ui/src/app/app.component.ts`)
- Chat service → Clinical API: posts requests (evidence: `clinical-mesh-ui/src/app/services/chat.service.ts`)
- Chat service → Clinical API: loads history (evidence: `clinical-mesh-ui/src/app/services/chat.service.ts`)
- Clinical API → Medical coder: requests codes (evidence: `app.py`)
- Clinical API → Diagnostician: requests diagnoses (evidence: `app.py`)
- Clinical API → Acuity analyzer: requests acuity (evidence: `app.py`)
- Clinical API → Patient educator: requests explanation (evidence: `app.py`)
- Clinical API → Session store: reads and writes sessions (evidence: `app.py`)
- Clinical API → Ollama inference: synthesizes report (evidence: `app.py`)
- Medical coder → Ollama inference: requests coding inference (evidence: `coder.py`)
- Diagnostician → Ollama inference: requests diagnostic inference (evidence: `diagnostician.py`)
- Patient educator → Ollama inference: requests education inference (evidence: `educator.py`)
- Acuity analyzer → Session store: reads session state (evidence: `README.md`)
- Clinical API → Istio mTLS mesh: traffic protected by (evidence: `README.md`)
