Skip to content

vaskoyudha/StuntingMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—บ๏ธ StuntingMap

Platform Intelijen Geospasial Stunting Indonesia

Peta risiko stunting interaktif mencakup 514 kabupaten/kota di seluruh Indonesia Data real-time dari SSGI, Riskesdas, BPS Susenas โ€” ditenagai ML pipeline & narasi LLM

TypeScript Python Next.js License: MIT PRs Welcome

Overview

StuntingMap is a production-grade geospatial intelligence platform tracking child stunting risk across all 514 Indonesian districts (kabupaten/kota). Built as a senior AI engineer portfolio project demonstrating:

  • Real data: SSGI 2022, Riskesdas 2018, BPS Susenas 2023 โ€” no synthetic data
  • ML models: XGBoost + SHAP for stunting prediction, PySAL for spatial autocorrelation
  • LLM narratives: Pre-generated GPT-4o-mini district reports in Bahasa Indonesia
  • Geospatial: MapLibre GL JS choropleth with 8 data layers + time slider (2013-2024)

National context: Indonesia's stunting prevalence was 19.8% in 2024, missing the 14% national target. The worst-affected province is NTT at 35.9%; the best is Bali at 10.9%.


๐Ÿ“ธ Screenshots

๐Ÿ—บ๏ธ Interactive Map โ€” 8 Data Layers ยท Time Slider 2013โ€“2024

StuntingMap โ€” Peta Interaktif

๐Ÿ“Š National Dashboard โ€” Real-time KPIs ยท Provincial Rankings

StuntingMap โ€” Dashboard Nasional


๐Ÿšจ National Context

Indonesia recorded 19.8% stunting prevalence in 2024 โ€” missing the 14% national target by 5.8 percentage points.

Province Prevalence Status
NTT 35.9% ๐Ÿ”ด Worst
Papua 32.5% ๐Ÿ”ด Critical
Sulawesi Barat 31.5% ๐Ÿ”ด Critical
Maluku 29.2% ๐ŸŸ  High
DKI Jakarta 10.2% ๐ŸŸข Best
Bali 12.8% ๐ŸŸข Below target
DIY Yogyakarta 13.5% ๐ŸŸข Below target

โœจ Features

Feature Description
๐Ÿ—บ๏ธ Choropleth Map MapLibre GL JS, 8 data layers, per-district interactive tooltips
โฑ๏ธ Time Slider Temporal animation 2013โ€“2024, adjustable speed
๐Ÿ“Š National Dashboard KPI cards, progress gauge toward 14% target, provincial ranking
๐Ÿ” District Comparison Side-by-side comparison across kabupaten/kota
๐Ÿง  ML Pipeline XGBoost + SHAP, Moran's I, LISA spatial clustering
๐Ÿ“ LLM Narratives GPT-4o-mini, pre-generated in Bahasa Indonesia
๐ŸŽจ Colorblind-safe YlOrRd (stunting/SRI) ยท RdYlGn (WASH/health)
๐Ÿ“ฑ Responsive Tablet-friendly, touch gestures supported
๐Ÿ” Auth Full public access + researcher login for saved views

๐Ÿ—๏ธ Tech Stack

Layer Technology
Frontend Next.js 16 (App Router), TypeScript, Tailwind CSS
Map MapLibre GL JS, GeoJSON (optimized <3MB)
Charts Recharts, D3 (SVG gauges)
State Zustand
Database PostgreSQL + PostGIS (via Drizzle ORM)
Cache Redis (ioredis)
ML Pipeline Python: XGBoost, SHAP, PySAL, Pydantic v2
LLM OpenAI GPT-4o-mini (pre-generated, cached)
Orchestration Prefect
Package Manager pnpm workspaces + Turborepo
Deploy Vercel (web) + Railway/Docker (ML service)

๐Ÿ“ฆ Data Sources

Dataset Source Coverage License
SSGI 2022 (Survei Status Gizi Indonesia) Kemenkes RI 34 provinsi, 514 kab/kota Public
Riskesdas 2018 Badan Litbangkes Nasional Public
BPS Susenas 2023 Badan Pusat Statistik Nasional Public
HDX Indonesia Admin Boundaries OCHA/HDX Level 2 (kab/kota) CC BY
PODES 2021 BPS 83,794 desa Public

Transparency note: Where district-level data is unavailable for specific years, this platform uses ML models (XGBoost) to estimate values. All modeled values are clearly labeled as "Estimasi Model" versus measured "Data Terukur" throughout the interface.


๐Ÿš€ Getting Started

Prerequisites

  • Node.js โ‰ฅ 18, pnpm โ‰ฅ 9
  • Docker Desktop (for PostgreSQL + Redis)
  • Python 3.11+ (for ML pipeline)
  • OpenAI API key (optional, for LLM narratives)

Installation

# Clone repository
git clone https://github.com/vaskoyudha/StuntingMap.git
cd StuntingMap

# Install dependencies
pnpm install

# Start infrastructure
docker compose up -d

# Copy environment variables
cp .env.example .env.local
# Edit .env.local with your credentials

