# raffaelveneh/spk-stunting-balita architecture

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

- Interactive diagram: https://gitdiagram.com/raffaelveneh/spk-stunting-balita
- Repository: https://github.com/raffaelveneh/spk-stunting-balita

## Overview

This is an UNY-restricted decision-support application for prioritizing nutrition interventions for children at risk of stunting. The main workflow is sign-in, obtain or load child alternatives and criteria, calculate SAW or MOORA rankings, and review priority results; users can also consult scoring guidance and export results. The graph includes documented AHP weighting and dataset sampling/summary capabilities. Source excerpts show the calculation engine and key UI behavior; some links rely on README or source-index references, so unsampled internals are not expanded.

Main entry points: [`frontend/src/App.tsx`](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/App.tsx) (App shell), [`frontend/src/pages/DashboardPage.tsx`](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/pages/DashboardPage.tsx) (Triage dashboard), [`backend/app/Http/Controllers/SpkController.php`](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Http/Controllers/SpkController.php) (SPK API controller), [`backend/routes/api.php`](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/routes/api.php) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User application"]
  node_app["App shell<br/>[App.tsx]"]
  node_login["Login page<br/>[LoginPage.tsx]"]
  node_dashboard["Triage dashboard<br/>[DashboardPage.tsx]"]
  node_guide["Scoring guide"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_api["HTTP and fallback client<br/>[api.ts]"]
  node_export["Excel export<br/>[exportExcel.ts]"]
end

subgraph group_identity["UNY identity"]
  node_routes["API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_emailrule["UNY email rule<br/>[UnyEmailRule.php]"]
  node_user_model["User and tokens<br/>[User.php]"]
end

subgraph group_decision["Decision services"]
  node_spk_controller["SPK API controller<br/>[SpkController.php]"]
  node_ahp["AHP weighting<br/>[AhpService.php]"]
  node_engine["Method dispatcher<br/>[SpkEngine.php]"]
  node_saw["SAW ranking<br/>[SawService.php]"]
  node_moora["MOORA ranking<br/>[MooraService.php]"]
end

subgraph group_data["Dataset services"]
  node_dataset_service["Sample and summary<br/>[DatasetService.php]"]
  node_csv["Child dataset"]
end

node_user(("UNY user"))

node_user -->|"uses"| node_app
node_app -->|"shows signed out"| node_login
node_app -->|"shows signed in"| node_dashboard
node_app -->|"renders"| node_navbar
node_login -->|"authenticates"| node_api
node_dashboard -->|"requests data and rankings"| node_api
node_dashboard -->|"opens guidance"| node_guide
node_dashboard -->|"exports results"| node_export
node_api -->|"sends API requests"| node_routes
node_routes -->|"routes auth"| node_auth
node_routes -->|"routes SPK"| node_spk_controller
node_auth -->|"validates domain"| node_emailrule
node_auth -->|"looks up and issues tokens"| node_user_model
node_spk_controller -->|"computes weights"| node_ahp
node_spk_controller -->|"runs selected method"| node_engine
node_engine -->|"dispatches SAW"| node_saw
node_engine -->|"dispatches MOORA"| node_moora
node_spk_controller -->|"requests samples and summary"| node_dataset_service
node_dataset_service -->|"reads"| node_csv

click node_app "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/App.tsx"
click node_login "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/pages/LoginPage.tsx"
click node_dashboard "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_guide "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/components/MethodologyGuide.tsx"
click node_navbar "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/components/Navbar.tsx"
click node_api "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/services/api.ts"
click node_export "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/utils/exportExcel.ts"
click node_routes "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/routes/api.php"
click node_auth "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Http/Controllers/AuthController.php"
click node_emailrule "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Rules/UnyEmailRule.php"
click node_user_model "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Models/User.php"
click node_spk_controller "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Http/Controllers/SpkController.php"
click node_ahp "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/AhpService.php"
click node_engine "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/SpkEngine.php"
click node_saw "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/SawService.php"
click node_moora "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/MooraService.php"
click node_dataset_service "https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/DatasetService.php"

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,node_login,node_dashboard,node_guide,node_navbar,node_api,node_export,node_user toneBlue
class node_routes,node_auth,node_emailrule,node_user_model toneAmber
class node_spk_controller,node_ahp,node_engine,node_saw,node_moora toneMint
class node_dataset_service,node_csv toneRose
```

## Components

### User application

- [App shell](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login page](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Triage dashboard](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Scoring guide](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/components/MethodologyGuide.tsx): `frontend/src/components/MethodologyGuide.tsx`
- [Navigation](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/components/Navbar.tsx): `frontend/src/components/Navbar.tsx`
- [HTTP and fallback client](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Excel export](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/frontend/src/utils/exportExcel.ts): `frontend/src/utils/exportExcel.ts`

### UNY identity

- [API routes](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Authentication](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Http/Controllers/AuthController.php): `backend/app/Http/Controllers/AuthController.php`
- [UNY email rule](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Rules/UnyEmailRule.php): `backend/app/Rules/UnyEmailRule.php`
- [User and tokens](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`

### Decision services

- [SPK API controller](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Http/Controllers/SpkController.php): `backend/app/Http/Controllers/SpkController.php`
- [AHP weighting](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/AhpService.php): `backend/app/Services/SPK/AhpService.php`
- [Method dispatcher](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/SpkEngine.php): `backend/app/Services/SPK/SpkEngine.php`
- [SAW ranking](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/SawService.php): `backend/app/Services/SPK/SawService.php`
- [MOORA ranking](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/SPK/MooraService.php): `backend/app/Services/SPK/MooraService.php`

### Dataset services

- [Sample and summary](https://github.com/raffaelveneh/spk-stunting-balita/blob/main/backend/app/Services/DatasetService.php): `backend/app/Services/DatasetService.php`
- **Child dataset**

### Other components

- **UNY user**

## Connections

- UNY user → App shell: uses (evidence: `README.md`)
- App shell → Login page: shows signed out (evidence: `frontend/src/App.tsx`)
- App shell → Triage dashboard: shows signed in (evidence: `frontend/src/App.tsx`)
- App shell → Navigation: renders (evidence: `frontend/src/App.tsx`)
- Login page → HTTP and fallback client: authenticates (evidence: `frontend/src/pages/LoginPage.tsx`)
- Triage dashboard → HTTP and fallback client: requests data and rankings (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Triage dashboard → Scoring guide: opens guidance (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Triage dashboard → Excel export: exports results (evidence: `frontend/src/pages/DashboardPage.tsx`)
- HTTP and fallback client → API routes: sends API requests (evidence: `frontend/src/services/api.ts`)
- API routes → Authentication: routes auth (evidence: `backend/routes/api.php`)
- API routes → SPK API controller: routes SPK (evidence: `backend/routes/api.php`)
- Authentication → UNY email rule: validates domain (evidence: `backend/app/Http/Controllers/AuthController.php`)
- Authentication → User and tokens: looks up and issues tokens (evidence: `backend/app/Http/Controllers/AuthController.php`)
- SPK API controller → AHP weighting: computes weights (evidence: `backend/app/Http/Controllers/SpkController.php`)
- SPK API controller → Method dispatcher: runs selected method (evidence: `backend/app/Http/Controllers/SpkController.php`)
- Method dispatcher → SAW ranking: dispatches SAW (evidence: `backend/app/Services/SPK/SpkEngine.php`)
- Method dispatcher → MOORA ranking: dispatches MOORA (evidence: `backend/app/Services/SPK/SpkEngine.php`)
- SPK API controller → Sample and summary: requests samples and summary (evidence: `backend/app/Http/Controllers/SpkController.php`)
- Sample and summary → Child dataset: reads (evidence: `backend/app/Services/DatasetService.php`)
