# ewceniza9009/emr architecture

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

- Interactive diagram: https://gitdiagram.com/ewceniza9009/emr
- Repository: https://github.com/ewceniza9009/emr

## Overview

Halkyone Clinical OS is a multi-surface palliative-care EMR: clinicians use the web portal to manage patients, visits, triage, outreach and billing, while patients and caregivers have a mobile app. The backend exposes GraphQL and HTTP capabilities over a shared clinical data model. The graph highlights the patient-to-care workflow and major documented capabilities; some frontend-to-backend wiring and unsampled subsystems are represented only as unverified links because their implementation was not excerpted.

Main entry points: [`emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs`](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs) (Data Context), [`emr-mobile-app/src/App.tsx`](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/App.tsx) (Mobile App Router), [`emr-client/src/app/dashboard/page.tsx`](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/page.tsx) (Web Portal), [`emr-client/src/app/dashboard/patients/[id]/page.tsx`](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/%5Bid%5D/page.tsx) (Patient Chart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Clinical Web Portal"]
  node_webapp["Web Portal<br/>[page.tsx]"]
  node_patients["Patient Registry<br/>[page.tsx]"]
  node_profile["Patient Chart<br/>[page.tsx]"]
  node_visit["Guided Visit<br/>[page.tsx]"]
  node_notes["Clinical Notes<br/>[page.tsx]"]
  node_triage["Triage Worklist<br/>[page.tsx]"]
  node_schedule["Scheduling"]
  node_booking["Appointment Booking<br/>[useBookingState.ts]"]
  node_enrollment["Outreach Enrollment"]
  node_billing["Billing<br/>[page.tsx]"]
  node_admin["Admin Portal<br/>[page.tsx]"]
end

subgraph group_mobile["Patient Mobile App"]
  node_mobileapp["Mobile App Router<br/>[App.tsx]"]
  node_mobileauth["Mobile Authentication<br/>[AuthContext.tsx]"]
  node_comfort["Comfort Dashboard"]
  node_carehub["Care Hub<br/>[CareHub.tsx]"]
  node_pharmacy["Pharmacy<br/>[Pharmacy.tsx]"]
end

subgraph group_api["API and Application"]
  node_graphql["GraphQL API<br/>[PatientQuery.cs]"]
  node_authapi["Authentication API<br/>[AuthController.cs]"]
  node_patientquery["Patient Queries"]
  node_triagequery["Triage Queries"]
  node_outreachquery["Outreach Queries"]
  node_appointmentquery["Appointment Queries"]
end

subgraph group_data["Clinical Data"]
  node_dbcontext["Data Context"]
  node_patient["Patient Record<br/>[Patient.cs]"]
  node_database[("Clinical Database")]
end

node_clinician(("Clinical Staff"))

node_clinician -->|"uses"| node_webapp
node_webapp -.->|"opens"| node_patients
node_patients -.->|"views"| node_profile
node_profile -.->|"starts"| node_visit
node_profile -.->|"documents"| node_notes
node_clinician -->|"reviews"| node_triage
node_clinician -->|"schedules"| node_schedule
node_schedule -.->|"books"| node_booking
node_clinician -->|"enrolls"| node_enrollment
node_clinician -.->|"manages"| node_billing
node_clinician -.->|"administers"| node_admin
node_mobileapp -->|"provides"| node_mobileauth
node_mobileapp -->|"routes to"| node_comfort
node_mobileapp -->|"routes to"| node_carehub
node_mobileapp -.->|"routes to"| node_pharmacy
node_graphql -.->|"dispatches"| node_patientquery
node_patientquery -->|"queries"| node_dbcontext
node_triagequery -->|"queries"| node_dbcontext
node_outreachquery -->|"queries"| node_dbcontext
node_appointmentquery -->|"queries"| node_dbcontext
node_authapi -->|"reads and saves"| node_dbcontext
node_dbcontext -->|"models"| node_patient
node_dbcontext -.->|"implemented by"| node_database
node_webapp -.->|"requests data"| node_graphql
node_mobileapp -.->|"requests data"| node_graphql

click node_webapp "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/page.tsx"
click node_patients "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/page.tsx"
click node_profile "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/%5Bid%5D/page.tsx"
click node_visit "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/%5Bid%5D/visit/page.tsx"
click node_notes "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/notes/page.tsx"
click node_triage "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/triage/page.tsx"
click node_schedule "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/SchedulingCalendar/hooks/useSchedulingState.ts"
click node_booking "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/BookingDrawer/hooks/useBookingState.ts"
click node_enrollment "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/EnrollmentDrawer/hooks/useEnrollmentState.ts"
click node_billing "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/billing/page.tsx"
click node_admin "https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/admin/dashboard/page.tsx"
click node_mobileapp "https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/App.tsx"
click node_mobileauth "https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/contexts/AuthContext.tsx"
click node_comfort "https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/ComfortDashboard.tsx"
click node_carehub "https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/CareHub.tsx"
click node_pharmacy "https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/Pharmacy.tsx"
click node_graphql "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Api/GraphQL/Queries/PatientQuery.cs"
click node_authapi "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Api/Controllers/AuthController.cs"
click node_patientquery "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Patients/Queries/GetPatientsQueryHandler.cs"
click node_triagequery "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Clinical/Queries/GetTriageWorklistQueryHandler.cs"
click node_outreachquery "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Outreach/Queries/GetOutreachesQueryHandler.cs"
click node_appointmentquery "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Appointments/Queries/GetAppointmentsByPatientQueryHandler.cs"
click node_dbcontext "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs"
click node_patient "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Domain/Entities/Patient.cs"
click node_database "https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Infrastructure/Data/ApplicationDbContext.cs"

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_webapp,node_patients,node_profile,node_visit,node_notes,node_triage,node_schedule,node_booking,node_enrollment,node_billing,node_admin toneBlue
class node_mobileapp,node_mobileauth,node_comfort,node_carehub,node_pharmacy toneAmber
class node_graphql,node_authapi,node_patientquery,node_triagequery,node_outreachquery,node_appointmentquery toneMint
class node_dbcontext,node_patient,node_database toneRose
class node_clinician toneIndigo
```

## Components

### Clinical Web Portal

- [Web Portal](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/page.tsx): `emr-client/src/app/dashboard/page.tsx`
- [Patient Registry](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/page.tsx): `emr-client/src/app/dashboard/patients/page.tsx`
- [Patient Chart](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/%5Bid%5D/page.tsx): `emr-client/src/app/dashboard/patients/[id]/page.tsx`
- [Guided Visit](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/patients/%5Bid%5D/visit/page.tsx): `emr-client/src/app/dashboard/patients/[id]/visit/page.tsx`
- [Clinical Notes](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/notes/page.tsx): `emr-client/src/app/dashboard/notes/page.tsx`
- [Triage Worklist](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/triage/page.tsx): `emr-client/src/app/dashboard/triage/page.tsx`
- [Scheduling](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/SchedulingCalendar/hooks/useSchedulingState.ts): `emr-client/src/components/SchedulingCalendar/hooks/useSchedulingState.ts`
- [Appointment Booking](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/BookingDrawer/hooks/useBookingState.ts): `emr-client/src/components/BookingDrawer/hooks/useBookingState.ts`
- [Outreach Enrollment](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/components/EnrollmentDrawer/hooks/useEnrollmentState.ts): `emr-client/src/components/EnrollmentDrawer/hooks/useEnrollmentState.ts`
- [Billing](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/dashboard/billing/page.tsx): `emr-client/src/app/dashboard/billing/page.tsx`
- [Admin Portal](https://github.com/ewceniza9009/emr/blob/main/emr-client/src/app/admin/dashboard/page.tsx): `emr-client/src/app/admin/dashboard/page.tsx`

### Patient Mobile App

- [Mobile App Router](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/App.tsx): `emr-mobile-app/src/App.tsx`
- [Mobile Authentication](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/contexts/AuthContext.tsx): `emr-mobile-app/src/contexts/AuthContext.tsx`
- [Comfort Dashboard](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/ComfortDashboard.tsx): `emr-mobile-app/src/pages/ComfortDashboard.tsx`
- [Care Hub](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/CareHub.tsx): `emr-mobile-app/src/pages/CareHub.tsx`
- [Pharmacy](https://github.com/ewceniza9009/emr/blob/main/emr-mobile-app/src/pages/Pharmacy.tsx): `emr-mobile-app/src/pages/Pharmacy.tsx`

### API and Application

- [GraphQL API](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Api/GraphQL/Queries/PatientQuery.cs): `emr-server/src/Api/GraphQL/Queries/PatientQuery.cs`
- [Authentication API](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Api/Controllers/AuthController.cs): `emr-server/src/Api/Controllers/AuthController.cs`
- [Patient Queries](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Patients/Queries/GetPatientsQueryHandler.cs): `emr-server/src/Application/Patients/Queries/GetPatientsQueryHandler.cs`
- [Triage Queries](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Clinical/Queries/GetTriageWorklistQueryHandler.cs): `emr-server/src/Application/Clinical/Queries/GetTriageWorklistQueryHandler.cs`
- [Outreach Queries](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Outreach/Queries/GetOutreachesQueryHandler.cs): `emr-server/src/Application/Outreach/Queries/GetOutreachesQueryHandler.cs`
- [Appointment Queries](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Appointments/Queries/GetAppointmentsByPatientQueryHandler.cs): `emr-server/src/Application/Appointments/Queries/GetAppointmentsByPatientQueryHandler.cs`

### Clinical Data

- [Data Context](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs): `emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs`
- [Patient Record](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Domain/Entities/Patient.cs): `emr-server/src/Domain/Entities/Patient.cs`
- [Clinical Database](https://github.com/ewceniza9009/emr/blob/main/emr-server/src/Infrastructure/Data/ApplicationDbContext.cs): `emr-server/src/Infrastructure/Data/ApplicationDbContext.cs`

### Other components

- **Clinical Staff**

## Connections

- Clinical Staff → Web Portal: uses (evidence: `README.md`)
- Web Portal → Patient Registry: opens
- Patient Registry → Patient Chart: views
- Patient Chart → Guided Visit: starts
- Patient Chart → Clinical Notes: documents
- Clinical Staff → Triage Worklist: reviews (evidence: `README.md`)
- Clinical Staff → Scheduling: schedules (evidence: `README.md`)
- Scheduling → Appointment Booking: books
- Clinical Staff → Outreach Enrollment: enrolls (evidence: `README.md`)
- Clinical Staff → Billing: manages
- Clinical Staff → Admin Portal: administers
- Mobile App Router → Mobile Authentication: provides (evidence: `emr-mobile-app/src/App.tsx`)
- Mobile App Router → Comfort Dashboard: routes to (evidence: `emr-mobile-app/src/App.tsx`)
- Mobile App Router → Care Hub: routes to (evidence: `emr-mobile-app/src/App.tsx`)
- Mobile App Router → Pharmacy: routes to (evidence: `emr-mobile-app/src/App.tsx`)
- GraphQL API → Patient Queries: dispatches
- Patient Queries → Data Context: queries (evidence: `emr-server/src/Application/Patients/Queries/GetPatientsQueryHandler.cs`)
- Triage Queries → Data Context: queries (evidence: `emr-server/src/Application/Clinical/Queries/GetTriageWorklistQueryHandler.cs`)
- Outreach Queries → Data Context: queries (evidence: `emr-server/src/Application/Outreach/Queries/GetOutreachesQueryHandler.cs`)
- Appointment Queries → Data Context: queries (evidence: `emr-server/src/Application/Appointments/Queries/GetAppointmentsByPatientQueryHandler.cs`)
- Authentication API → Data Context: reads and saves (evidence: `emr-server/src/Api/Controllers/AuthController.cs`)
- Data Context → Patient Record: models (evidence: `emr-server/src/Application/Common/Interfaces/IApplicationDbContext.cs`)
- Data Context → Clinical Database: implemented by
- Web Portal → GraphQL API: requests data
- Mobile App Router → GraphQL API: requests data
