Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Disaster Data Analytics

Recipe 2 — Queryables & CQL2 Reference

IFRC

Step 1 — Setup & Connection

Environment Setup

Binder
Google Colab
Local

All dependencies are pre-installed. Click Launch Binder at the top of the page — no setup needed.

All libraries imported successfully!
======================================================================
AUTHENTICATION REQUIRED
======================================================================

The Montandon STAC API requires a Bearer Token for authentication.

How to get your token:
  1. Visit: https://goadmin-stage.ifrc.org/
  2. Log in with your IFRC credentials
  3. Generate an API token from your account settings

Alternatively, set the MONTANDON_API_TOKEN environment variable:
  PowerShell: $env:MONTANDON_API_TOKEN = 'your_token_here'
  Bash: export MONTANDON_API_TOKEN='your_token_here'

======================================================================

✓ Connected to: https://montandon-eoapi-stage.ifrc.org/stac
✓ API Title: stac-fastapi
✓ Authentication: Bearer Token (OpenID Connect)
✓ Auth Provider: https://goadmin-stage.ifrc.org/o/.well-known/openid-configuration
✓ Search helper function defined

Step 2 — Discovering Queryables

The /queryables endpoint exposes a JSON Schema document listing every property you can filter on. The cells below fetch and categorise them into four groups:

GroupPrefixExamples
STAC Core—id, collection, datetime, geometry
Monty Coremonty:monty:country_codes, monty:hazard_codes, monty:corr_id
Hazard Detailmonty:hazard_detail.*cluster, severity_value, severity_unit
Impact Detailmonty:impact_detail.*category, type, value, unit
Queryables Schema Retrieved Successfully!

Schema ID: https://montandon-eoapi-stage.ifrc.org/queryables
Title: STAC Queryables.
Description: N/A
Total Queryable Properties: 15

================================================================================
STAC Core Queryables:
  - id: string | Item identifier...
  - roles: string | The roles of the item...
  - datetime: string | Datetime...
  - geometry: object | Geometry...
  - collection: string | Collection identifier...

Monty Core Queryables:
  - monty:corr_id: string
  - monty:hazard_codes: string
  - monty:country_codes: string
  - monty:episode_number: integer

Hazard Detail Queryables:
  - monty:hazard_detail.estimate_type: string
  - monty:hazard_detail.severity_unit: string
  - monty:hazard_detail.severity_value: number

Impact Detail Queryables:
  - monty:impact_detail.type: string
  - monty:impact_detail.value: number
  - monty:impact_detail.category: string

Step 3 — Collections & Item Types

Event Collections
Hazard Collections
Impact Collections

desinventar-events, gdacs-events, glide-events, emdat-events, gfd-events

Found 10 recent events (limited to 10)

ID: emdat-event-2024-0960-TUN
  Collection: emdat-events
  Title: Water in Tunisia of December 2024...
  Roles: ['source', 'event']
ID: emdat-event-2024-0954-ITA
  Collection: emdat-events
  Title: Water in Italy of December 2024...
  Roles: ['source', 'event']
ID: gdacs-event-1103065
  Collection: gdacs-events
  Title: Flood in Malaysia...
  Roles: ['source', 'event']
ID: emdat-event-2024-0948-ETH
  Collection: emdat-events
  Title: Road in Ethiopia...
  Roles: ['source', 'event']
ID: emdat-event-2024-0947-KOR
  Collection: emdat-events
  Title: Air in Republic of Korea of December 2024...
  Roles: ['source', 'event']

Step 4 — Spatial Queries with s_intersects

s_intersects tests whether an item’s geometry overlaps a given GeoJSON shape. Below we define a bounding-box polygon for South Asia and combine it with a hazard-code filter.

Events in Japan (JPN): 20

- EQ in  on 2025, 12, 8
  Hazard Codes: ['GH0101', 'EQ', 'nat-geo-ear-gro']
- Earthquake in Japan
  Hazard Codes: ['GH0101', 'EQ', 'nat-geo-ear-gro']
- Earthquake in Japan
  Hazard Codes: ['GH0101', 'EQ', 'nat-geo-ear-gro']
- Earthquake in Off East Coast Of Honshu, Japan
  Hazard Codes: ['GH0101', 'EQ', 'nat-geo-ear-gro']
- Earthquake in Japan
  Hazard Codes: ['GH0101', 'EQ', 'nat-geo-ear-gro']
