# rahul-gits/longitudinal-health-intelligence-engine architecture

> Architecture diagram of the GitHub repository rahul-gits/longitudinal-health-intelligence-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahul-gits/longitudinal-health-intelligence-engine
- Repository: https://github.com/rahul-gits/longitudinal-health-intelligence-engine

## Overview

Heal Engine is a clinical decision-support application for complex, longitudinal care. Patients and clinicians use the portal and workspaces to review health history, screening, risks, evidence, and care options; clinicians retain approval authority, and follow-up supports ongoing monitoring. The README describes distinct ingestion, patient-state, orchestration, deterministic safety, evidence, and review stages, plus virtual-doctor, reporting, and governance capabilities. The tree supports those module paths, but sampled excerpts do not establish all runtime wiring; edges therefore show only documented architecture or evidenced API calls, not a complete implementation trace.

Main entry points: [`server/routes/workflowRoutes.ts`](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/workflowRoutes.ts) (Workflow API), [`src/engine/clinicalOrchestrator.ts`](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/clinicalOrchestrator.ts) (Clinical Orchestrator), [`src/services/apiClient.ts`](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/services/apiClient.ts) (API Client), [`server/routes/patientRoutes.ts`](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/patientRoutes.ts) (Patient API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Experience"]
  node_app["Application Shell<br/>[App.tsx]"]
  node_patient_portal["Patient Portal"]
  node_clinical_workspaces["Clinical Workspaces<br/>[CommandCenter.tsx]"]
  node_virtual_doctor_ui["Virtual Doctor"]
  node_follow_up["Care Follow-up"]
end

subgraph group_api["API and Security"]
  node_api_client["API Client<br/>[apiClient.ts]"]
  node_server["Express Server<br/>[index.ts]"]
  node_patient_api["Patient API<br/>[patientRoutes.ts]"]
  node_workflow_api["Workflow API<br/>[workflowRoutes.ts]"]
  node_security["Access Controls"]
end

subgraph group_clinical["Clinical Decision Support"]
  node_orchestrator["Clinical Orchestrator"]
  node_screening_engine["Screening Engine"]
  node_workflow_engine["Care Workflow"]
  node_safety["Safety Gate<br/>[safetyEngine.ts]"]
  node_conference["Specialist Consensus"]
end

subgraph group_state_evidence["State and Evidence"]
  node_patient_state["Patient State"]
  node_evidence["Evidence Intelligence"]
  node_fhir["FHIR Normalization"]
  node_vector_store[("Vector Search<br/>[vectorDbService.ts]")]
end

subgraph group_operations["Governance and Operations"]
  node_reporting["Reports and FHIR<br/>[reportRoutes.ts]"]
  node_audit["Audit Trail<br/>[auditRoutes.ts]"]
  node_governance["AI Governance"]
  node_session_service[("Session Records")]
end

node_patient(("Patient"))
node_clinician(("Clinician"))

node_patient -->|"uses"| node_patient_portal
node_clinician -->|"reviews"| node_clinical_workspaces
node_app -->|"renders"| node_patient_portal
node_app -->|"renders"| node_clinical_workspaces
node_app -->|"renders"| node_virtual_doctor_ui
node_app -->|"renders"| node_follow_up
node_patient_portal -->|"requests data"| node_api_client
node_clinical_workspaces -->|"requests data"| node_api_client
node_virtual_doctor_ui -->|"requests sessions"| node_api_client
node_follow_up -->|"requests plans"| node_api_client
node_api_client -->|"calls patient endpoints"| node_patient_api
node_api_client -->|"runs workflow"| node_workflow_api
node_server -->|"mounts routes"| node_patient_api
node_server -->|"mounts routes"| node_workflow_api
node_patient_api -->|"enforces isolation"| node_security
node_patient_api -.->|"serves patient state"| node_patient_state
node_workflow_api -.->|"dispatches workflow"| node_orchestrator
node_orchestrator -.->|"coordinates screening"| node_screening_engine
node_orchestrator -.->|"coordinates care"| node_workflow_engine
node_orchestrator -.->|"checks constraints"| node_safety
node_orchestrator -.->|"coordinates specialists"| node_conference
node_orchestrator -.->|"uses longitudinal state"| node_patient_state
node_orchestrator -.->|"retrieves evidence"| node_evidence
node_workflow_api -->|"searches vectors"| node_vector_store
node_workflow_api -->|"normalizes FHIR"| node_fhir
node_workflow_api -->|"records turns"| node_session_service
node_workflow_api -->|"serves registry"| node_governance
node_workflow_api -->|"exposes audit trail"| node_audit
node_workflow_api -->|"exposes reports"| node_reporting
node_patient_api -.->|"records decisions"| node_audit

click node_app "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/App.tsx"
click node_patient_portal "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/PatientPortalDashboard.tsx"
click node_clinical_workspaces "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/CommandCenter.tsx"
click node_virtual_doctor_ui "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/VirtualDoctorScreeningWorkspace.tsx"
click node_follow_up "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/CareFollowUpWorkspace.tsx"
click node_api_client "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/services/apiClient.ts"
click node_server "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/index.ts"
click node_patient_api "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/patientRoutes.ts"
click node_workflow_api "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/workflowRoutes.ts"
click node_security "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/middleware/securityRbacMiddleware.ts"
click node_orchestrator "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/clinicalOrchestrator.ts"
click node_screening_engine "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/virtualDoctorScreeningEngine.ts"
click node_workflow_engine "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/endToEndWorkflowEngine.ts"
click node_safety "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/safetyEngine.ts"
click node_conference "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/clinicalConferenceEngine.ts"
click node_patient_state "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/patientStateEngine.ts"
click node_evidence "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/evidenceIntelligenceEngine.ts"
click node_fhir "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/fhirNormalizationService.ts"
click node_vector_store "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/vectorDbService.ts"
click node_reporting "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/reportRoutes.ts"
click node_audit "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/auditRoutes.ts"
click node_governance "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/aiGovernanceService.ts"
click node_session_service "https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/virtualDoctorSessionService.ts"

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_patient_portal,node_clinical_workspaces,node_virtual_doctor_ui,node_follow_up toneBlue
class node_api_client,node_server,node_patient_api,node_workflow_api,node_security toneAmber
class node_orchestrator,node_screening_engine,node_workflow_engine,node_safety,node_conference toneMint
class node_patient_state,node_evidence,node_fhir,node_vector_store toneRose
class node_reporting,node_audit,node_governance,node_session_service,node_patient,node_clinician toneIndigo
```

## Components

### Experience

- [Application Shell](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/App.tsx): `src/App.tsx`
- [Patient Portal](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/PatientPortalDashboard.tsx): `src/components/PatientPortalDashboard.tsx`
- [Clinical Workspaces](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/CommandCenter.tsx): `src/components/CommandCenter.tsx`
- [Virtual Doctor](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/VirtualDoctorScreeningWorkspace.tsx): `src/components/VirtualDoctorScreeningWorkspace.tsx`
- [Care Follow-up](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/components/CareFollowUpWorkspace.tsx): `src/components/CareFollowUpWorkspace.tsx`

### API and Security

- [API Client](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/services/apiClient.ts): `src/services/apiClient.ts`
- [Express Server](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/index.ts): `server/index.ts`
- [Patient API](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/patientRoutes.ts): `server/routes/patientRoutes.ts`
- [Workflow API](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/workflowRoutes.ts): `server/routes/workflowRoutes.ts`
- [Access Controls](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/middleware/securityRbacMiddleware.ts): `server/middleware/securityRbacMiddleware.ts`

### Clinical Decision Support

- [Clinical Orchestrator](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/clinicalOrchestrator.ts): `src/engine/clinicalOrchestrator.ts`
- [Screening Engine](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/virtualDoctorScreeningEngine.ts): `src/engine/virtualDoctorScreeningEngine.ts`
- [Care Workflow](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/endToEndWorkflowEngine.ts): `src/engine/endToEndWorkflowEngine.ts`
- [Safety Gate](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/safetyEngine.ts): `src/engine/safetyEngine.ts`
- [Specialist Consensus](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/clinicalConferenceEngine.ts): `src/engine/clinicalConferenceEngine.ts`

### State and Evidence

- [Patient State](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/patientStateEngine.ts): `src/engine/patientStateEngine.ts`
- [Evidence Intelligence](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/src/engine/evidenceIntelligenceEngine.ts): `src/engine/evidenceIntelligenceEngine.ts`
- [FHIR Normalization](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/fhirNormalizationService.ts): `server/services/fhirNormalizationService.ts`
- [Vector Search](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/vectorDbService.ts): `server/services/vectorDbService.ts`

### Governance and Operations

- [Reports and FHIR](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/reportRoutes.ts): `server/routes/reportRoutes.ts`
- [Audit Trail](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/routes/auditRoutes.ts): `server/routes/auditRoutes.ts`
- [AI Governance](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/aiGovernanceService.ts): `server/services/aiGovernanceService.ts`
- [Session Records](https://github.com/rahul-gits/longitudinal-health-intelligence-engine/blob/main/server/services/virtualDoctorSessionService.ts): `server/services/virtualDoctorSessionService.ts`

### Other components

- **Patient**
- **Clinician**

## Connections

- Patient → Patient Portal: uses
- Clinician → Clinical Workspaces: reviews
- Application Shell → Patient Portal: renders
- Application Shell → Clinical Workspaces: renders
- Application Shell → Virtual Doctor: renders
- Application Shell → Care Follow-up: renders
- Patient Portal → API Client: requests data
- Clinical Workspaces → API Client: requests data
- Virtual Doctor → API Client: requests sessions
- Care Follow-up → API Client: requests plans
- API Client → Patient API: calls patient endpoints
- API Client → Workflow API: runs workflow
- Express Server → Patient API: mounts routes
- Express Server → Workflow API: mounts routes
- Patient API → Access Controls: enforces isolation
- Patient API → Patient State: serves patient state
- Workflow API → Clinical Orchestrator: dispatches workflow
- Clinical Orchestrator → Screening Engine: coordinates screening
- Clinical Orchestrator → Care Workflow: coordinates care
- Clinical Orchestrator → Safety Gate: checks constraints
- Clinical Orchestrator → Specialist Consensus: coordinates specialists
- Clinical Orchestrator → Patient State: uses longitudinal state
- Clinical Orchestrator → Evidence Intelligence: retrieves evidence
- Workflow API → Vector Search: searches vectors
- Workflow API → FHIR Normalization: normalizes FHIR
- Workflow API → Session Records: records turns
- Workflow API → AI Governance: serves registry
- Workflow API → Audit Trail: exposes audit trail
- Workflow API → Reports and FHIR: exposes reports
- Patient API → Audit Trail: records decisions
