# Kelantan Compliance Dashboard — Prototype

> Demo environment for the **Google Cloud Startup Program**. All data is
> static demo data (`lib/features/dashboard/data/kelantan_demo_data.dart`)
> shaped after the expected KPM/KKM API payloads; no backend is required.

## Entry point

- Route: `/compliance-dashboard`
- Home screen hosts a hero card that opens the dashboard
  (`lib/features/home/screens/home_screen.dart`).
- A `DEMO • Google Cloud Startup Program` badge is shown in the app bar.

## Structure

| Layer | File | Purpose |
| --- | --- | --- |
| Models | `features/dashboard/models/compliance_models.dart` | District, school, menu, supplier, audit, campaign, feedback models + `ComplianceEngine` |
| Demo data | `features/dashboard/data/kelantan_demo_data.dart` | 5 districts, 14 schools, 12 suppliers, audit log, campaigns, feedback |
| State | `features/dashboard/providers/dashboard_provider.dart` | District filter + filtered/aggregated views |
| Screen | `features/dashboard/screens/compliance_dashboard_screen.dart` | District chips, summary header, 5 tabs |
| Widgets | `features/dashboard/widgets/` | `StatCard`, `BadgeChip`, `TrafficLightDot`/`TrafficLegend`, `ProgressStatRow`, `PipelineStepper`, `MenuItemRow`, panel headers |
| Panels | `features/dashboard/widgets/panels/` | One file per stakeholder panel |

## The five panels

1. **School Compliance** — today's menu compliance % vs KKM thresholds
   (sugar ≤10g / sodium ≤400mg / fat ≤10g per serving = green),
   monthly compliance, override alerts, RMT/PSS participation, audit status.
2. **Supplier Certification** — 6-stage pipeline funnel (Catalog → KKM
   scoring → Halal → Audit → Badge → Bundles) with live counts, certified
   share per district, JAKIM halal verification, badge lifecycle
   (active / expiring ≤60d / expired) and SKU-level catalog compliance.
3. **Regulator Oversight** — adoption by district, KPM/KKM API sync status,
   live alerts (warning/critical audit entries) and the append-only audit
   trail.
4. **Parent Transparency** — engagement metrics (logins, feedback, menu
   visibility), traffic-light menus at anchor schools, WhatsApp/PTA feedback
   channel, recent feedback.
5. **Community & NGO** — bundles sponsored, schools covered, active
   campaigns and advocacy campaign cards.

## District demo data

| District | Schools | Suppliers | Adoption | Certified |
| --- | --- | --- | --- | --- |
| Kota Bharu (anchor hub) | 300 | 150 | 82% | 65% |
| Pasir Mas (agro-food) | 200 | 80 | 74% | 58% |
| Tumpat (coastal/seafood) | 150 | 50 | 69% | 62% |
| Bachok (semi-urban pilots) | 120 | 40 | 76% | 55% |
| Machang / Tanah Merah / Kuala Krai (B40 rural) | 350 | 80 | 61% | 48% |

1,120 of ~1,300 KPM schools are in rollout scope.

## Localization

All UI strings live in `strings_en.dart` / `strings_bm.dart` (keys prefixed
`dash` / `pipe` / `homeHero`). `pickLang()` in
`lib/core/utils/format.dart` selects EN/BM demo content such as menu names.

## Web preview

`web_preview/index.html` is a self-contained browser preview of this
dashboard (same data, engine and strings; BM/EN toggle). See
`web_preview/README.md` for run/host instructions.

## Replacing demo data

Screens read exclusively through `DashboardProvider`. Swap
`KelantanDemoData` for a Firestore/REST repository behind the same getters
when the backend is connected — no widget changes needed.