Flood-related events found: 30

Events by Collection:
  emdat-events: 1
  gdacs-events: 28
  glide-events: 1

Step 5 — Array Operators: a_overlaps and a_contains

Array-valued properties like monty:hazard_codes and monty:country_codes require specialised operators:

OperatorSemanticsExample
a_overlapsItem array shares at least one element with the argumentMulti-code hazard search
a_containsItem array includes a specific elementSingle-country filter
a_equalsItem array is exactly equalExact match (rare)
Total hazards with severity values: 50

======================================================================
HAZARDS BY TYPE:
======================================================================

======================================================================
SAMPLE HAZARDS:
======================================================================
Loading...

Step 6 — Hazard Details: Severity Filtering

Filter on nested hazard properties like monty:hazard_detail.severity_value to find only high-magnitude events.

Impact records with deaths: 50

Loading...
Search failed: 500 - Internal Server Error
Significant displacement impacts (>1000 people): 0

Top 10 Countries by Displacement:


Step 7 — Impact Details: People & Economic Metrics

Query the monty:impact_detail nested properties to retrieve humanitarian impact records (deaths, displacement, affected population).

Flood impacts in South/Southeast Asia (2024): 100

   Country                Type  count       sum
0      IDN      affected_total      2   20320.0
1      IDN  displaced_internal     35   41780.0
2      IND  displaced_internal      2   19957.0
3      IND           relocated      2    1881.0
4      LKA  displaced_internal      1     165.0
5      LKA   shelter_emergency      1     123.0
6      MYS      affected_total      1    1650.0
7      MYS  displaced_internal     29   28964.0
8      MYS           relocated      4    7074.0
9      PHL  displaced_internal     21  105803.0
10     THA      affected_total      1     315.0
11     VNM      affected_total      1     200.0
   Country                Type  count       sum
0      IDN      affected_total      2   20320.0
1      IDN  displaced_internal     35   41780.0
2      IND  displaced_internal      2   19957.0
3      IND           relocated      2    1881.0
4      LKA  displaced_internal      1     165.0
5      LKA   shelter_emergency      1     123.0
6      MYS      affected_total      1    1650.0
7      MYS  displaced_internal     29   28964.0
8      MYS           relocated      4    7074.0
9      PHL  displaced_internal     21  105803.0
10     THA      affected_total      1     315.0
11     VNM      affected_total      1     200.0
Recent reference events (Oct-Nov 2024): 10

Selected Event: Flood in Haiti
Correlation ID: 20241130-HTI-NAT-HYD-FLO-FLO-1-GCDB
Countries: ['HTI']
Hazard Codes: ['FL']

All items with correlation ID '20241130-HTI-NAT-HYD-FLO-FLO-1-GCDB': 11

Events: 2
Hazards: 2
Impacts: 7

============================================================
IMPACT SUMMARY:
============================================================

  gdacs-impacts:
    Category: people
    Type: relocated
    Value: 60 sendai

  gdacs-impacts:
    Category: people
    Type: affected_total
    Value: 160 sendai

  gdacs-impacts:
    Category: people
    Type: death
    Value: 2 sendai

  emdat-impacts:
    Category: people
    Type: death
    Value: 16.0 count

  emdat-impacts:
    Category: people
    Type: affected_total
    Value: 155025.0 count

  emdat-impacts:
    Category: people
    Type: injured
    Value: 25.0 count

  emdat-impacts:
    Category: people
    Type: affected_total
    Value: 155000.0 count

Step 8 — Temporal Queries with t_intersects

The t_intersects operator tests whether an item’s datetime falls within a given ISO 8601 interval. Pass an interval array of two timestamps.

Cyclone events in last 6 months: 50

Loading...

Step 9 — Focused Impact Analysis Examples

Five targeted queries demonstrating combined hazard + impact + temporal filtering using the official Monty taxonomy.

Key Impact Types
Key Hazard Codes
TypeDescription
deathFatalities
injuredPeople injured
displaced_internalIDPs
displaced_externalRefugees
affected_totalTotal affected
homelessHomeless
Flood: 50 records, 940 deaths reported
Earthquake: 8 records, 602 deaths reported
Cyclone: 50 records, 1,990 deaths reported
Drought: 0 records, 0 deaths reported

