Cross-source event matching
This notebook demonstrates the cross-source event pairing methodology. It is an internal working document for sharing and discussing the method: it runs every step on one real event and shows what goes in and what comes out.
The problem. Montandon holds records of disasters from many sources, and each source describes a disaster in its own way: USGS the magnitude, EM-DAT the losses, IDMC the displacement, CEMS the mapping. No shared identifier reliably says that two records are about the same disaster, so the records cannot simply be looked up and joined.
The method, in five steps. Each step is a section below.
Start from one event. The event selected when the run was started.
Decide where and when to look. A time window and a radius around the event. Both depend on the type of hazard.
Collect candidates and read what they carry. Every record from the other sources that falls inside that window, together with its hazard item (for example the magnitude).
Ask Jev. Jev is a decision model. For each candidate it gives the probability that the candidate describes the same disaster as the selected event.
Compare. What the matched records report, including their impacts and responses, goes into a fact sheet, an overview of everything linked, a chart and a map.
Terms used below.
Record: one entry in one source, for example one USGS earthquake or one EM-DAT disaster.
Selected event: the record the matching starts from.
Candidate: a record from another source that is close enough in time and place to be worth checking.
P(same): Jev’s probability that a candidate describes the same disaster as the selected event.
Joined: a candidate whose P(same) is at or above the confidence threshold (default 0.6).
Possible: a candidate with P(same) between 0.3 and the threshold.
Exact link: a link that Montandon itself holds between two records. These join without asking Jev.
Linked items: the hazard, impact and response items that Montandon’s ETL has already linked to a source’s event. They belong to that event by construction, so following the links needs no judgement.
The scores are model estimates. See Limitations at the end.
Source
# --- Reserved parameters (injected by the Notebook Factory; defaults keep the notebook runnable standalone) ---
run_id = ""
inputs_dir = ""
output_dir = "outputs"
area = {} # {id, code, name, level, country, country_name, bbox}
area_geojson = "" # FeatureCollection with the target area
subdivisions_geojson = "" # FeatureCollection with the aggregation subdivisions
stac_item = {} # the selected Montandon event (dict)
stac_item_json = ""
stac_collection = ""
stac_api_url = "" # root of the item's catalog (Montandon)
stac_catalog_profile = "" # "generic" | "montandon"
filters = {} # the run's filter tags
hazard = ""
# --- User parameters ---
confidence_threshold = 0.6 # a candidate joins the event at this probability or more (possible: 0.3 up to it)
max_candidates = 60 # most candidates to judge, the most plausible by time and distance
hazard_windows = """EQ 7 300
TS 7 1500
VO 30 200
LS 7 100
AV 7 100
FL 30 500
FF 14 300
TC 21 2500
ST 14 800
SS 14 800
DR 180 2000
WF 30 300
HT 30 1500
CW 30 1500
EP 90 3000""" # one hazard per line: GLIDE code, days either side of the event, radius in km
default_window_days = 14 # window for a hazard that is not in the table
default_radius_km = 500 # radius for a hazard that is not in the table
coarse_radius_km = 1500 # at least this radius when a record is only located at country level
min_cross_hazard_magnitude = 5.0 # a smaller earthquake (no tsunami flag) is only compared with earthquakes
Source
# Parameters
run_id = "cb9521af-90cd-4b40-8036-05dfcf8e36d0"
inputs_dir = "/app/data/work/cb9521af-90cd-4b40-8036-05dfcf8e36d0/inputs"
output_dir = "/app/data/work/cb9521af-90cd-4b40-8036-05dfcf8e36d0/outputs"
area = {}
area_geojson = ""
subdivisions_geojson = ""
stac_item = {"id": "cems-event-EMSR884", "bbox": [-69.165602, 9.790538, -66.194695, 10.848623], "type": "Feature", "links": [{"rel": "collection", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-events", "type": "application/json", "auth:refs": ["oidc"]}, {"rel": "parent", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-events", "type": "application/json", "auth:refs": ["oidc"]}, {"rel": "root", "href": "https://montandon-eoapi.ifrc.org/stac/", "type": "application/json"}, {"rel": "self", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-events/items/cems-event-EMSR884", "type": "application/geo+json", "auth:refs": ["oidc"]}, {"rel": "via", "href": "https://rapidmapping.emergency.copernicus.eu/EMSR884", "type": "text/html", "title": "CEMS EMSR884 activation"}, {"rel": "via", "href": "https://storymaps.arcgis.com/stories/717d0c07ec434b54ab6b2e0bbd7bc9f6", "type": "text/html", "title": "CEMS situational report (StoryMap)"}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/gdacs-events/items/1548377-1714328", "type": "application/geo+json", "roles": ["event"], "title": "GDACS EQ1548377 (episode 1714328)", "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/charter-events/items/charter-event-1036", "type": "application/geo+json", "roles": ["event"], "title": "Charter activation 1036", "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi00-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi01-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi02-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi03-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi04-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi05-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi06-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi07-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi08-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi09-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi10-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi11-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-hazards/items/cems-hazard-EMSR884-aoi12-earthquake", "type": "application/geo+json", "roles": ["hazard"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi00-dat-sentinel1_20260625_2242_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi00-dat-sentinel1_20260624_2249_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi00-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi01-dat-legion_20260627_1348_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi01-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi02-dat-pneo_20260625_1459_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi02-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi02-dat-pneo_20260626_1519_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi02-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi03-dat-legion_20260625_1517_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi03-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi04-dat-worldview3_20260627_1530_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi04-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi05-dat-worldview3_20260626_1510_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi05-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi05-dat-worldview3_20260627_1530_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi05-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi06-dat-legion_20260625_2036_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi06-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi06-dat-legion_20260626_1511_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi06-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi07-dat-legion_20260626_1403_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi07-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi07-dat-legion_20260627_1516_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi07-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-dat-pneo_20260625_1500_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-dat-legion_20260625_2037_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-dat-legion_20260626_2020_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-dat-pneo_20260626_1518_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-dat-worldview2_20260705_1517_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi08-gra-m2", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi09-dat-legion_20260626_1404_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi09-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi10-dat-pneo_20260625_1459_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi10-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi11-dat-pneo_20260626_1519_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi11-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi12-dat-legion_20260626_1510_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi12-gra", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi12-gra-m1", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi12-dat-geoeye1_20260705_1505_ortho", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-aoi12-gra-m2", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-response/items/cems-response-EMSR884-sr", "type": "application/geo+json", "roles": ["response"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-total", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra->-0.5-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-<-0.5-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0-m-to-0.05-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.05-m-to-0-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.1-m-to-0.2-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.2-m-to-0.5-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.05-m-to-0.1-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.2-m-to-0.1-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.5-m-to-0.2-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi00-gra-0.1-m-to-0.05-m", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-builtup", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-population", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-builtup-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-transportation-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-population-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi02-gra-roads-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi05-gra-builtup", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi05-gra-population", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi06-gra-builtup-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi06-gra-population-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi06-gra-builtup", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi06-gra-population", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi08-gra-builtup", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi08-gra-population", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi08-gra-builtup-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi08-gra-population-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-builtup-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-facilities-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-camps-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-transportation-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-population-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-roads-m2", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-builtup-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-facilities-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-camps-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-transportation-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-population-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-roads-m1", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-builtup", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-transportation", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}, {"rel": "related", "href": "https://montandon-eoapi.ifrc.org/stac/collections/cems-impacts/items/cems-impact-EMSR884-aoi12-gra-population", "type": "application/geo+json", "roles": ["impact"], "auth:refs": ["oidc"]}], "assets": {}, "geometry": {"type": "Point", "coordinates": [-67.80859040143667, 10.277062692317687]}, "collection": "cems-events", "properties": {"roles": ["event", "source"], "title": "Earthquake in Venezuela", "datetime": "2026-06-24T16:04:00Z", "keywords": ["EMSR884", "Earthquake", "Geological", "Ground shaking", "Seismic"], "description": "On 24 Jun 2026 22:05 UTC a 7.5M earthquake, preceded by a strong foreshock, occurred in Venezuela. The impact on population was deemed high at the beginning, with low visibility on the extent of the damage. This is why Copernicus EMS Rapid Mapping was requested to provide damage assessment emergency mapping.", "auth:schemes": {"oidc": {"type": "openIdConnect", "openIdConnectUrl": "https://goadmin.ifrc.org/o/.well-known/openid-configuration"}}, "monty:etl_id": "fcab5189-880e-47d5-bf10-d4b3a0f0fb93", "monty:corr_id": "20260624-VEN-902362-GH0101-1-GCDB", "monty:hazard_codes": ["GH0101", "EQ", "nat-geo-ear-gro"], "processing:version": "0.2.7", "monty:country_codes": ["VEN"], "processing:software": {"pystac-monty": "0.2.7"}, "monty:episode_number": 1}, "stac_version": "1.1.0", "stac_extensions": ["https://ifrcgo.org/monty-stac-extension/v1.3.0/schema.json", "https://stac-extensions.github.io/processing/v1.2.0/schema.json", "https://stac-extensions.github.io/authentication/v1.1.0/schema.json"]}
stac_item_json = "/app/data/work/cb9521af-90cd-4b40-8036-05dfcf8e36d0/inputs/stac_item.json"
stac_collection = "cems-events"
stac_api_url = "https://montandon-eoapi.ifrc.org/stac"
stac_catalog_profile = "montandon"
filters = {"hazard": ["earthquake"], "use_case": ["other"]}
hazard = "earthquake"
hazard_windows = "EQ 7 300\r\nTS 7 1500\r\nVO 30 200\r\nLS 7 100\r\nAV 7 100\r\nFL 30 500\r\nFF 14 300\r\nTC 21 2500\r\nST 14 800\r\nSS 14 800\r\nDR 180 2000\r\nWF 30 300\r\nHT 30 1500\r\nCW 30 1500\r\nEP 90 3000"
max_candidates = 150
coarse_radius_km = 1500
default_radius_km = 500
default_window_days = 14
confidence_threshold = 0.6
min_cross_hazard_magnitude = 5.0
1. The selected event¶
This is the record the matching starts from. Every other record is compared with it, so its source, hazard type, date and countries decide where and when the search looks.
Source
import os
import sys
from pathlib import Path
import pandas as pd
from IPython.display import display
from manywidgets import Chart, Column, Legend, RangeSlider, Row, Stat
sys.path.insert(0, str(Path.cwd())) # the helper module ships next to the notebook
import matching as M
api_url = stac_api_url or os.environ.get("STAC_API_URL", "")
token = os.environ.get("STAC_API_KEY", "")
if not stac_item or not api_url:
raise RuntimeError("Select a Montandon event when starting the run: it is the event to match.")
seed = M.record_from_item(stac_item)
rules = M.Rules.from_params(
hazard_windows, default_window_days, default_radius_km, coarse_radius_km, min_cross_hazard_magnitude
)
Row(
Stat(label="Source", value=M.SOURCE_LABELS.get(seed.source, seed.source)),
Stat(label="Hazard", value=M.HAZARD_LABELS.get(seed.glide, "unknown").capitalize()),
Stat(label="Event", value=seed.title),
Stat(label="Source event ID", value=seed.source_id),
Stat(label="Date", value=seed.start.date().isoformat() if seed.start else "unknown"),
Stat(label="Countries", value=", ".join(seed.countries) or "unknown"),
gap="16px",
)
2. Where and when to look¶
Records of the same disaster rarely carry the same date or place. A register such as EM-DAT dates a disaster to a day and places it in a country. A satellite activation can start a day or more later. A seismic catalogue gives an exact point. To allow for this the search uses a window around the selected event: a number of days before and after its dates, and a radius in kilometres around its location.
The window depends on the hazard. An earthquake is over within days, a flood or a cyclone unfolds over weeks, and a drought over months. The table below is the rule set used. It is a run-form parameter, and the row for this event’s hazard is highlighted. Records that a source only places at country level are kept when they share a country with the selected event, whatever their distance.
Source
window = M.search_window(seed, rules)
display(Row(
Stat(label="Search from", value=f"{window.first:%d %b %Y}"),
Stat(label="Search to", value=f"{window.last:%d %b %Y}"),
Stat(label="Window", value=f"\u00b1 {window.days} days"),
Stat(label="Radius", value=f"{window.radius_km} km"),
gap="16px",
))
print(
f"The selected event started on {seed.start:%d %b %Y}, so the search accepts records that start between "
f"{window.first:%d %b %Y} and {window.last:%d %b %Y}."
)
if window.countries:
print("Records placed in " + ", ".join(window.countries) + " are also asked for, wherever in the country they are.")
rule_rows = pd.DataFrame(
[{"Hazard": M.HAZARD_LABELS.get(code_, code_).capitalize(), "Code": code_, "Days either side": d, "Radius (km)": km}
for code_, (d, km) in rules.windows.items()]
)
(
rule_rows.style.apply(lambda row: ["background-color: #fbd9b8" if row["Code"] == seed.glide else "" for _ in row], axis=1)
.set_properties(**{"text-align": "left"})
.set_table_styles([{"selector": "th", "props": "text-align: left;"}])
.hide(axis="index")
)The selected event started on 24 Jun 2026, so the search accepts records that start between 17 Jun 2026 and 01 Jul 2026.
Records placed in VEN are also asked for, wherever in the country they are.
3. Candidates¶
The catalogue is asked for every record, from every source, that starts inside the window and is either in the same country or inside the box around the selected event. A record carrying the same Montandon correlation id as the selected event is always added, even outside the window.
Records from the selected event’s own source are left out unless Montandon links them to it. When a source files several episodes of one event, only the one closest in time and distance is kept. The rest are ranked by how close they are in time and distance and cut to the number set in the run form (max_candidates), so a busy window can hide a record.
Nothing is judged here. A candidate is only a record worth asking about. The table shows how far in days and kilometres each one is from the selected event, and why it was kept.
Source
candidates, searched = M.find_candidates(api_url, token, seed, max_candidates, rules)
exact = M.exact_links(seed, candidates) # records Montandon links to the event: they skip Jev
by_id = {c.id: c for c in candidates}
display(Row(
Stat(label="Records in the window", value=searched),
Stat(label="Candidates kept", value=len(candidates)),
Stat(label="Sources", value=len({c.source for c in candidates})),
Stat(label="Exact links", value=len(exact)),
gap="16px",
))
if searched > len(candidates):
print(f"{searched - len(candidates)} further records were in the window; only the {len(candidates)} closest are kept.")
(
M.candidate_table(seed, candidates, exact, rules)
.style.set_properties(**{"text-align": "left"})
.set_properties(subset=["Date"], **{"white-space": "nowrap"})
.set_table_styles([{"selector": "th", "props": "text-align: left;"}])
.hide(axis="index")
if candidates else print("No other source has a record in this window.")
)24 further records were in the window; only the 150 closest are kept.
The candidates on a map¶
The grey box is the area asked of the catalogue. The orange circle is the hazard’s radius, applied to records with a precise location. Each dot is a candidate, coloured by its source, and the selected event has a larger dot with a black outline. Records that a source places only at country level are drawn at the single point the source gives.
Source
import geopandas as gpd
import numpy as np
from lonboard import Map, PolygonLayer, ScatterplotLayer
from lonboard.layer_extension import DataFilterExtension
from manywidgets.lonboard import FilterBinder, LayerToggle
from shapely.geometry import box, shape
def rgb(hex_color, alpha=230):
h = hex_color.lstrip("#")
return [int(h[i : i + 2], 16) for i in (0, 2, 4)] + [alpha]
if seed.point is None or window.bbox is None:
print("The selected event has no location, so there is nothing to draw.")
else:
placed = [(seed, "selected event")] + [(c, "candidate") for c in candidates if c.point]
labels = [M.SOURCE_LABELS.get(rec.source, rec.source) for rec, _ in placed]
gdf = gpd.GeoDataFrame(
{"title": [rec.title for rec, _ in placed], "source": labels,
"source event ID": [rec.source_id for rec, _ in placed],
"date": [rec.start.date().isoformat() if rec.start else "" for rec, _ in placed],
"role": [role for _, role in placed]},
geometry=gpd.points_from_xy([rec.point[0] for rec, _ in placed], [rec.point[1] for rec, _ in placed]),
crs="EPSG:4326",
)
seed_flags = np.arange(len(placed)) == 0
area_layers = [
PolygonLayer.from_geopandas(
gpd.GeoDataFrame({"name": ["Area asked of the catalogue"]}, geometry=[box(*window.bbox)], crs="EPSG:4326"),
get_fill_color=[120, 120, 120, 18], get_line_color=[90, 90, 90, 220], line_width_min_pixels=2, stroked=True,
),
PolygonLayer.from_geopandas(
gpd.GeoDataFrame({"name": [f"{window.radius_km} km radius"]},
geometry=[shape(M.circle_polygon(seed.point, window.radius_km))], crs="EPSG:4326"),
get_fill_color=[213, 94, 0, 25], get_line_color=[213, 94, 0, 230], line_width_min_pixels=2, stroked=True,
),
]
dots = ScatterplotLayer.from_geopandas(
gdf,
get_fill_color=np.array([rgb(M.COLOR_BY_LABEL.get(label, "#777777")) for label in labels], dtype=np.uint8),
get_line_color=np.where(seed_flags[:, None], [0, 0, 0, 255], [255, 255, 255, 220]).astype(np.uint8),
get_radius=np.where(seed_flags, 12, 7), radius_units="pixels", stroked=True, line_width_min_pixels=2,
pickable=True, auto_highlight=True,
)
west, south, east, north = window.bbox
view = M.map_view([(west, south), (east, north)])
legend = Legend(entries=[[M.COLOR_BY_LABEL.get(s, "#777777"), s] for s in dict.fromkeys(labels)], title="Source")
toggles = [LayerToggle(layer=area_layers[0], label="Search box"), LayerToggle(layer=area_layers[1], label="Radius")]
display(Column(Row(legend, *toggles, gap="24px"),
Map([*area_layers, dots], show_tooltip=True, height=520, view_state=view), gap="12px"))
if len(placed) - 1 < len(candidates):
print(f"{len(candidates) - len(placed) + 1} candidates have no location and are not drawn.")4. What each candidate carries¶
Within one source, Montandon already knows which items belong together. When the ETL loads a source it links every source event to that source’s own hazard, impact and response items. These links are deterministic: following them needs no judgement, and Jev is never asked to compare, for instance, a USGS hazard with a USGS impact.
The notebook follows those links in two steps.
Now, for the selected event and every candidate: the hazard item. It holds the size of the hazard, such as an earthquake’s magnitude or a cyclone’s wind speed. Some sources, EM-DAT for example, keep it on the hazard item and not on the event. Without this step Jev would read “an earthquake in Hatay” with no magnitude. The highest value per unit is added to what Jev reads. Two kinds of value are left out because they are not a measurement of the hazard itself: alert scores (GDACS and GFD publish a score for the alert, GLIDE a level) and extents (CEMS and the Charter give the area or radius of the activation). Only measurements such as a magnitude or a wind speed are kept.
Later, for the joined events only: the impacts and the responses. They are not sent to Jev. Sources disagree on impact figures by design, so a different death toll is no evidence of a different disaster. They are shown in section 7.
Source
hazards = M.fetch_details(api_url, token, [seed, *candidates], roles=("hazard",))
seed, *candidates = M.add_severity([seed, *candidates], hazards)
by_id = {c.id: c for c in candidates} # the candidates now carry their severity
carrying = [rec for rec in (seed, *candidates) if rec.severity and rec.magnitude is None] # the severity is read for these
display(Row(
Stat(label="Records checked", value=len(candidates) + 1),
Stat(label="Severity added for Jev", value=len(carrying)),
gap="16px",
))
if carrying:
print("The severity added to what Jev reads. Records that carry a magnitude of their own, such as USGS, keep it and are not listed:")
display(
pd.DataFrame({
"Source": [M.SOURCE_LABELS.get(r.source, r.source) for r in carrying],
"Source event ID": [r.source_id for r in carrying],
"Title": [r.title for r in carrying],
"Severity from the hazard item": ["; ".join(f"{v:g} {u}".strip() for v, u in r.severity) for r in carrying],
})
.style.set_properties(**{"text-align": "left"})
.set_table_styles([{"selector": "th", "props": "text-align: left;"}])
.hide(axis="index")
)
else:
print("No record needed a severity from its hazard item.")The severity added to what Jev reads. Records that carry a magnitude of their own, such as USGS, keep it and are not listed:
5. Asking Jev¶
Jev is a decision model: it answers a question about some data with a probability instead of a plain yes or no. Here the question is “Does this candidate describe the same disaster as the selected event?”, asked once for every candidate.
What is sent.
Candidates are sent one source at a time, at most 25 per request, so Jev compares a candidate with the other records of its own source. That helps when a source holds several records near the selected event.
Each request holds the selected event (called the anchor) and the candidates, each described in words and facts: the kind of record, title, description, hazard type, start and end date, the magnitude when the record has one (or the severity read from its hazard item in section 4), and the countries.
The days and kilometres between the candidate and the selected event are measured here and passed along. Jev takes them as given.
Jev does not see record ids, codes, impact figures, responses or links.
Alongside the yes/no question for each candidate there are two more: which candidate is the best match, and whether any candidate matches at all.
What comes back. One probability per candidate, called P(same). Exact links are not sent: they join at 100% because Montandon itself links them.
The next cell shows what a request contains. The one after sends them.
Source
import json
to_ask = [c for c in candidates if c.id not in exact]
groups = M.jev_groups(to_ask)
display(Row(
Stat(label="Candidates sent to Jev", value=len(to_ask)),
Stat(label="Requests", value=len(groups)),
Stat(label="Skipped (exact link)", value=len(exact)),
gap="16px",
))
if groups:
print("Requests, one source at a time:")
for group in groups:
print(f" {M.SOURCE_LABELS.get(group[0].source, group[0].source):12s} {len(group)} candidates")
closest = to_ask[0] # the candidates are ranked by closeness, so this is the closest one
group = next(g for g in groups if closest in g)
key = f"candidate_{group.index(closest) + 1}" # its name inside the request
request = M.listwise_request(M.DEFAULT_MODEL, seed, group, rules)
example = request["questions"][f"same_{key}"]
print("\nThe selected event, as Jev reads it:")
print(json.dumps(request["state"]["anchor"], indent=2, ensure_ascii=False))
print("\nThe closest candidate, as Jev reads it (the last two lines are measured here, not read from the record):")
print(json.dumps(request["state"]["candidates"][key], indent=2, ensure_ascii=False))
print("\nThe question asked about that candidate:")
print(example["instructions"])
print(" true :", example["criteria"]["true"])
print(" false:", example["criteria"]["false"])
else:
print("There is nothing to send to Jev: every candidate is an exact link, or there are no candidates.")Requests, one source at a time:
EM-DAT 1 candidates
GDACS 11 candidates
GLIDE 1 candidates
IDMC (IDU) 3 candidates
IFRC 1 candidates
PDC 25 candidates
PDC 25 candidates
PDC 7 candidates
USGS 25 candidates
USGS 25 candidates
USGS 24 candidates
The selected event, as Jev reads it:
{
"kind": "Copernicus EMS activation",
"title": "Earthquake in Venezuela",
"description": "On 24 Jun 2026 22:05 UTC a 7.5M earthquake, preceded by a strong foreshock, occurred in Venezuela. The impact on population was deemed high at the beginning, with low visibility on the extent of the damage. This is why Copernicus EMS Rapid Mapping was requested to provide damage assessment emergency mapping.",
"hazard": "earthquake",
"starts": "2026-06-24",
"ends": "2026-06-24",
"countries": [
"VEN"
]
}
The closest candidate, as Jev reads it (the last two lines are measured here, not read from the record):
{
"kind": "EM-DAT disaster database record",
"title": "Ground movement in Venezuela (Bolivarian Republic of)",
"description": "Earthquake in Caracas, Trujillo, Carabobo, Aragua, Miranda, La Guaira states., Venezuela (Bolivarian Republic of) of June 2026",
"hazard": "earthquake",
"starts": "2026-06-24",
"ends": "2026-06-24",
"severity": [
"7.5 Moment Magnitude"
],
"countries": [
"VEN"
],
"days_apart": 0,
"km_apart": 75
}
The question asked about that candidate:
Does `candidates.candidate_1` describe the same disaster as `anchor`? The candidates are records from one source. None, one or several may describe the same disaster as the anchor: a source can hold several records of one disaster, such as an alert for each shock. Judge every candidate against the anchor and against the other candidates; a candidate that fits the anchor worse than a rival, or differs in place or date, is probably a different disaster. `days_apart` and `km_apart` were measured by the application between the anchor and that candidate; take them as given. Aftershocks minutes or hours after a main shock belong to the same disaster; a separate strong earthquake days or weeks later does not.
true : `candidates.candidate_1` is about the same physical disaster as `anchor`, whatever its date precision, location detail or wording.
false: `candidates.candidate_1` is a different disaster: a separate earthquake, a later flood or storm, a different hazard, or a distant region.
Jev’s answers¶
The requests are sent now. The result is one row per candidate with its P(same), sorted from most to least likely, in the table below. A candidate at or above the confidence threshold is joined. One between 0.3 and the threshold is possible. The threshold is a run-form parameter, and the map further down has a slider to change it afterwards.
The cost of the calls is printed under the counts. Without an OPENROUTER_API_KEY secret nothing is sent: the candidates are listed without a score, and only exact links join.
Source
api_key = os.environ.get("OPENROUTER_API_KEY", "")
jev = M.ask_jev(seed, to_ask, api_key, rules=rules)
matches = M.match_table(candidates, exact, jev.scores)
if not api_key:
print("No OPENROUTER_API_KEY: the candidates are not scored, and only exact links join the event.")
for error in jev.errors:
print("A Jev call failed, its candidates have no score:", error)
joined = matches[matches.p_same >= confidence_threshold]
possible = matches[(matches.p_same >= 0.3) & (matches.p_same < confidence_threshold)]
display(Row(
Stat(label="Candidates", value=len(matches)),
Stat(label=f"Joined (P at least {confidence_threshold:g})", value=len(joined)),
Stat(label=f"Possible (0.3 to {confidence_threshold:g})", value=len(possible)),
gap="16px",
))
if api_key:
print(f"Jev scored {len(jev.scores)} of {len(to_ask)} candidates in {len(groups)} requests, cost ${jev.cost:.4f}.")
(
matches[["source", "source_id", "title", "date", "p_same", "why"]]
.rename(columns={"source": "Source", "source_id": "Source event ID", "title": "Title", "date": "Date", "p_same": "P(same)", "why": "Decided by"})
.style.format({"P(same)": "{:.0%}"})
.background_gradient(subset=["P(same)"], cmap="Greens", vmin=0, vmax=1)
.set_properties(**{"text-align": "left"})
.set_properties(subset=["Date"], **{"white-space": "nowrap"})
.set_table_styles([{"selector": "th", "props": "text-align: left;"}])
.hide(axis="index")
if len(matches) else print("No other source has a record in this window.")
)Jev scored 148 of 148 candidates in 11 requests, cost $0.0034.
6. Fact sheet¶
The joined records are now treated as one disaster. The fact sheet puts what each source reports side by side: one column per source, one row per measure. It starts with the source’s own event ID, then holds the dates and countries, the hazard magnitude, the main people figures and economic loss, and then every other hazard measure, other impact figure and response count that Montandon has linked to the joined events. Section 7 lists the same values item by item.
Orange cells mark rows where the sources disagree: the largest figure is at least 1.5 times the smallest. Only figures in the same unit are compared.
An asterisk (*) marks a modelled figure: an estimate by the source (USGS PAGER), not a report.
A source can hold several records of the disaster. Copernicus figures are summed over its areas of interest, a register’s records for different countries (EM-DAT, GLIDE) are added up, and otherwise the largest figure is shown.
A disagreement is a result, not an error. Sources measure different things, so the sheet shows the differences and does not choose between them.
Source
events = [seed] + [by_id[i] for i in joined.id]
linked = M.fetch_details(api_url, token, events, roles=("impact", "response")) # now the impacts and the responses
details = M.merge_details(hazards.only({e.id for e in events}), linked)
facts = M.fact_sheet(events, details.rows, details.items)
M.display_table(facts)7. Everything linked to the joined events¶
The same values as the fact sheet, item by item, each with the event it belongs to. The table lists every value that Montandon holds for the joined events, source by source, in four kinds of item.
Event: the record itself, with its dates, countries and hazard codes.
Hazard: the size of the hazard. A hazard with many items (a storm track, for example) is summarised by its highest value.
Impact: each figure with its unit and whether it is reported or modelled. Impacts for different categories (people, buildings, cost) are separate rows.
Response: the satellite and mapping products that CEMS and the Charter made for the event. They are counted by type and status.
The values are not reconciled: the table is the raw material for comparing what the sources say about one disaster.
Source
overview = M.overview_table(events, details)
print(f"{len(overview)} values from {overview['Source'].nunique()} sources, linked to {len(events)} joined events.")
M.display_overview(overview)131 values from 8 sources, linked to 15 joined events.
8. Figures by source¶
The same numbers as bars, one bar per source, for deaths, people affected and people displaced. Bars that differ a lot show the sources disagreeing. A source with no figure for a measure has no bar. Modelled figures are labelled.
Source
def metric_chart(label, title):
columns = [c for c in facts.columns[:-2] if label in facts.index and pd.notna(facts.loc[label, c])]
if not columns:
return None
chart = Chart(chart_type="bar", title=title, width=700, height=300)
chart.set_options(scales={"x": {"type": "category"}, "y": {"beginAtZero": True}})
for col in columns:
name = col + (" (modelled)" if (label, col) in facts.attrs["modelled"] else "")
chart.add_series(x=[label], y=[float(facts.loc[label, col])], name=name, series_type="bar",
color=M.COLOR_BY_LABEL.get(col))
return chart
charts = [c for c in (metric_chart("Deaths", "Deaths"), metric_chart("People affected", "People affected"),
metric_chart("People displaced", "People displaced")) if c]
chart_view = Column(*charts, gap="12px") if charts else None
if chart_view is None:
print("No joined source reported deaths, people affected or people displaced.")
chart_view
9. Map of the matched records¶
Every candidate, coloured by source. The slider sets the minimum confidence: records appear and disappear as it moves, including in the published page, so the effect of the threshold can be seen directly. The selected event has a larger marker. Footprints are precise areas from the sources (Copernicus EMS areas, shake areas), never country outlines, and can be switched on and off.
Source
located = [(seed, 1.0, "selected event")] + [
(by_id[r.id], r.p_same, r.why) for r in matches.itertuples() if by_id[r.id].point
]
labels = [M.SOURCE_LABELS.get(rec.source, rec.source) for rec, _, _ in located]
points_gdf = gpd.GeoDataFrame(
{"title": [rec.title for rec, _, _ in located], "source": labels,
"source event ID": [rec.source_id for rec, _, _ in located],
"P(same)": [round(p, 2) for _, p, _ in located], "why": [why for _, _, why in located]},
geometry=gpd.points_from_xy([rec.point[0] for rec, _, _ in located], [rec.point[1] for rec, _, _ in located]),
crs="EPSG:4326",
)
is_seed = np.arange(len(located)) == 0
points = ScatterplotLayer.from_geopandas(
points_gdf,
get_fill_color=np.array([rgb(M.COLOR_BY_LABEL.get(label, "#777777")) for label in labels], dtype=np.uint8),
get_line_color=np.where(is_seed[:, None], [0, 0, 0, 255], [255, 255, 255, 220]).astype(np.uint8),
get_radius=np.where(is_seed, 12, 7),
radius_units="pixels", stroked=True, line_width_min_pixels=2,
pickable=True, auto_highlight=True,
extensions=[DataFilterExtension(filter_size=1)],
get_filter_value=points_gdf["P(same)"].to_numpy(dtype="float32"),
filter_range=(confidence_threshold, 1.0),
)
shapes = M.footprints(events, details)
layers, controls = [], []
if shapes:
shape_gdf = gpd.GeoDataFrame.from_features(shapes, crs="EPSG:4326")[["source", "title", "geometry"]]
footprint_layer = PolygonLayer.from_geopandas(
shape_gdf, get_fill_color=[213, 94, 0, 45], get_line_color=[213, 94, 0, 230],
line_width_min_pixels=1, stroked=True, pickable=True,
)
layers.append(footprint_layer)
controls.append(LayerToggle(layer=footprint_layer, label="Precise footprints"))
layers.append(points)
# open on the records that joined, not on every candidate (the filter hides the rest)
view = M.map_view([(rec.point[0], rec.point[1]) for rec, p, _ in located if p >= confidence_threshold])
slider = RangeSlider(min=0, max=1, low=confidence_threshold, high=1.0, step=0.05,
label="Minimum confidence: probability that the record is the same disaster")
binder = FilterBinder(slider, points)
legend = Legend(entries=[[M.COLOR_BY_LABEL.get(s, "#777777"), s] for s in dict.fromkeys(labels)], title="Source")
Column(Row(legend, *controls, gap="24px"), slider, binder, Map(layers, show_tooltip=True, height=520, view_state=view), gap="12px")
Limitations¶
Scores are model estimates. Jev reads titles, dates, places and magnitudes and returns a probability. It can be wrong in both directions. The default confidence threshold is 0.6.
Aftershocks. Earthquakes close to the selected event in time and place, such as aftershocks, are not handled separately. Jev can score a small aftershock as highly as the main shock, and they appear among the candidates. How to treat them is an open question for subject matter experts.
Linked items. Hazards, impacts and responses come from the links the ETL writes within each source. An event without such links shows nothing beyond its own fields. Only the hazard severity goes to Jev, and alert scores (GDACS, GFD, GLIDE) and extents (CEMS, Charter) are left out of everything. Impact figures and responses are shown and not used for matching, a choice to revisit. Responses are counted by type and status, not listed one by one.
Search scope. The search starts from the selected record. Records outside the time window and radius are not found; both are run-form parameters. Other records of the selected event’s own source are not candidates unless Montandon links them. Candidates are capped at the most plausible by time and distance, so a very busy window can hide a record.
Exact links. Only Montandon’s
relatedevent links join without Jev, and few exist so far (CEMS to GDACS and Charter). A record with the selected event’smonty:corr_idis always a candidate, including outside the time window and radius and first when the list is capped, but it is scored like any other. A correlation id stands for one date, one country and one hazard type: it can cover separate events of the same day, and it does not cover a disaster’s records in other countries or on other dates. No link is inferred from an id or a register number.Disagreement. Differing figures are not treated as errors. Sources measure different things: reported against modelled, deaths against killed or missing, a country against an area of interest. Modelled figures carry an asterisk. EM-DAT publishes damage in thousands of US dollars, but its catalogue unit says only “count”, so amounts in different units are never compared.