# alltacoe/kpi_dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/alltacoe/kpi_dashboard
- Repository: https://github.com/alltacoe/kpi_dashboard

## Overview

This repository is a health-sector KPI dashboard: users navigate KPI and administrative views, while backend APIs expose reporting, data-management, and AI-analysis capabilities. The clearest sampled workflow is the KPI report route loading a report component; a separate NestJS service handles Excellence 1-28-1 report and record operations through a repository and MySQL entity. The README is empty, and many frontend/backend integrations were not sampled, so cross-application calls are not asserted.

Main entry points: [`kpi_front/src/app/modules/kpi/reports/ncd-1/ncd-1.component.ts`](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/reports/ncd-1/ncd-1.component.ts) (NCD report), [`kpi_backend/src/app.module.ts`](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/app.module.ts) (Application module), [`kpi_backend/src/services/excellence-1-28-1.service.ts`](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/services/excellence-1-28-1.service.ts) (Excellence operations), [`kpi_backend/src/repositories/excellence-1-28-1.repository.ts`](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/repositories/excellence-1-28-1.repository.ts) (Excellence repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["KPI interface"]
  node_app_routes["App routing<br/>[app.routes.ts]"]
  node_kpi_routes["KPI routes<br/>[kpi.routes.ts]"]
  node_ncd_routes["NCD routes<br/>[ncd.routes.ts]"]
  node_ncd_report["NCD report<br/>[ncd-1.component.ts]"]
  node_evaluation["Evaluation engine"]
  node_evaluation_service["Evaluation service"]
end

subgraph group_adonis["Backend API"]
  node_adonis_routes["HTTP route registry<br/>[routes.ts]"]
  node_ai_routes["AI analysis routes<br/>[ai-analysis.ts]"]
  node_common_controller["Common APIs"]
  node_strategic_controller["Strategic dashboard"]
  node_ai_context["AI query context"]
  node_ai_executor["AI query execution"]
end

subgraph group_nest["Excellence API"]
  node_nest_entry["NestJS startup<br/>[main.ts]"]
  node_nest_module["Application module<br/>[app.module.ts]"]
  node_excellence_module["Excellence module"]
  node_excellence_controller["Excellence endpoints"]
  node_excellence_service["Excellence operations"]
end

subgraph group_storage["Data access"]
  node_moph_repository["MOPH reports"]
  node_excellence_repository["Excellence repository"]
  node_excellence_entity[("Excellence records")]
end

node_user(("Dashboard user"))

node_user -->|"navigates"| node_app_routes
node_kpi_routes -->|"loads report"| node_ncd_report
node_ncd_routes -->|"loads report"| node_ncd_report
node_evaluation -->|"uses"| node_evaluation_service
node_adonis_routes -->|"registers"| node_ai_routes
node_nest_entry -->|"creates app"| node_nest_module
node_nest_module -->|"imports"| node_excellence_module
node_excellence_controller -->|"calls"| node_excellence_service
node_excellence_service -->|"delegates"| node_excellence_repository
node_excellence_repository -->|"queries"| node_excellence_entity
node_ncd_report -.->|"requests data"| node_moph_repository

click node_app_routes "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/app.routes.ts"
click node_kpi_routes "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/kpi.routes.ts"
click node_ncd_routes "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/reports/ncd/ncd.routes.ts"
click node_ncd_report "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/reports/ncd-1/ncd-1.component.ts"
click node_evaluation "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/core/services/evaluation-engine.service.ts"
click node_evaluation_service "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/core/services/evaluation.service.ts"
click node_adonis_routes "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/start/routes.ts"
click node_ai_routes "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/start/routes/ai-analysis.ts"
click node_common_controller "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Controllers/Http/CommonController.ts"
click node_strategic_controller "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Controllers/Http/StrategicDashboardController.ts"
click node_moph_repository "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Repositories/MophReportRepository.ts"
click node_ai_context "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Services/AiJsonContextService.ts"
click node_ai_executor "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Services/AiQueryExecutorService.ts"
click node_nest_entry "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/main.ts"
click node_nest_module "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/app.module.ts"
click node_excellence_module "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/modules/excellence-1-28-1.module.ts"
click node_excellence_controller "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/controllers/excellence-1-28-1.controller.ts"
click node_excellence_service "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/services/excellence-1-28-1.service.ts"
click node_excellence_repository "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/repositories/excellence-1-28-1.repository.ts"
click node_excellence_entity "https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/entities/excellence-1-28-1.entity.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_app_routes,node_kpi_routes,node_ncd_routes,node_ncd_report,node_evaluation,node_evaluation_service,node_user toneBlue
class node_adonis_routes,node_ai_routes,node_common_controller,node_strategic_controller,node_ai_context,node_ai_executor toneAmber
class node_nest_entry,node_nest_module,node_excellence_module,node_excellence_controller,node_excellence_service toneMint
class node_moph_repository,node_excellence_repository,node_excellence_entity toneRose
```

## Components

### KPI interface

- [App routing](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/app.routes.ts): `kpi_front/src/app/app.routes.ts`
- [KPI routes](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/kpi.routes.ts): `kpi_front/src/app/modules/kpi/kpi.routes.ts`
- [NCD routes](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/reports/ncd/ncd.routes.ts): `kpi_front/src/app/modules/kpi/reports/ncd/ncd.routes.ts`
- [NCD report](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/modules/kpi/reports/ncd-1/ncd-1.component.ts): `kpi_front/src/app/modules/kpi/reports/ncd-1/ncd-1.component.ts`
- [Evaluation engine](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/core/services/evaluation-engine.service.ts): `kpi_front/src/app/core/services/evaluation-engine.service.ts`
- [Evaluation service](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_front/src/app/core/services/evaluation.service.ts): `kpi_front/src/app/core/services/evaluation.service.ts`

### Backend API

- [HTTP route registry](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/start/routes.ts): `kpi_backend/start/routes.ts`
- [AI analysis routes](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/start/routes/ai-analysis.ts): `kpi_backend/start/routes/ai-analysis.ts`
- [Common APIs](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Controllers/Http/CommonController.ts): `kpi_backend/app/Controllers/Http/CommonController.ts`
- [Strategic dashboard](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Controllers/Http/StrategicDashboardController.ts): `kpi_backend/app/Controllers/Http/StrategicDashboardController.ts`
- [AI query context](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Services/AiJsonContextService.ts): `kpi_backend/app/Services/AiJsonContextService.ts`
- [AI query execution](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Services/AiQueryExecutorService.ts): `kpi_backend/app/Services/AiQueryExecutorService.ts`

### Excellence API

- [NestJS startup](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/main.ts): `kpi_backend/src/main.ts`
- [Application module](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/app.module.ts): `kpi_backend/src/app.module.ts`
- [Excellence module](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/modules/excellence-1-28-1.module.ts): `kpi_backend/src/modules/excellence-1-28-1.module.ts`
- [Excellence endpoints](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/controllers/excellence-1-28-1.controller.ts): `kpi_backend/src/controllers/excellence-1-28-1.controller.ts`
- [Excellence operations](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/services/excellence-1-28-1.service.ts): `kpi_backend/src/services/excellence-1-28-1.service.ts`

### Data access

- [MOPH reports](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/app/Repositories/MophReportRepository.ts): `kpi_backend/app/Repositories/MophReportRepository.ts`
- [Excellence repository](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/repositories/excellence-1-28-1.repository.ts): `kpi_backend/src/repositories/excellence-1-28-1.repository.ts`
- [Excellence records](https://github.com/alltacoe/kpi_dashboard/blob/main/kpi_backend/src/entities/excellence-1-28-1.entity.ts): `kpi_backend/src/entities/excellence-1-28-1.entity.ts`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → App routing: navigates (evidence: `kpi_front/src/app/app.routes.ts`)
- KPI routes → NCD report: loads report (evidence: `kpi_front/src/app/modules/kpi/kpi.routes.ts`)
- NCD routes → NCD report: loads report (evidence: `kpi_front/src/app/modules/kpi/reports/ncd/ncd.routes.ts`)
- Evaluation engine → Evaluation service: uses (evidence: `kpi_front/src/app/core/services/evaluation-engine.service.ts`)
- HTTP route registry → AI analysis routes: registers (evidence: `kpi_backend/start/routes.ts`)
- NestJS startup → Application module: creates app (evidence: `kpi_backend/src/main.ts`)
- Application module → Excellence module: imports (evidence: `kpi_backend/src/app.module.ts`)
- Excellence endpoints → Excellence operations: calls (evidence: `kpi_backend/src/controllers/excellence-1-28-1.controller.ts`)
- Excellence operations → Excellence repository: delegates (evidence: `kpi_backend/src/services/excellence-1-28-1.service.ts`)
- Excellence repository → Excellence records: queries (evidence: `kpi_backend/src/repositories/excellence-1-28-1.repository.ts`)
- NCD report → MOPH reports: requests data
