# etw-bank/ethiopianhealthcare architecture

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

- Interactive diagram: https://gitdiagram.com/etw-bank/ethiopianhealthcare
- Repository: https://github.com/etw-bank/ethiopianhealthcare

## Overview

This is a multi-facility healthcare API. Its main workflow registers or identifies a patient, issues a facility-specific patient number and encounter, then supports triage, doctor review, lab testing, and prescription handling, including pharmacy dispensing and substitution review. The source index also identifies administration, authentication, Fayda identity, and patient history capabilities. Sampled code confirms several direct database operations and prescription behaviors; other links reflect indexed references or service registration, not inspected method implementations.

Main entry points: [`src/EthiopianHealthcare.Api/Program.cs`](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Program.cs) (API startup), [`src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs) (Prescription lifecycle), [`src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Patients/PatientService%20.cs) (Patient registration), [`src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/DoctorController.cs) (Doctor workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_api_program["API startup<br/>[Program.cs]"]
  node_patient_routes["Patient endpoints"]
  node_doctor_routes["Doctor workflow"]
  node_prescription_routes["Prescription endpoints"]
end

subgraph group_care["Clinical care"]
  node_patient_service["Patient registration<br/>[PatientService .cs]"]
  node_triage["Triage<br/>[TriageService.cs]"]
  node_lab["Lab requests<br/>[LabService.cs]"]
  node_history["Patient history"]
  node_encounter["Encounter record<br/>[Encounter.cs]"]
  node_vitals["Vitals record<br/>[VitalsRecord.cs]"]
  node_lab_request["Lab request entity<br/>[LabRequest.cs]"]
end

subgraph group_meds["Medication"]
  node_pharmacy_routes["Pharmacy endpoints"]
  node_pharmacy_lookup["Pharmacy lookup"]
  node_prescription_service["Prescription lifecycle"]
  node_prescription["Prescription record<br/>[Prescription.cs]"]
  node_prescription_event["Prescription events"]
  node_suggestion["Pharmacy suggestions"]
  node_expiry_worker["Expiry worker"]
  node_expiry_service["Expiry service"]
end

subgraph group_platform["Identity and administration"]
  node_person["Person identity<br/>[Person.cs]"]
  node_patient_number["Facility patient number<br/>[PatientNumber.cs]"]
  node_facility["Healthcare facility<br/>[Facility.cs]"]
  node_auth_routes["Authentication<br/>[AuthController.cs]"]
  node_fayda_routes["Fayda identity<br/>[FaydaController.cs]"]
  node_auth_service["Authentication service<br/>[AuthService .cs]"]
  node_fayda_service["Fayda service"]
  node_admin_routes["Administration<br/>[AdminController.cs]"]
  node_admin_service["Facility administration<br/>[AdminService.cs]"]
  node_facility_admin_routes["Facility admin endpoints"]
  node_facility_admin_service["Facility admin service"]
  node_db[("Healthcare database")]
end

node_staff(("Healthcare staff"))
node_patient(("Patient"))

node_patient -.->|"submits details"| node_patient_routes
node_staff -.->|"registers patient"| node_patient_routes
node_patient_routes -->|"calls"| node_patient_service
node_patient_service -->|"reads and writes"| node_db
node_patient_service -->|"issues"| node_patient_number
node_patient_service -->|"creates"| node_encounter
node_patient_service -->|"registers"| node_person
node_staff -.->|"reviews care"| node_doctor_routes
node_doctor_routes -->|"reads and writes"| node_db
node_doctor_routes -->|"creates lab requests"| node_lab_request
node_doctor_routes -->|"updates status"| node_encounter
node_doctor_routes -->|"reads vitals"| node_vitals
node_api_program -->|"registers service"| node_triage
node_api_program -->|"registers service"| node_lab
node_api_program -->|"registers service"| node_history
node_api_program -->|"registers service"| node_patient_service
node_api_program -->|"registers service"| node_prescription_service
node_api_program -->|"registers service"| node_pharmacy_lookup
node_api_program -->|"registers service"| node_auth_service
node_prescription_routes -->|"calls"| node_prescription_service
node_prescription_service -->|"reads and writes"| node_db
node_prescription_service -->|"creates and updates"| node_prescription
node_prescription_service -->|"records events"| node_prescription_event
node_prescription_service -->|"creates and reviews"| node_suggestion
node_pharmacy_routes -->|"uses lookup"| node_pharmacy_lookup
node_pharmacy_routes -.->|"uses lifecycle"| node_prescription_service
node_api_program -->|"registers worker"| node_expiry_worker
node_expiry_worker -->|"calls expiry"| node_expiry_service
node_auth_routes -.->|"uses authentication"| node_auth_service
node_fayda_routes -.->|"uses identity service"| node_fayda_service
node_admin_routes -.->|"uses administration"| node_admin_service
node_facility_admin_routes -->|"calls"| node_facility_admin_service
node_admin_service -->|"reads and writes"| node_db
node_facility_admin_service -.->|"reads and writes"| node_db

click node_api_program "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Program.cs"
click node_patient_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PatientsController.cs"
click node_doctor_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/DoctorController.cs"
click node_prescription_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PrescriptionsController%20.cs"
click node_patient_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Patients/PatientService%20.cs"
click node_triage "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Triage/TriageService.cs"
click node_lab "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Lab/LabService.cs"
click node_history "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/History/PatientHistoryService%20.cs"
click node_encounter "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/Encounter.cs"
click node_vitals "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/VitalsRecord.cs"
click node_lab_request "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/LabRequest.cs"
click node_person "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Person.cs"
click node_patient_number "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PatientNumber.cs"
click node_facility "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Facility.cs"
click node_auth_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/AuthController.cs"
click node_fayda_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/FaydaController.cs"
click node_auth_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Auth/AuthService%20.cs"
click node_fayda_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Auth/FaydaAuthService.cs"
click node_admin_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/AdminController.cs"
click node_admin_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Admin/AdminService.cs"
click node_facility_admin_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/FacilityAdminController.cs"
click node_facility_admin_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Admin/FacilityAdminService.cs"
click node_pharmacy_routes "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PharmacyController.cs"
click node_pharmacy_lookup "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Pharmacy/PharmacyLookupService.cs"
click node_prescription_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs"
click node_prescription "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Prescription.cs"
click node_prescription_event "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PrescriptionEvent.cs"
click node_suggestion "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PharmacySuggestion.cs"
click node_expiry_worker "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/BackgroundJobs/PrescriptionExpiryWorker.cs"
click node_expiry_service "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionExpiryService.cs"
click node_db "https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/HealthcareDbContext%20.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_api_program,node_patient_routes,node_doctor_routes,node_prescription_routes toneBlue
class node_patient_service,node_triage,node_lab,node_history,node_encounter,node_vitals,node_lab_request toneAmber
class node_pharmacy_routes,node_pharmacy_lookup,node_prescription_service,node_prescription,node_prescription_event,node_suggestion,node_expiry_worker,node_expiry_service toneMint
class node_person,node_patient_number,node_facility,node_auth_routes,node_fayda_routes,node_auth_service,node_fayda_service,node_admin_routes,node_admin_service,node_facility_admin_routes,node_facility_admin_service,node_db toneRose
class node_staff,node_patient toneIndigo
```

## Components

### API

- [API startup](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Program.cs): `src/EthiopianHealthcare.Api/Program.cs`
- [Patient endpoints](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PatientsController.cs): `src/EthiopianHealthcare.Api/Controllers/PatientsController.cs`
- [Doctor workflow](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/DoctorController.cs): `src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`
- [Prescription endpoints](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PrescriptionsController%20.cs): `src/EthiopianHealthcare.Api/Controllers/PrescriptionsController .cs`

### Clinical care

- [Patient registration](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Patients/PatientService%20.cs): `src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`
- [Triage](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Triage/TriageService.cs): `src/EthiopianHealthcare.Infrastructure/Triage/TriageService.cs`
- [Lab requests](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Lab/LabService.cs): `src/EthiopianHealthcare.Infrastructure/Lab/LabService.cs`
- [Patient history](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/History/PatientHistoryService%20.cs): `src/EthiopianHealthcare.Infrastructure/History/PatientHistoryService .cs`
- [Encounter record](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/Encounter.cs): `src/EthiopianHealthcare.Domain/Entities/Encounter.cs`
- [Vitals record](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/VitalsRecord.cs): `src/EthiopianHealthcare.Domain/Entities/VitalsRecord.cs`
- [Lab request entity](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Domain/Entities/LabRequest.cs): `src/EthiopianHealthcare.Domain/Entities/LabRequest.cs`

### Medication

- [Pharmacy endpoints](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/PharmacyController.cs): `src/EthiopianHealthcare.Api/Controllers/PharmacyController.cs`
- [Pharmacy lookup](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Pharmacy/PharmacyLookupService.cs): `src/EthiopianHealthcare.Infrastructure/Pharmacy/PharmacyLookupService.cs`
- [Prescription lifecycle](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs): `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`
- [Prescription record](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Prescription.cs): `src/EthiopianHealthcare.domain/Entities/Prescription.cs`
- [Prescription events](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PrescriptionEvent.cs): `src/EthiopianHealthcare.domain/Entities/PrescriptionEvent.cs`
- [Pharmacy suggestions](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PharmacySuggestion.cs): `src/EthiopianHealthcare.domain/Entities/PharmacySuggestion.cs`
- [Expiry worker](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/BackgroundJobs/PrescriptionExpiryWorker.cs): `src/EthiopianHealthcare.Api/BackgroundJobs/PrescriptionExpiryWorker.cs`
- [Expiry service](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionExpiryService.cs): `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionExpiryService.cs`

### Identity and administration

- [Person identity](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Person.cs): `src/EthiopianHealthcare.domain/Entities/Person.cs`
- [Facility patient number](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/PatientNumber.cs): `src/EthiopianHealthcare.domain/Entities/PatientNumber.cs`
- [Healthcare facility](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.domain/Entities/Facility.cs): `src/EthiopianHealthcare.domain/Entities/Facility.cs`
- [Authentication](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/AuthController.cs): `src/EthiopianHealthcare.Api/Controllers/AuthController.cs`
- [Fayda identity](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/FaydaController.cs): `src/EthiopianHealthcare.Api/Controllers/FaydaController.cs`
- [Authentication service](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Auth/AuthService%20.cs): `src/EthiopianHealthcare.Infrastructure/Auth/AuthService .cs`
- [Fayda service](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Auth/FaydaAuthService.cs): `src/EthiopianHealthcare.Infrastructure/Auth/FaydaAuthService.cs`
- [Administration](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/AdminController.cs): `src/EthiopianHealthcare.Api/Controllers/AdminController.cs`
- [Facility administration](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Admin/AdminService.cs): `src/EthiopianHealthcare.Infrastructure/Admin/AdminService.cs`
- [Facility admin endpoints](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Api/Controllers/FacilityAdminController.cs): `src/EthiopianHealthcare.Api/Controllers/FacilityAdminController.cs`
- [Facility admin service](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/Admin/FacilityAdminService.cs): `src/EthiopianHealthcare.Infrastructure/Admin/FacilityAdminService.cs`
- [Healthcare database](https://github.com/etw-bank/ethiopianhealthcare/blob/master/src/EthiopianHealthcare.Infrastructure/HealthcareDbContext%20.cs): `src/EthiopianHealthcare.Infrastructure/HealthcareDbContext .cs`

### Other components

- **Healthcare staff**
- **Patient**

## Connections

- Patient → Patient endpoints: submits details
- Healthcare staff → Patient endpoints: registers patient
- Patient endpoints → Patient registration: calls (evidence: `src/EthiopianHealthcare.Api/Controllers/PatientsController.cs`)
- Patient registration → Healthcare database: reads and writes (evidence: `src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`)
- Patient registration → Facility patient number: issues (evidence: `src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`)
- Patient registration → Encounter record: creates (evidence: `src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`)
- Patient registration → Person identity: registers (evidence: `src/EthiopianHealthcare.Infrastructure/Patients/PatientService .cs`)
- Healthcare staff → Doctor workflow: reviews care
- Doctor workflow → Healthcare database: reads and writes (evidence: `src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`)
- Doctor workflow → Lab request entity: creates lab requests (evidence: `src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`)
- Doctor workflow → Encounter record: updates status (evidence: `src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`)
- Doctor workflow → Vitals record: reads vitals (evidence: `src/EthiopianHealthcare.Api/Controllers/DoctorController.cs`)
- API startup → Triage: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Lab requests: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Patient history: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Patient registration: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Prescription lifecycle: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Pharmacy lookup: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- API startup → Authentication service: registers service (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- Prescription endpoints → Prescription lifecycle: calls (evidence: `src/EthiopianHealthcare.Api/Controllers/PrescriptionsController .cs`)
- Prescription lifecycle → Healthcare database: reads and writes (evidence: `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`)
- Prescription lifecycle → Prescription record: creates and updates (evidence: `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`)
- Prescription lifecycle → Prescription events: records events (evidence: `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`)
- Prescription lifecycle → Pharmacy suggestions: creates and reviews (evidence: `src/EthiopianHealthcare.Infrastructure/Prescription/PrescriptionService.cs`)
- Pharmacy endpoints → Pharmacy lookup: uses lookup
- Pharmacy endpoints → Prescription lifecycle: uses lifecycle
- API startup → Expiry worker: registers worker (evidence: `src/EthiopianHealthcare.Api/Program.cs`)
- Expiry worker → Expiry service: calls expiry (evidence: `src/EthiopianHealthcare.Api/BackgroundJobs/PrescriptionExpiryWorker.cs`)
- Authentication → Authentication service: uses authentication
- Fayda identity → Fayda service: uses identity service
- Administration → Facility administration: uses administration
- Facility admin endpoints → Facility admin service: calls (evidence: `src/EthiopianHealthcare.Api/Controllers/FacilityAdminController.cs`)
- Facility administration → Healthcare database: reads and writes (evidence: `src/EthiopianHealthcare.Infrastructure/Admin/AdminService.cs`)
- Facility admin service → Healthcare database: reads and writes
