# potlasrisharan/hackshift-sudarshan architecture

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

- Interactive diagram: https://gitdiagram.com/potlasrisharan/hackshift-sudarshan
- Repository: https://github.com/potlasrisharan/hackshift-sudarshan

## Overview

AYUSETU is a connected-care prototype spanning patient intake, clinician review, pharmacy fulfillment, and at-home follow-up, with HER and Vitalis wellness features and research-only CBC review. The documented journey is patient → intake → clinician → pharmacy → home observations and follow-up; deterministic engines support safety and decision-making. Source excerpts verify selected API, engine, and storage connections. Other product branches are included from README claims, but their internal wiring is not inferred where source was not sampled.

Main entry points: [`backend/src/modules/intake/routes.ts`](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/intake/routes.ts) (Intake and triage), [`backend/src/modules/ops/routes.ts`](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/ops/routes.ts) (Clinic operations), [`backend/src/index.ts`](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/index.ts) (Care API), [`backend/src/modules/cbc/routes.ts`](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/cbc/routes.ts) (CBC review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Patient and clinic clients"]
  node_mobile["Mobile app<br/>[App.tsx]"]
  node_clinic_web["Clinic workspace<br/>[App.tsx]"]
  node_web_patient["Patient web<br/>[main.tsx]"]
end

subgraph group_api["API and care workflows"]
  node_api_router["Care API<br/>[index.ts]"]
  node_intake["Intake and triage<br/>[routes.ts]"]
  node_operations["Clinic operations<br/>[routes.ts]"]
  node_home_followup["Home follow-up<br/>[routes.ts]"]
  node_language["Language assistance<br/>[index.ts]"]
end

subgraph group_engines["Clinical decision engines"]
  node_intake_engine["Intake safety rules<br/>[clinicalIntake.ts]"]
  node_decision_engine["Care decision rules<br/>[index.ts]"]
  node_dispensing["Safe dispensing<br/>[dispensing.ts]"]
  node_cbc_parser["CBC normalization<br/>[parser.ts]"]
  node_cbc_inference["CBC scoring<br/>[inference.ts]"]
end

subgraph group_state["Identity and data"]
  node_auth["Patient identity<br/>[routes.ts]"]
  node_tenant_db[("Tenant database<br/>[database.ts]")]
end

subgraph group_wellness["Wellness and research"]
  node_her_routes["HER workflows<br/>[routes.ts]"]
  node_her_cycle["Cycle analysis<br/>[cycle_detector.ts]"]
  node_her_screening["HER screening"]
  node_vitalis["Vitalis healthspan<br/>[routes.ts]"]
  node_cbc["CBC review<br/>[routes.ts]"]
end

node_patient(("Patient"))
node_clinic_staff(("Care team"))

node_patient -->|"provides symptoms"| node_intake
node_intake -->|"queues review"| node_clinic_staff
node_clinic_staff -->|"reviews and prescribes"| node_operations
node_operations -->|"fulfills medicines"| node_patient
node_patient -->|"shares observations"| node_home_followup
node_home_followup -->|"flags follow-up"| node_clinic_staff
node_patient -->|"uses"| node_mobile
node_patient -->|"uses"| node_web_patient
node_clinic_staff -->|"uses"| node_clinic_web
node_api_router -->|"mounts routes"| node_intake
node_api_router -->|"mounts routes"| node_operations
node_intake -->|"checks red flags"| node_intake_engine
node_mobile -->|"runs rules"| node_decision_engine
node_her_routes -->|"analyzes cycles"| node_her_cycle
node_her_screening -->|"uses safety gate"| node_her_cycle
node_vitalis -->|"uses biomarkers"| node_decision_engine
node_cbc -->|"normalizes reports"| node_cbc_parser
node_cbc -->|"scores reports"| node_cbc_inference
node_auth -->|"uses tenant store"| node_tenant_db
node_intake -->|"saves patient"| node_api_router
node_intake -.->|"assists communication"| node_language
node_operations -.->|"checks stock"| node_dispensing

click node_mobile "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/apps/mobile/App.tsx"
click node_clinic_web "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/frontend/website/src/App.tsx"
click node_web_patient "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/frontend/website/src/main.tsx"
click node_api_router "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/index.ts"
click node_intake "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/intake/routes.ts"
click node_operations "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/ops/routes.ts"
click node_home_followup "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/home/routes.ts"
click node_auth "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/patient_auth/routes.ts"
click node_tenant_db "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/database.ts"
click node_intake_engine "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/clinicalIntake.ts"
click node_decision_engine "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/index.ts"
click node_dispensing "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/dispensing.ts"
click node_her_routes "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/her/routes.ts"
click node_her_cycle "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/her/cycle_detector.ts"
click node_her_screening "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/her/screening_engine.ts"
click node_vitalis "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/vitalis/routes.ts"
click node_cbc "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/cbc/routes.ts"
click node_cbc_parser "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/cbc/parser.ts"
click node_cbc_inference "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/cbc/inference.ts"
click node_language "https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/services/lang-gateway/index.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_mobile,node_clinic_web,node_web_patient toneBlue
class node_api_router,node_intake,node_operations,node_home_followup,node_language toneAmber
class node_intake_engine,node_decision_engine,node_dispensing,node_cbc_parser,node_cbc_inference toneMint
class node_auth,node_tenant_db toneRose
class node_her_routes,node_her_cycle,node_her_screening,node_vitalis,node_cbc,node_patient,node_clinic_staff toneIndigo
```

## Components

### Patient and clinic clients

- [Mobile app](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/apps/mobile/App.tsx): `apps/mobile/App.tsx`
- [Clinic workspace](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/frontend/website/src/App.tsx): `frontend/website/src/App.tsx`
- [Patient web](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/frontend/website/src/main.tsx): `frontend/website/src/main.tsx`

### API and care workflows

- [Care API](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Intake and triage](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/intake/routes.ts): `backend/src/modules/intake/routes.ts`
- [Clinic operations](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/ops/routes.ts): `backend/src/modules/ops/routes.ts`
- [Home follow-up](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/home/routes.ts): `backend/src/modules/home/routes.ts`
- [Language assistance](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/services/lang-gateway/index.ts): `services/lang-gateway/index.ts`

### Clinical decision engines

- [Intake safety rules](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/clinicalIntake.ts): `packages/engine/clinicalIntake.ts`
- [Care decision rules](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/index.ts): `packages/engine/index.ts`
- [Safe dispensing](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/dispensing.ts): `packages/engine/dispensing.ts`
- [CBC normalization](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/cbc/parser.ts): `packages/engine/cbc/parser.ts`
- [CBC scoring](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/cbc/inference.ts): `packages/engine/cbc/inference.ts`

### Identity and data

- [Patient identity](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/patient_auth/routes.ts): `backend/src/modules/patient_auth/routes.ts`
- [Tenant database](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/database.ts): `backend/src/database.ts`

### Wellness and research

- [HER workflows](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/her/routes.ts): `backend/src/modules/her/routes.ts`
- [Cycle analysis](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/her/cycle_detector.ts): `packages/engine/her/cycle_detector.ts`
- [HER screening](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/packages/engine/her/screening_engine.ts): `packages/engine/her/screening_engine.ts`
- [Vitalis healthspan](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/vitalis/routes.ts): `backend/src/modules/vitalis/routes.ts`
- [CBC review](https://github.com/potlasrisharan/hackshift-sudarshan/blob/main/backend/src/modules/cbc/routes.ts): `backend/src/modules/cbc/routes.ts`

### Other components

- **Patient**
- **Care team**

## Connections

- Patient → Intake and triage: provides symptoms
- Intake and triage → Care team: queues review
- Care team → Clinic operations: reviews and prescribes
- Clinic operations → Patient: fulfills medicines
- Patient → Home follow-up: shares observations
- Home follow-up → Care team: flags follow-up
- Patient → Mobile app: uses
- Patient → Patient web: uses
- Care team → Clinic workspace: uses
- Care API → Intake and triage: mounts routes (evidence: `backend/src/index.ts`)
- Care API → Clinic operations: mounts routes (evidence: `backend/src/index.ts`)
- Intake and triage → Intake safety rules: checks red flags (evidence: `backend/src/modules/intake/routes.ts`)
- Mobile app → Care decision rules: runs rules (evidence: `apps/mobile/App.tsx`)
- HER workflows → Cycle analysis: analyzes cycles (evidence: `backend/src/modules/her/routes.ts`)
- HER screening → Cycle analysis: uses safety gate (evidence: `packages/engine/her/screening_engine.ts`)
- Vitalis healthspan → Care decision rules: uses biomarkers (evidence: `backend/src/modules/vitalis/routes.ts`)
- CBC review → CBC normalization: normalizes reports (evidence: `backend/src/modules/cbc/routes.ts`)
- CBC review → CBC scoring: scores reports (evidence: `backend/src/modules/cbc/routes.ts`)
- Patient identity → Tenant database: uses tenant store (evidence: `backend/src/modules/patient_auth/routes.ts`)
- Intake and triage → Care API: saves patient (evidence: `backend/src/modules/intake/routes.ts`)
- Intake and triage → Language assistance: assists communication
- Clinic operations → Safe dispensing: checks stock
