# rohanthomas1202/agentforge-healthcare architecture

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

- Interactive diagram: https://gitdiagram.com/rohanthomas1202/agentforge-healthcare
- Repository: https://github.com/rohanthomas1202/agentforge-healthcare

## Overview

AgentForge Healthcare is a healthcare assistant: a user submits a clinical query through the web UI, the API invokes a LangGraph agent, and the agent selects tools to retrieve or analyze EHR and domain data. The response then passes a six-check verification pipeline before returning with metadata. The graph also preserves conversation history, observability, and the documented clinical-tool branches. Some tool implementations were not sampled; those capabilities and their relationships are shown only where documented in the README or SOURCE INDEX.

Main entry points: [`app/tools/registry.py`](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/registry.py) (Tool registry), [`app/agent/graph.py`](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/agent/graph.py) (LangGraph agent), [`app/fhir_client.py`](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/fhir_client.py) (FHIR client), [`app/api/routes.py`](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/api/routes.py) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web_ui["Web UI<br/>[app.js]"]
  node_browser_api["Browser API client<br/>[api.js]"]
end

subgraph group_agent["Agent orchestration"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_agent_graph["LangGraph agent<br/>[graph.py]"]
  node_sanitizer["Input sanitization<br/>[input_sanitizer.py]"]
end

subgraph group_clinical["Clinical capabilities"]
  node_tool_registry["Tool registry<br/>[registry.py]"]
  node_patient_summary["Patient summary<br/>[patient_summary.py]"]
  node_symptom_lookup["Symptom lookup<br/>[symptom_lookup.py]"]
  node_provider_search["Provider search<br/>[provider_search.py]"]
  node_appointments["Appointment availability"]
  node_clinical_trials["Clinical trials<br/>[clinical_trials.py]"]
  node_drug_interactions["Drug interactions"]
  node_allergy_check["Allergy checks<br/>[allergy_checker.py]"]
  node_fda_safety["FDA drug safety<br/>[fda_drug_safety.py]"]
  node_drug_recalls["Drug recalls<br/>[drug_recall.py]"]
  node_care_gaps["Care gaps"]
  node_insurance["Insurance coverage"]
  node_lab_results["Lab results<br/>[lab_results.py]"]
  node_record_vitals["Record vitals<br/>[record_vitals.py]"]
end

subgraph group_ehr["EHR and persistence"]
  node_ehr_provider["EHR abstraction<br/>[ehr_provider.py]"]
  node_fhir_client["FHIR client<br/>[fhir_client.py]"]
  node_mock_fhir["Mock FHIR client"]
  node_openemr["OpenEMR FHIR"]
  node_mariadb[("OpenEMR MariaDB")]
  node_chat_store[("Conversation store<br/>[database.py]")]
end

subgraph group_safety["Safety and operations"]
  node_verification["Verification pipeline<br/>[pipeline.py]"]
  node_verifiers["Six verifiers"]
  node_observability["Observability<br/>[observability.py]"]
end

node_user(("User"))

node_user -->|"submits query"| node_web_ui
node_web_ui -->|"uses"| node_browser_api
node_browser_api -->|"calls API"| node_api_routes
node_api_routes -->|"invokes"| node_agent_graph
node_agent_graph -->|"dispatches tools"| node_tool_registry
node_tool_registry -->|"registers"| node_patient_summary
node_tool_registry -->|"registers"| node_symptom_lookup
node_tool_registry -->|"registers"| node_provider_search
node_tool_registry -->|"registers"| node_appointments
node_tool_registry -->|"registers"| node_clinical_trials
node_tool_registry -->|"registers"| node_drug_interactions
node_tool_registry -->|"registers"| node_allergy_check
node_tool_registry -->|"registers"| node_fda_safety
node_tool_registry -->|"registers"| node_drug_recalls
node_tool_registry -->|"registers"| node_care_gaps
node_tool_registry -->|"registers"| node_insurance
node_tool_registry -->|"registers"| node_lab_results
node_tool_registry -->|"registers"| node_record_vitals
node_agent_graph -->|"verifies response"| node_verification
node_verification -->|"runs checks"| node_verifiers
node_agent_graph -->|"records metrics"| node_observability
node_api_routes -->|"reads and writes"| node_chat_store
node_provider_search -->|"searches FHIR"| node_fhir_client
node_insurance -->|"queries coverage"| node_mariadb
node_insurance -->|"looks up patient"| node_fhir_client
node_fhir_client -->|"implements"| node_ehr_provider
node_mock_fhir -->|"implements"| node_ehr_provider
node_fhir_client -->|"requests FHIR data"| node_openemr
node_agent_graph -.->|"sanitizes inputs"| node_sanitizer
node_agent_graph -->|"returns verified response"| node_user

click node_web_ui "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/frontend-v2/js/app.js"
click node_browser_api "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/frontend-v2/js/api.js"
click node_api_routes "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/api/routes.py"
click node_agent_graph "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/agent/graph.py"
click node_sanitizer "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/agent/input_sanitizer.py"
click node_tool_registry "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/registry.py"
click node_patient_summary "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/patient_summary.py"
click node_symptom_lookup "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/symptom_lookup.py"
click node_provider_search "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/provider_search.py"
click node_appointments "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/appointment_availability.py"
click node_clinical_trials "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/clinical_trials.py"
click node_drug_interactions "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/drug_interaction.py"
click node_allergy_check "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/allergy_checker.py"
click node_fda_safety "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/fda_drug_safety.py"
click node_drug_recalls "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/drug_recall.py"
click node_care_gaps "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/care_gap_analysis.py"
click node_insurance "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/insurance_coverage.py"
click node_lab_results "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/lab_results.py"
click node_record_vitals "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/record_vitals.py"
click node_ehr_provider "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/ehr_provider.py"
click node_fhir_client "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/fhir_client.py"
click node_mock_fhir "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/mock_fhir_client.py"
click node_chat_store "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/database.py"
click node_verification "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/verification/pipeline.py"
click node_verifiers "https://github.com/rohanthomas1202/agentforge-healthcare/tree/master/app/verification"
click node_observability "https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/observability.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_web_ui,node_browser_api,node_user toneBlue
class node_api_routes,node_agent_graph,node_sanitizer toneAmber
class node_tool_registry,node_patient_summary,node_symptom_lookup,node_provider_search,node_appointments,node_clinical_trials,node_drug_interactions,node_allergy_check,node_fda_safety,node_drug_recalls,node_care_gaps,node_insurance,node_lab_results,node_record_vitals toneMint
class node_ehr_provider,node_fhir_client,node_mock_fhir,node_openemr,node_mariadb,node_chat_store toneRose
class node_verification,node_verifiers,node_observability toneIndigo
```

## Components

### User experience

- [Web UI](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/frontend-v2/js/app.js): `frontend-v2/js/app.js`
- [Browser API client](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/frontend-v2/js/api.js): `frontend-v2/js/api.js`

### Agent orchestration

- [API routes](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/api/routes.py): `app/api/routes.py`
- [LangGraph agent](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/agent/graph.py): `app/agent/graph.py`
- [Input sanitization](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/agent/input_sanitizer.py): `app/agent/input_sanitizer.py`

### Clinical capabilities

- [Tool registry](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/registry.py): `app/tools/registry.py`
- [Patient summary](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/patient_summary.py): `app/tools/patient_summary.py`
- [Symptom lookup](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/symptom_lookup.py): `app/tools/symptom_lookup.py`
- [Provider search](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/provider_search.py): `app/tools/provider_search.py`
- [Appointment availability](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/appointment_availability.py): `app/tools/appointment_availability.py`
- [Clinical trials](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/clinical_trials.py): `app/tools/clinical_trials.py`
- [Drug interactions](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/drug_interaction.py): `app/tools/drug_interaction.py`
- [Allergy checks](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/allergy_checker.py): `app/tools/allergy_checker.py`
- [FDA drug safety](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/fda_drug_safety.py): `app/tools/fda_drug_safety.py`
- [Drug recalls](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/drug_recall.py): `app/tools/drug_recall.py`
- [Care gaps](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/care_gap_analysis.py): `app/tools/care_gap_analysis.py`
- [Insurance coverage](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/insurance_coverage.py): `app/tools/insurance_coverage.py`
- [Lab results](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/lab_results.py): `app/tools/lab_results.py`
- [Record vitals](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/tools/record_vitals.py): `app/tools/record_vitals.py`

### EHR and persistence

- [EHR abstraction](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/ehr_provider.py): `app/ehr_provider.py`
- [FHIR client](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/fhir_client.py): `app/fhir_client.py`
- [Mock FHIR client](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/mock_fhir_client.py): `app/mock_fhir_client.py`
- **OpenEMR FHIR**
- **OpenEMR MariaDB**
- [Conversation store](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/database.py): `app/database.py`

### Safety and operations

- [Verification pipeline](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/verification/pipeline.py): `app/verification/pipeline.py`
- [Six verifiers](https://github.com/rohanthomas1202/agentforge-healthcare/tree/master/app/verification): `app/verification`
- [Observability](https://github.com/rohanthomas1202/agentforge-healthcare/blob/master/app/observability.py): `app/observability.py`

### Other components

- **User**

## Connections

- User → Web UI: submits query
- Web UI → Browser API client: uses (evidence: `frontend-v2/js/app.js`)
- Browser API client → API routes: calls API (evidence: `frontend-v2/js/api.js`)
- API routes → LangGraph agent: invokes (evidence: `app/api/routes.py`)
- LangGraph agent → Tool registry: dispatches tools (evidence: `app/agent/graph.py`)
- Tool registry → Patient summary: registers (evidence: `app/tools/registry.py`)
- Tool registry → Symptom lookup: registers (evidence: `app/tools/registry.py`)
- Tool registry → Provider search: registers (evidence: `app/tools/registry.py`)
- Tool registry → Appointment availability: registers (evidence: `app/tools/registry.py`)
- Tool registry → Clinical trials: registers (evidence: `app/tools/registry.py`)
- Tool registry → Drug interactions: registers (evidence: `app/tools/registry.py`)
- Tool registry → Allergy checks: registers (evidence: `app/tools/registry.py`)
- Tool registry → FDA drug safety: registers (evidence: `app/tools/registry.py`)
- Tool registry → Drug recalls: registers (evidence: `app/tools/registry.py`)
- Tool registry → Care gaps: registers (evidence: `app/tools/registry.py`)
- Tool registry → Insurance coverage: registers (evidence: `app/tools/registry.py`)
- Tool registry → Lab results: registers (evidence: `app/tools/registry.py`)
- Tool registry → Record vitals: registers (evidence: `app/tools/registry.py`)
- LangGraph agent → Verification pipeline: verifies response (evidence: `app/agent/graph.py`)
- Verification pipeline → Six verifiers: runs checks (evidence: `app/verification/pipeline.py`)
- LangGraph agent → Observability: records metrics (evidence: `app/agent/graph.py`)
- API routes → Conversation store: reads and writes (evidence: `app/api/routes.py`)
- Provider search → FHIR client: searches FHIR (evidence: `app/tools/provider_search.py`)
- Insurance coverage → OpenEMR MariaDB: queries coverage (evidence: `app/tools/insurance_coverage.py`)
- Insurance coverage → FHIR client: looks up patient (evidence: `app/tools/insurance_coverage.py`)
- FHIR client → EHR abstraction: implements (evidence: `app/fhir_client.py`)
- Mock FHIR client → EHR abstraction: implements (evidence: `app/mock_fhir_client.py`)
- FHIR client → OpenEMR FHIR: requests FHIR data
- LangGraph agent → Input sanitization: sanitizes inputs
- LangGraph agent → User: returns verified response
