Skip to content

Commit 1fd334e

Browse files
committed
Add the extra required fields to create the stac event item
1 parent ad5da24 commit 1fd334e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pystac_monty/sources/glide.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from shapely.geometry import Point, mapping
88

99
from pystac_monty.extension import MontyExtension
10+
from pystac_monty.hazard_profiles import HazardProfiles
1011
from pystac_monty.sources.common import MontyDataSource
1112

1213

@@ -21,6 +22,8 @@ class GlideTransformer:
2122
Transforms Glide event data into STAC Items
2223
"""
2324

25+
hazard_profiles = HazardProfiles()
26+
2427
glide_events_collection_url = (
2528
"https://github.com/IFRCGo/monty-stac-extension/raw/refs/heads/main/examples/glide-events/glide-events.json"
2629
)
@@ -33,7 +36,7 @@ def make_items(self) -> list[Item]:
3336

3437
""" Create glide event items """
3538
glide_events = self.make_event_items()
36-
items.append(glide_events)
39+
items.extend(glide_events)
3740

3841
return items
3942

@@ -69,11 +72,18 @@ def make_event_items(self) -> list[Item]:
6972
)
7073

7174
item.set_collection(self.get_event_collection())
75+
item.properties["roles"] = ["source", "event"]
7276

7377
MontyExtension.add_to(item)
7478
monty = MontyExtension.ext(item)
75-
monty.hazard_codes = data.get("event")
76-
monty.country_codes = data.get("geocode")
79+
# Since there is no episode_number in glide data,
80+
# we set it to 1 as it is required to create the correlation id
81+
# in the method monty.compute_and_set_correlation_id(..)
82+
monty.episode_number = 1
83+
monty.hazard_codes = [data.get("event")]
84+
monty.country_codes = [data.get("geocode")]
85+
86+
monty.compute_and_set_correlation_id(hazard_profiles=self.hazard_profiles)
7787

7888
item.add_link(Link("via", self.data.get_source_url(), "application/json", "Glide Event Data"))
7989

0 commit comments

Comments
 (0)