# rmsofficialsyt/hms architecture

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

- Interactive diagram: https://gitdiagram.com/rmsofficialsyt/hms
- Repository: https://github.com/rmsofficialsyt/hms

## Overview

This repository is an AI-assisted software-development guideline package, not a single hospital-management application. Its primary workflow is to define product requirements, approve versioned feature specifications, then guide changes through test-first implementation and review. It also provides agent policies and operational playbooks, plus a local project dashboard. A healthcare frontend/backend scaffold is present in the tree; the excerpts show patient registration/search and OPD scheduling/vitals, but do not establish that every listed API capability is implemented. Some subsystem links are therefore omitted.

Main entry points: [`backend/src/interfaces/http/controllers/patient.controller.ts`](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/patient.controller.ts) (Patient workflow), [`docs/features`](https://github.com/rmsofficialsyt/hms/tree/main/docs/features) (Feature specifications), [`backend/src/interfaces/http/controllers/opd.controller.ts`](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/opd.controller.ts) (OPD workflow), [`backend/src/domain/patients/patient.entity.ts`](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/patient.entity.ts) (Patient domain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Guidance and governance"]
  node_product_docs["Product definition<br/>[product.md]"]
  node_feature_specs["Feature specifications"]
  node_agent_rules["Agent governance<br/>[.agents]"]
  node_playbooks["Operation playbooks"]
end

subgraph group_workflow["Change workflow"]
  node_change_control["Change control"]
  node_approvals["Approvals"]
  node_tests_contract["Test-first gates<br/>[code-testing.md]"]
end

subgraph group_dashboard["Project dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[index.html]"]
  node_dashboard_server["Local dashboard server<br/>[server.js]"]
  node_dashboard_parser["Governance parser<br/>[parser.js]"]
end

subgraph group_hms["Healthcare scaffold"]
  node_hms_ui["Hospital dashboard<br/>[App.tsx]"]
  node_patient_form["Patient registration UI"]
  node_vitals_form["Vitals UI"]
  node_api_service["Frontend API service<br/>[api.ts]"]
  node_api_app["HTTP application<br/>[app.ts]"]
  node_patient_routes["Patient routes<br/>[patient.routes.ts]"]
  node_patient_controller["Patient workflow"]
  node_patient_entity["Patient domain<br/>[patient.entity.ts]"]
  node_patient_identity["UHID generation<br/>[uhid-generator.ts]"]
  node_patient_privacy["PHI protection<br/>[encryption.ts]"]
  node_patient_schema["Registration validation<br/>[patient.schema.ts]"]
  node_patient_repository[("Patient repository")]
  node_opd_controller["OPD workflow<br/>[opd.controller.ts]"]
  node_opd_roster["Roster generation"]
  node_opd_tokens["Appointment tokens<br/>[token-generator.ts]"]
  node_opd_vitals_schema["Vitals validation"]
  node_auth_controller["Authentication workflow<br/>[auth.controller.ts]"]
  node_jwt_service["JWT service<br/>[jwt.service.ts]"]
end

node_engineer(("Engineer"))

node_engineer -->|"defines product"| node_product_docs
node_engineer -->|"specifies features"| node_feature_specs
node_feature_specs -->|"requires approval"| node_approvals
node_engineer -->|"submits change"| node_change_control
node_change_control -->|"updates specification"| node_feature_specs
node_feature_specs -->|"guides test-first work"| node_tests_contract
node_agent_rules -.->|"supports agent work"| node_playbooks
node_dashboard_server -->|"queries state"| node_dashboard_parser
node_dashboard_server -.->|"serves assets"| node_dashboard_ui
node_hms_ui -->|"renders"| node_patient_form
node_hms_ui -->|"renders"| node_vitals_form
node_api_app -->|"mounts routes"| node_patient_routes
node_patient_routes -->|"dispatches requests"| node_patient_controller
node_patient_controller -->|"creates patients"| node_patient_entity
node_patient_controller -->|"validates input"| node_patient_schema
node_patient_controller -->|"hashes and decrypts"| node_patient_privacy
node_patient_controller -->|"reads and saves"| node_patient_repository
node_patient_entity -->|"generates UHID"| node_patient_identity
node_patient_entity -->|"encrypts contact"| node_patient_privacy
node_opd_controller -->|"generates slots"| node_opd_roster
node_opd_controller -->|"allocates tokens"| node_opd_tokens
node_opd_controller -->|"validates vitals"| node_opd_vitals_schema
node_auth_controller -->|"uses token service"| node_jwt_service

click node_product_docs "https://github.com/rmsofficialsyt/hms/blob/main/docs/product.md"
click node_feature_specs "https://github.com/rmsofficialsyt/hms/tree/main/docs/features"
click node_agent_rules "https://github.com/rmsofficialsyt/hms/tree/main/.agents"
click node_playbooks "https://github.com/rmsofficialsyt/hms/tree/main/playbooks"
click node_change_control "https://github.com/rmsofficialsyt/hms/tree/main/docs/changes"
click node_approvals "https://github.com/rmsofficialsyt/hms/tree/main/docs/approvals"
click node_tests_contract "https://github.com/rmsofficialsyt/hms/blob/main/docs/code-testing.md"
click node_dashboard_ui "https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/index.html"
click node_dashboard_server "https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/server.js"
click node_dashboard_parser "https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/parser.js"
click node_hms_ui "https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/App.tsx"
click node_patient_form "https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/components/patients/RegisterPatientModal.tsx"
click node_vitals_form "https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/components/opd/RecordVitalsModal.tsx"
click node_api_service "https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/services/api.ts"
click node_api_app "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/app.ts"
click node_patient_routes "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/routes/patient.routes.ts"
click node_patient_controller "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/patient.controller.ts"
click node_patient_entity "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/patient.entity.ts"
click node_patient_identity "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/uhid-generator.ts"
click node_patient_privacy "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/encryption.ts"
click node_patient_schema "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/patient.schema.ts"
click node_patient_repository "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/infrastructure/repositories/patient.repository.ts"
click node_opd_controller "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/opd.controller.ts"
click node_opd_roster "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/roster-generator.ts"
click node_opd_tokens "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/token-generator.ts"
click node_opd_vitals_schema "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/triage-vitals.schema.ts"
click node_auth_controller "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/auth.controller.ts"
click node_jwt_service "https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/auth/jwt.service.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_product_docs,node_feature_specs,node_agent_rules,node_playbooks toneBlue
class node_change_control,node_approvals,node_tests_contract toneAmber
class node_dashboard_ui,node_dashboard_server,node_dashboard_parser toneMint
class node_hms_ui,node_patient_form,node_vitals_form,node_api_service,node_api_app,node_patient_routes,node_patient_controller,node_patient_entity,node_patient_identity,node_patient_privacy,node_patient_schema,node_patient_repository,node_opd_controller,node_opd_roster,node_opd_tokens,node_opd_vitals_schema,node_auth_controller,node_jwt_service toneRose
class node_engineer toneIndigo
```

## Components

### Guidance and governance

- [Product definition](https://github.com/rmsofficialsyt/hms/blob/main/docs/product.md): `docs/product.md`
- [Feature specifications](https://github.com/rmsofficialsyt/hms/tree/main/docs/features): `docs/features`
- [Agent governance](https://github.com/rmsofficialsyt/hms/tree/main/.agents): `.agents`
- [Operation playbooks](https://github.com/rmsofficialsyt/hms/tree/main/playbooks): `playbooks`

### Change workflow

- [Change control](https://github.com/rmsofficialsyt/hms/tree/main/docs/changes): `docs/changes`
- [Approvals](https://github.com/rmsofficialsyt/hms/tree/main/docs/approvals): `docs/approvals`
- [Test-first gates](https://github.com/rmsofficialsyt/hms/blob/main/docs/code-testing.md): `docs/code-testing.md`

### Project dashboard

- [Dashboard UI](https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/index.html): `Project-Manager-Dashboard/index.html`
- [Local dashboard server](https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/server.js): `Project-Manager-Dashboard/server.js`
- [Governance parser](https://github.com/rmsofficialsyt/hms/blob/main/Project-Manager-Dashboard/parser.js): `Project-Manager-Dashboard/parser.js`

### Healthcare scaffold

- [Hospital dashboard](https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Patient registration UI](https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/components/patients/RegisterPatientModal.tsx): `frontend/src/components/patients/RegisterPatientModal.tsx`
- [Vitals UI](https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/components/opd/RecordVitalsModal.tsx): `frontend/src/components/opd/RecordVitalsModal.tsx`
- [Frontend API service](https://github.com/rmsofficialsyt/hms/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [HTTP application](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Patient routes](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/routes/patient.routes.ts): `backend/src/interfaces/http/routes/patient.routes.ts`
- [Patient workflow](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/patient.controller.ts): `backend/src/interfaces/http/controllers/patient.controller.ts`
- [Patient domain](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/patient.entity.ts): `backend/src/domain/patients/patient.entity.ts`
- [UHID generation](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/uhid-generator.ts): `backend/src/domain/patients/uhid-generator.ts`
- [PHI protection](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/encryption.ts): `backend/src/domain/patients/encryption.ts`
- [Registration validation](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/patients/patient.schema.ts): `backend/src/domain/patients/patient.schema.ts`
- [Patient repository](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/infrastructure/repositories/patient.repository.ts): `backend/src/infrastructure/repositories/patient.repository.ts`
- [OPD workflow](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/opd.controller.ts): `backend/src/interfaces/http/controllers/opd.controller.ts`
- [Roster generation](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/roster-generator.ts): `backend/src/domain/opd/roster-generator.ts`
- [Appointment tokens](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/token-generator.ts): `backend/src/domain/opd/token-generator.ts`
- [Vitals validation](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/opd/triage-vitals.schema.ts): `backend/src/domain/opd/triage-vitals.schema.ts`
- [Authentication workflow](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/interfaces/http/controllers/auth.controller.ts): `backend/src/interfaces/http/controllers/auth.controller.ts`
- [JWT service](https://github.com/rmsofficialsyt/hms/blob/main/backend/src/domain/auth/jwt.service.ts): `backend/src/domain/auth/jwt.service.ts`

### Other components

- **Engineer**

## Connections

- Engineer → Product definition: defines product (evidence: `README.md`)
- Engineer → Feature specifications: specifies features (evidence: `README.md`)
- Feature specifications → Approvals: requires approval (evidence: `README.md`)
- Engineer → Change control: submits change (evidence: `README.md`)
- Change control → Feature specifications: updates specification (evidence: `README.md`)
- Feature specifications → Test-first gates: guides test-first work (evidence: `README.md`)
- Agent governance → Operation playbooks: supports agent work
- Local dashboard server → Governance parser: queries state (evidence: `Project-Manager-Dashboard/server.js`)
- Local dashboard server → Dashboard UI: serves assets
- Hospital dashboard → Patient registration UI: renders (evidence: `frontend/src/App.tsx`)
- Hospital dashboard → Vitals UI: renders (evidence: `frontend/src/App.tsx`)
- HTTP application → Patient routes: mounts routes (evidence: `backend/src/app.ts`)
- Patient routes → Patient workflow: dispatches requests (evidence: `backend/src/interfaces/http/routes/patient.routes.ts`)
- Patient workflow → Patient domain: creates patients (evidence: `backend/src/interfaces/http/controllers/patient.controller.ts`)
- Patient workflow → Registration validation: validates input (evidence: `backend/src/interfaces/http/controllers/patient.controller.ts`)
- Patient workflow → PHI protection: hashes and decrypts (evidence: `backend/src/interfaces/http/controllers/patient.controller.ts`)
- Patient workflow → Patient repository: reads and saves (evidence: `backend/src/interfaces/http/controllers/patient.controller.ts`)
- Patient domain → UHID generation: generates UHID (evidence: `backend/src/domain/patients/patient.entity.ts`)
- Patient domain → PHI protection: encrypts contact (evidence: `backend/src/domain/patients/patient.entity.ts`)
- OPD workflow → Roster generation: generates slots (evidence: `backend/src/interfaces/http/controllers/opd.controller.ts`)
- OPD workflow → Appointment tokens: allocates tokens (evidence: `backend/src/interfaces/http/controllers/opd.controller.ts`)
- OPD workflow → Vitals validation: validates vitals (evidence: `backend/src/interfaces/http/controllers/opd.controller.ts`)
- Authentication workflow → JWT service: uses token service (evidence: `backend/src/interfaces/http/controllers/auth.controller.ts`)
