# strategic-information-department-cidrz/yathu-platform-api architecture

> Architecture diagram of the GitHub repository strategic-information-department-cidrz/yathu-platform-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/strategic-information-department-cidrz/yathu-platform-api
- Repository: https://github.com/strategic-information-department-cidrz/yathu-platform-api

## Overview

Yathu Platform is a REST API for managing TB patient care and its supporting facility, user, and treatment-regimen data. The central workflow is facility staff recording a patient and their baseline assessment, treatment episodes and outcomes, and follow-up visits; administrators maintain reference data and users, while dashboards and reports expose operational data. The README documents a DB → repository → service → controller layering. Several implementations were not sampled, so links below follow that documented architecture without asserting unverified internal calls.

Main entry points: [`yathu-platform.Api/Program.cs`](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Program.cs) (REST API), [`yathu-platform.Application/Services`](https://github.com/strategic-information-department-cidrz/yathu-platform-api/tree/main/yathu-platform.Application/Services) (Domain services), [`yathu-platform.Api/Controllers/AccountController.cs`](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/AccountController.cs) (Account endpoints), [`yathu-platform.Application/Services/AccountService.cs`](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Application/Services/AccountService.cs) (Account service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api["REST API<br/>[Program.cs]"]
  node_accountctrl["Account endpoints"]
  node_accountsvc["Account service<br/>[AccountService.cs]"]
  node_email["Email delivery<br/>[IEmailSender.cs]"]
end

subgraph group_care["Patient care"]
  node_patients["Patient records"]
  node_baseline["Baseline assessment"]
  node_treatment["Treatment episodes"]
  node_visits["Follow-up visits"]
end

subgraph group_admin["Administration"]
  node_users["User management<br/>[UsersController.cs]"]
  node_locations["Facility geography"]
  node_regimens["Regimen catalogue"]
end

subgraph group_insights["Reporting and transfers"]
  node_transfers["Patient transfers"]
  node_dashboard["Dashboard"]
  node_reports["Reports and checks"]
end

subgraph group_data["Application data"]
  node_services["Domain services<br/>[Services]"]
  node_repos["Repository layer"]
  node_userrepo["Identity repository<br/>[UserRepository.cs]"]
  node_db[("Platform database<br/>[AppDbContext.cs]")]
end

node_staff(("Facility staff"))
node_adminactor(("Administrators"))
node_legacy[("Legacy register")]

node_staff -->|"calls"| node_api
node_adminactor -->|"calls"| node_api
node_api -->|"routes"| node_accountctrl
node_api -->|"routes"| node_patients
node_api -->|"routes"| node_baseline
node_api -->|"routes"| node_treatment
node_api -->|"routes"| node_visits
node_api -->|"routes"| node_transfers
node_api -->|"routes"| node_users
node_api -->|"routes"| node_locations
node_api -->|"routes"| node_regimens
node_api -->|"routes"| node_dashboard
node_api -->|"routes"| node_reports
node_accountctrl -->|"calls"| node_accountsvc
node_accountsvc -->|"sends OTP"| node_email
node_patients -->|"calls"| node_services
node_baseline -->|"calls"| node_services
node_treatment -->|"calls"| node_services
node_visits -->|"calls"| node_services
node_transfers -->|"calls"| node_services
node_users -->|"calls"| node_services
node_locations -->|"calls"| node_services
node_regimens -->|"calls"| node_services
node_dashboard -->|"calls"| node_services
node_reports -->|"calls"| node_services
node_services -->|"uses"| node_repos
node_userrepo -->|"reads and writes"| node_db
node_repos -->|"persists data"| node_db
node_api -.->|"ports register"| node_legacy

click node_api "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Program.cs"
click node_accountctrl "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/AccountController.cs"
click node_accountsvc "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Application/Services/AccountService.cs"
click node_email "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Application/Interfaces/ServiceInterfaces/IEmailSender.cs"
click node_patients "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientsController.cs"
click node_baseline "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientBaselineController.cs"
click node_treatment "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientTreatmentController.cs"
click node_visits "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientVisitsController.cs"
click node_transfers "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientTransfersController.cs"
click node_users "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/UsersController.cs"
click node_locations "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/LocationsController.cs"
click node_regimens "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/RegimensController.cs"
click node_dashboard "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/DashboardController.cs"
click node_reports "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/ReportsController.cs"
click node_services "https://github.com/strategic-information-department-cidrz/yathu-platform-api/tree/main/yathu-platform.Application/Services"
click node_repos "https://github.com/strategic-information-department-cidrz/yathu-platform-api/tree/main/yathu-platform.Application/Interfaces/RepositoryInterfaces"
click node_userrepo "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Infrastructure/Repositories/UserRepository.cs"
click node_db "https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Infrastructure/Persistence/AppDbContext.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,node_accountctrl,node_accountsvc,node_email toneBlue
class node_patients,node_baseline,node_treatment,node_visits,node_legacy toneAmber
class node_users,node_locations,node_regimens toneMint
class node_transfers,node_dashboard,node_reports toneRose
class node_services,node_repos,node_userrepo,node_db,node_staff,node_adminactor toneIndigo
```

## Components

### API and access

- [REST API](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Program.cs): `yathu-platform.Api/Program.cs`
- [Account endpoints](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/AccountController.cs): `yathu-platform.Api/Controllers/AccountController.cs`
- [Account service](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Application/Services/AccountService.cs): `yathu-platform.Application/Services/AccountService.cs`
- [Email delivery](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Application/Interfaces/ServiceInterfaces/IEmailSender.cs): `yathu-platform.Application/Interfaces/ServiceInterfaces/IEmailSender.cs`

### Patient care

- [Patient records](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientsController.cs): `yathu-platform.Api/Controllers/PatientsController.cs`
- [Baseline assessment](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientBaselineController.cs): `yathu-platform.Api/Controllers/PatientBaselineController.cs`
- [Treatment episodes](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientTreatmentController.cs): `yathu-platform.Api/Controllers/PatientTreatmentController.cs`
- [Follow-up visits](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientVisitsController.cs): `yathu-platform.Api/Controllers/PatientVisitsController.cs`

### Administration

- [User management](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/UsersController.cs): `yathu-platform.Api/Controllers/UsersController.cs`
- [Facility geography](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/LocationsController.cs): `yathu-platform.Api/Controllers/LocationsController.cs`
- [Regimen catalogue](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/RegimensController.cs): `yathu-platform.Api/Controllers/RegimensController.cs`

### Reporting and transfers

- [Patient transfers](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/PatientTransfersController.cs): `yathu-platform.Api/Controllers/PatientTransfersController.cs`
- [Dashboard](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/DashboardController.cs): `yathu-platform.Api/Controllers/DashboardController.cs`
- [Reports and checks](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Api/Controllers/ReportsController.cs): `yathu-platform.Api/Controllers/ReportsController.cs`

### Application data

- [Domain services](https://github.com/strategic-information-department-cidrz/yathu-platform-api/tree/main/yathu-platform.Application/Services): `yathu-platform.Application/Services`
- [Repository layer](https://github.com/strategic-information-department-cidrz/yathu-platform-api/tree/main/yathu-platform.Application/Interfaces/RepositoryInterfaces): `yathu-platform.Application/Interfaces/RepositoryInterfaces`
- [Identity repository](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Infrastructure/Repositories/UserRepository.cs): `yathu-platform.Infrastructure/Repositories/UserRepository.cs`
- [Platform database](https://github.com/strategic-information-department-cidrz/yathu-platform-api/blob/main/yathu-platform.Infrastructure/Persistence/AppDbContext.cs): `yathu-platform.Infrastructure/Persistence/AppDbContext.cs`

### Other components

- **Facility staff**
- **Administrators**
- **Legacy register**

## Connections

- Facility staff → REST API: calls
- Administrators → REST API: calls
- REST API → Account endpoints: routes
- REST API → Patient records: routes
- REST API → Baseline assessment: routes
- REST API → Treatment episodes: routes
- REST API → Follow-up visits: routes
- REST API → Patient transfers: routes
- REST API → User management: routes
- REST API → Facility geography: routes
- REST API → Regimen catalogue: routes
- REST API → Dashboard: routes
- REST API → Reports and checks: routes
- Account endpoints → Account service: calls
- Account service → Email delivery: sends OTP
- Patient records → Domain services: calls
- Baseline assessment → Domain services: calls
- Treatment episodes → Domain services: calls
- Follow-up visits → Domain services: calls
- Patient transfers → Domain services: calls
- User management → Domain services: calls
- Facility geography → Domain services: calls
- Regimen catalogue → Domain services: calls
- Dashboard → Domain services: calls
- Reports and checks → Domain services: calls
- Domain services → Repository layer: uses
- Identity repository → Platform database: reads and writes
- Repository layer → Platform database: persists data
- REST API → Legacy register: ports register