# Setup database
pnpm db:push
pnpm db:seed

# Start development server
pnpm dev

The app will be available at http://localhost:3000

Environment Variables

DATABASE_URL=postgresql://stuntingmap:stuntingmap@localhost:5432/stuntingmap
REDIS_URL=redis://localhost:6379
OPENAI_API_KEY=sk-your-key-here          # Optional โ€” template narratives used if missing
NEXT_PUBLIC_APP_URL=http://localhost:3000
ML_API_URL=http://localhost:8000
NEXTAUTH_SECRET=your-secret-here
PIPELINE_SECRET=your-pipeline-secret

๐Ÿ“ Repository Structure

StuntingMap/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ web/                        # Next.js 16 App Router
โ”‚   โ”‚   โ”œโ”€โ”€ app/                    # Pages + API routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ map/               # Interactive map page
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/         # National analytics
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ compare/           # District comparison
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api/               # REST API (15 routes)
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ map/               # MapLibre components (6)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ district/          # District panel (8)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/         # Dashboard widgets (5)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ shared/            # Reusable UI (4)
โ”‚   โ”‚   โ”œโ”€โ”€ lib/                   # DB, Redis, colors, utils
โ”‚   โ”‚   โ””โ”€โ”€ store/                 # Zustand state management
โ”‚   โ””โ”€โ”€ pipeline/                  # Python ML service
โ”‚       โ”œโ”€โ”€ analysis/              # Moran's I, LISA
โ”‚       โ”œโ”€โ”€ models/                # XGBoost, SRI, trajectory
โ”‚       โ”œโ”€โ”€ narratives/            # LLM generation
โ”‚       โ””โ”€โ”€ pipelines/             # Prefect orchestration
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ db/                        # Drizzle schema (9 tables)
โ”‚   โ””โ”€โ”€ shared/                    # Shared TypeScript types
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ ingest/                    # Data ingestion (Python)
โ”‚   โ””โ”€โ”€ tiles/                     # GeoJSON generation
โ””โ”€โ”€ data/processed/                # Real Indonesian CSV data

๐Ÿ”Œ API Reference

Endpoint Method Description
/api/geojson GET GeoJSON boundaries + stunting data
/api/layers GET Available data layers
/api/districts GET All districts with latest data
/api/districts/[pcode] GET Single district detail
/api/districts/[pcode]/report GET Full district report
/api/districts/[pcode]/peers GET Peer comparison districts
/api/national GET National-level statistics
/api/scatter GET Scatter plot correlation data
/api/v1/districts GET Public API v1

๐Ÿง  Methodology

Stunting Risk Index (SRI)

SRI is a composite index (0โ€“1) combining:

  • Prevalence score (30%): Current stunting prevalence normalized nationally
  • Trend score (20%): Historical trajectory (improving vs worsening)
  • Determinant score (30%): WASH access, poverty, education composite
  • Intervention gap score (20%): Healthcare coverage gaps

Spatial Analysis

  • Global Moran's I: Tests for spatial clustering of stunting across Indonesia
  • LISA (Local Moran's I): Identifies HH/LL/HL/LH clusters at district level
  • Weights: K-nearest neighbors (k=8), row-standardized, robust for archipelago geography

Scenario Projections

Three scenarios based on historical trend slope:

  • BAU: Business as usual โ€” continues historical trend
  • Accelerated: 2.5ร— BAU decline with intensive intervention
  • Minimal: 0.3ร— BAU decline with reduced resources

๐Ÿงช Testing

# TypeScript type checking
cd apps/web && pnpm tsc --noEmit

# Python ML pipeline tests (9/9 passing)
cd apps/pipeline && pytest tests/ -v

๐Ÿšข Deployment

Vercel (Frontend)

vercel deploy

Railway (ML Pipeline)

docker build -t stunting-pipeline apps/pipeline/
railway up

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

MIT License โ€” see LICENSE for details.

Data from SSGI, Riskesdas, and BPS Susenas is used under Indonesian government open data provisions. HDX boundaries under CC BY OCHA.


๐Ÿ“– Citation

If you use StuntingMap data or methodology in research, please cite:

@software{stuntingmap2024,
  title  = {StuntingMap: Platform Intelijen Geospasial Stunting Indonesia},
  author = {Nodyatama, Vasco Yudha},
  year   = {2024},
  url    = {https://github.com/vaskoyudha/StuntingMap},
  note   = {Data: SSGI 2022 (Kemenkes RI), Riskesdas 2018, BPS Susenas 2023}
}

Dibuat untuk mendukung penurunan stunting di Indonesia ๐Ÿ‡ฎ๐Ÿ‡ฉ

๐Ÿ—บ๏ธ Map ยท ๐Ÿ“Š Dashboard ยท ๐Ÿ› Report Bug ยท ๐Ÿ’ก Request Feature

About

๐Ÿ—บ๏ธ Platform intelijen geospasial stunting Indonesia โ€” 514 kab/kota, SSGI/Riskesdas/BPS, XGBoost+SHAP, MapLibre GL, LLM narratives

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors