Spaces:
Sleeping
Sleeping
metadata
title: Barcli Mesa API
emoji: π‘οΈ
colorFrom: blue
colorTo: red
sdk: docker
pinned: false
short_description: Mesa ABM simulation API for Barcelona climate vulnerability
Barcli Mesa API
FastAPI backend providing Mesa-based agent simulation for the Barcli frontend.
Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/health |
Liveness check |
POST |
/simulate/single |
Single-agent A* pathfinding with climate weighting |
POST |
/simulate/multi |
20-agent shelter-seeking with 4 personas |
POST /simulate/single
{
"start": [-2.1734, 41.3851],
"end": [-2.1700, 41.3900],
"climate_weight": 0.5,
"baseline_index": null,
"policy_index": null
}
Returns baseline_path, policy_path (arrays of [lng, lat]) and baseline_profile, policy_profile (vulnerability scores 0β1 per node).
POST /simulate/multi
{
"shelter_coord": [-2.1720, 41.3870],
"baseline_index": null,
"policy_index": null,
"seed": 42
}
Returns per-frame baseline_snapshots/policy_snapshots and persona_breakdown with arrived counts per persona.
Data files required
Place these in the data/ directory (same files as the frontend's public/data/):
data/climate_isochrone.geojsonβ road network (LineString features)data/data.geojsonβ climate vulnerability points (heat, SPEI, urban_health fields)data/climate_shelters.geojsonβ shelter locations (Point features)
Files
βββ app.py FastAPI app + graph loading + routes
βββ mesa_single.py Mesa single-agent A* model
βββ mesa_multi.py Mesa multi-agent shelter model
βββ requirements.txt
βββ Dockerfile
βββ data/
βββ climate_isochrone.geojson
βββ data.geojson
βββ climate_shelters.geojson