✓ Deaths by hazard type analysis complete
Loading...
Found 100 displacement records

Top 10 Countries by Displacement (2024):
  AFG: 1,270,301 people displaced
  CHN: 198,400 people displaced
  IRQ: 170,274 people displaced
  GEO: 48,582 people displaced
  PHL: 44,429 people displaced
  PNG: 21,144 people displaced
  COD: 14,598 people displaced
  ECU: 8,809 people displaced
  TCD: 5,700 people displaced
  PER: 5,521 people displaced
Loading...
Recent Flood Events with Significant Deaths (>10):

Country    Date             Deaths Collection          
-------------------------------------------------------
HTI        2024-12-20           14 emdat-impacts       
IDN        2024-12-03           12 emdat-impacts       
KEN        2024-12-01           13 emdat-impacts       
HTI        2024-11-30           16 emdat-impacts       
MWI        2024-11-27           11 emdat-impacts       
THA        2024-11-25           35 emdat-impacts       
MDG        2024-11-12           16 gdacs-impacts       
ESP        2024-10-27           62 gdacs-impacts       
ESP        2024-10-27          217 gdacs-impacts       
ESP        2024-10-27          217 gdacs-impacts       
ESP        2024-10-27          232 emdat-impacts       
IND        2024-10-04           15 emdat-impacts       
BIH        2024-10-03           14 gdacs-impacts       
BIH        2024-10-03           27 emdat-impacts       
IRN        2024-10-01           15 gdacs-impacts       
Earthquake death: 8 records, 602 people
Earthquake injured: 13 records, 3,156 people
Loading...
Cyclone Events with Significant Affected Population (>1000):

Loading...

Queryables Reference Cheat Sheet

Core Queryables

PropertyTypeDescription
idstringItem identifier
collectionstringCollection identifier
datetimedate-timeEvent/record timestamp
geometryobjectSpatial geometry
rolesarrayItem roles (event, hazard, impact, reference)
monty:episode_numberintegerEpisode number
monty:country_codesarrayISO 3166-1 alpha-3 country codes
monty:corr_idstringCorrelation identifier
monty:hazard_codesarrayHazard classification codes

Hazard Detail Queryables

PropertyTypeDescription
monty:hazard_detail.clusterstringHazard cluster
monty:hazard_detail.severity_valuenumberSeverity / magnitude value
monty:hazard_detail.severity_unitstringUnit of severity
monty:hazard_detail.estimate_typestringprimary, secondary, modelled

Impact Detail Queryables

PropertyTypeDescription
monty:impact_detail.categorystringImpact category (people, buildings, …)
monty:impact_detail.typestringImpact type (death, injured, displaced, …)
monty:impact_detail.valuenumberImpact value
monty:impact_detail.unitstringUnit of measurement
monty:impact_detail.estimate_typestringprimary, secondary, modelled

Array Operators

OperatorDescriptionExample
a_containsArray contains element{"op": "a_contains", "args": [{"property": "monty:country_codes"}, "ESP"]}
a_overlapsArrays share elements{"op": "a_overlaps", "args": [{"property": "monty:hazard_codes"}, ["FL", "MH0600"]]}
a_equalsArrays are equal{"op": "a_equals", "args": [{"property": "monty:country_codes"}, ["ESP"]]}

Temporal Operators

OperatorDescription
t_intersectsTime intersects interval
t_duringTime falls within interval

References
  1. European Commission Joint Research Centre. (2024). Global Disaster Alert and Coordination System (GDACS). https://www.gdacs.org
  2. Guha-Sapir, D. (2024). EM-DAT: The Emergency Events Database. Centre for Research on the Epidemiology of Disasters (CRED). https://www.emdat.be
  3. Asian Disaster Reduction Center. (2024). GLobal IDEntifier Number (GLIDE). https://glidenumber.net
  4. U.S. Geological Survey. (2024). USGS Earthquake Hazards Program. https://earthquake.usgs.gov
  5. Knapp, K. R., Kruk, M. C., Levinson, D. H., Diamond, H. J., & Neumann, C. J. (2024). International Best Track Archive for Climate Stewardship (IBTrACS). NOAA National Centers for Environmental Information. https://www.ncei.noaa.gov/products/international-best-track-archive
  6. Internal Displacement Monitoring Centre. (2024). IDMC Global Internal Displacement Database. https://www.internal-displacement.org