Skip to content

MOAI-GIGA/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIGA School Priority Backend

Backend pipeline to compute school-level composite priority indices based on multi-layer climate, social, and accessibility indicators.

This repository contains the full modular implementation of the school prioritisation framework developed within the GIGA Mozambique pilot.


Overview

The system computes a composite PRIORITY_IDX (0–100) for each school by combining:

  • Climate vulnerability layers
  • Social vulnerability layers
  • Accessibility and isolation layers

The weighting structure is hierarchical:

  1. Top-level weights between:

    • Climate
    • Social
    • Access
  2. Internal subgroup weights within each category.

All scenario combinations are automatically generated using a structured preference system (High = 3, Medium = 2, Low = 1).


Repository Structure

giga-school-priority/
│
├─ src/giga_priority/         # Core Python package
│  ├─ scaling.py
│  ├─ indices.py
│  ├─ scenarios.py
│  ├─ export.py
│  └─ utils.py
│
├─ scripts/
│  ├─ run_export_school_priority.py
│  └─ inspect_scenarios.py
│
├─ data/
│  ├─ raw/
│  ├─ processed/
│  └─ outputs/
│
├─ requirements.txt
├─ pyproject.toml
└─ README.md

Installation

1️⃣ Clone the repository

git clone https://gitlab.com/giga-unicef/backend.git
cd backend

2️⃣ Create virtual environment

python -m venv .venv
.venv\Scripts\activate

3️⃣ Install dependencies

pip install -r requirements.txt
pip install -e .

Input Data

The pipeline expects a master CSV file:

data/processed/schools_master.csv

This file must contain:

Required Metadata Columns

  • school_id_giga
  • school_name
  • education_level
  • latitude
  • longitude
  • x_utm
  • y_utm
  • admin2_id_moai
  • electricity_availability
  • connectivity

Required Indicator Columns

All base columns required by:

  • Climate index builder
  • Social index builder
  • Access index builder

These should already be preprocessed and cleaned.


Connectivity Filtering

The script automatically filters:

connectivity == "No"

Only non-connected schools are processed.


Running the Pipeline

Test Scenario Generation

python scripts/inspect_scenarios.py

Expected output:

N escenarios: 205

Run Full Export

python scripts/run_export_school_priority.py

This will:

  • Load master dataset (~13,000 schools)
  • Filter non-connected (~9,000)
  • Generate 205 scenarios
  • Compute indices for each
  • Export results

Output

Results are written to:

data/outputs/

Two folders are created:

school_priority_csv/
school_priority_geojson/

For each scenario, the following files are generated:

schools_priority_index-cliX_socY_accZ-....csv
schools_priority_index-cliX_socY_accZ-....geojson

Each file contains:

  • All original school metadata
  • PRIORITY_IDX (integer 0–100)

GeoJSON is exported in:

EPSG:4326

PRIORITY_IDX Definition

The priority index is:

  1. Built from:

    • Climate index
    • Social index
    • Access index
  2. Combined using scenario weights

  3. Robustly normalized (quantile-based)

  4. Scaled to integer range:

0 – 100

Scenario Logic

Each scenario defines:

  • Top-level preference:
    • High (3)
    • Medium (2)
    • Low (1)

Converted into normalized weights:

w_i = score_i / sum(scores)

Internal subgroup combinations are generated automatically.

Total scenarios (default configuration):

205

Reproducibility

This repository is fully reproducible:

  • No hardcoded paths
  • Modular structure
  • Explicit scenario generation
  • Version-controlled code

Large datasets are excluded via .gitignore.


Development Notes

  • Built for Python 3.10 / 3.11
  • Uses geopandas for spatial export
  • Designed to integrate later with:
    • Greedy optimisation
    • MIP refinement
    • Tower placement modules

License

MIT — Copyright © 2025–2026 MOAI Analytics · GIGA UNICEF–ITU

About

Backend pipeline to compute school-level composite priority indices based on multi-layer climate, social, and accessibility indicators.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages