Skip to content

Commit 3dab591

Browse files
committed
usgs-eq: apply total bootstrap enrichment pack (2026-03-12)
Enrichment patches 01-06 from the enrichment pack: - Patch 01: 4 new URL constants (detail doc, lifecycle, event terms, FDSN), feed variant dict (11 variants), 3 helper functions - Patch 02: Enriched procedure (7 doc links, updated description, 4 characteristics: Pattern C, variant strategy, detail policy) - Patch 03: Enriched system documents (7 links), feed_surface and feed_lifecycle characteristics, enrichment_policy capability - Patch 04: Enriched datastream docs (5 links), 6 characteristics including omitted-but-available summary fields documentation - Patch 05: Enriched deployments (root 4 links, feed 4 links, updated feed description) - Patch 06: Config recommendation preserved (all_day/60s default) Metadata-only enrichment — no runtime or observation contract changes. Preserves Pattern C feed-adapter architecture. Bootstrap re-run with --clean to push enriched metadata to server. Publisher restarted and publishing 280 events on first cycle.
1 parent b561fcd commit 3dab591

1 file changed

Lines changed: 101 additions & 24 deletions

File tree

publishers/usgs_eq/bootstrap_usgs_eq.py

Lines changed: 101 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,38 @@
6767
USGS_EQ_GLOSSARY = "https://earthquake.usgs.gov/data/comcat/index.php"
6868
USGS_EQ_FEED_URL = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson"
6969

70+
# ── Enrichment Pack URLs (2026-03-12) ────────────────────────────────────
71+
USGS_EQ_DETAIL_DOC = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson_detail.php"
72+
USGS_EQ_LIFECYCLE = "https://earthquake.usgs.gov/earthquakes/feed/policy.php"
73+
USGS_EQ_EVENT_TERMS = "https://earthquake.usgs.gov/data/comcat/data-eventterms.php"
74+
USGS_EQ_FDSN_EVENT_API = "https://earthquake.usgs.gov/fdsnws/event/1/"
75+
76+
USGS_EQ_FEED_VARIANTS = {
77+
"all_hour": "All earthquakes, past hour",
78+
"all_day": "All earthquakes, past day",
79+
"all_week": "All earthquakes, past week",
80+
"all_month": "All earthquakes, past month",
81+
"significant_hour": "Significant earthquakes, past hour",
82+
"significant_day": "Significant earthquakes, past day",
83+
"significant_week": "Significant earthquakes, past week",
84+
"significant_month": "Significant earthquakes, past month",
85+
"1.0_hour": "Magnitude 1.0+, past hour",
86+
"2.5_day": "Magnitude 2.5+, past day",
87+
"4.5_week": "Magnitude 4.5+, past week",
88+
}
89+
90+
91+
def _summary_feed_url(variant: str) -> str:
92+
return f"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/{variant}.geojson"
93+
94+
95+
def _detail_url(event_id: str) -> str:
96+
return f"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/{event_id}.geojson"
97+
98+
99+
def _fdsn_query_url(event_id: str) -> str:
100+
return f"https://earthquake.usgs.gov/fdsnws/event/1/query.geojson?format=geojson&eventid={event_id}"
101+
70102
# ── Contact ──────────────────────────────────────────────────────────────
71103
USGS_CONTACT_ORG = "U.S. Geological Survey (USGS)"
72104
USGS_CONTACT_URL = "https://www.usgs.gov/"
@@ -90,17 +122,26 @@ def _load_config() -> dict:
90122
"featureType": "sml:SimpleProcess",
91123
"name": "USGS Earthquake Feed Normalizer",
92124
"description": (
93-
"Procedure describing how the OSHConnect-Python USGS Earthquake publisher "
94-
"normalizes GeoJSON earthquake events from the USGS Earthquake Hazards Program "
95-
"into individual CSAPI observations. The publisher polls the USGS GeoJSON summary "
96-
"feed, extracts each earthquake feature, and publishes a normalized observation "
97-
"with event metadata (magnitude, location, depth, status) to a single CSAPI "
98-
"datastream. Deduplication uses (event ID, updated timestamp) tuples."
125+
"Procedure describing how the OSHConnect-Python USGS earthquake publisher "
126+
"polls an official USGS GeoJSON summary feed, normalizes each feature into "
127+
"one CSAPI observation, and exposes a per-event detail link for richer "
128+
"drill-down. The baseline runtime uses the summary feed only; detail-feed "
129+
"and FDSN resources are documented as selective enrichment companions."
99130
),
100131
"documentation": [
101132
{"title": "USGS Earthquake Hazards Program", "href": USGS_EQ_HOME, "rel": "about"},
102133
{"title": "GeoJSON Summary Feed", "href": USGS_EQ_FEED_DOC, "rel": "documentation"},
103-
{"title": "ComCat Data Glossary", "href": USGS_EQ_GLOSSARY, "rel": "describedby"},
134+
{"title": "GeoJSON Detail Feed", "href": USGS_EQ_DETAIL_DOC, "rel": "documentation"},
135+
{"title": "Feed Lifecycle Policy", "href": USGS_EQ_LIFECYCLE, "rel": "policy"},
136+
{"title": "ComCat Documentation", "href": USGS_EQ_GLOSSARY, "rel": "describedby"},
137+
{"title": "Event Terms", "href": USGS_EQ_EVENT_TERMS, "rel": "describedby"},
138+
{"title": "FDSN Event API", "href": USGS_EQ_FDSN_EVENT_API, "rel": "service"},
139+
],
140+
"characteristics": [
141+
{"label": "Observation Pattern", "value": "Pattern C feed adapter"},
142+
{"label": "Default Feed Variant", "value": "all_day"},
143+
{"label": "Variant Strategy", "value": "Feed variant is configurable and should be treated as runtime policy, not a different data model"},
144+
{"label": "Detail Enrichment Policy", "value": "Optional and selective; not required for every polling cycle"},
104145
],
105146
},
106147
}
@@ -179,10 +220,13 @@ def _system_sml(config: dict) -> dict:
179220
},
180221
],
181222
"documents": [
182-
{"name": "USGS Earthquake Hazards Program", "description": "Data source homepage", "link": {"href": USGS_EQ_HOME}},
183-
{"name": "GeoJSON Summary Feed Documentation", "description": "Feed format and variant documentation", "link": {"href": USGS_EQ_FEED_DOC}},
184-
{"name": "ComCat Data Glossary", "description": "Parameter definitions and data catalog", "link": {"href": USGS_EQ_GLOSSARY}},
185-
{"name": "USGS About", "description": "About the U.S. Geological Survey", "link": {"href": USGS_EQ_ABOUT}},
223+
{"name": "USGS Earthquake Hazards Program", "description": "Program home", "link": {"href": USGS_EQ_HOME}},
224+
{"name": "GeoJSON Summary Feed Documentation", "description": "Summary feed format and variant documentation", "link": {"href": USGS_EQ_FEED_DOC}},
225+
{"name": "GeoJSON Detail Feed Documentation", "description": "Detail feed structure and product documentation", "link": {"href": USGS_EQ_DETAIL_DOC}},
226+
{"name": "Feed Lifecycle Policy", "description": "Production feed availability and deprecation policy", "link": {"href": USGS_EQ_LIFECYCLE}},
227+
{"name": "ComCat Documentation", "description": "Catalog and product documentation", "link": {"href": USGS_EQ_GLOSSARY}},
228+
{"name": "Event Terms", "description": "Official field semantics", "link": {"href": USGS_EQ_EVENT_TERMS}},
229+
{"name": "FDSN Event API", "description": "Official query interface for targeted retrieval and future backfill", "link": {"href": USGS_EQ_FDSN_EVENT_API}},
186230
],
187231
"characteristics": [
188232
{
@@ -219,6 +263,25 @@ def _system_sml(config: dict) -> dict:
219263
{"type": "Text", "name": "md", "label": "md", "value": "Duration magnitude"},
220264
],
221265
},
266+
{
267+
"name": "feed_surface",
268+
"type": "DataRecord",
269+
"label": "Feed Surface",
270+
"fields": [
271+
{"type": "Text", "name": "runtime_surface", "label": "Runtime Surface", "value": "GeoJSON summary feed"},
272+
{"type": "Text", "name": "companion_surface", "label": "Companion Surface", "value": "GeoJSON detail feed and FDSN query.geojson"},
273+
{"type": "Text", "name": "modeling_note", "label": "Modeling Note", "value": "The system is a global feed adapter and not a physical seismic station"},
274+
],
275+
},
276+
{
277+
"name": "feed_lifecycle",
278+
"type": "DataRecord",
279+
"label": "Feed Lifecycle",
280+
"fields": [
281+
{"type": "Text", "name": "production_availability", "label": "Production Availability", "value": "Official policy states production feeds remain available for at least six months in production or deprecated form"},
282+
{"type": "Text", "name": "deprecation_notice", "label": "Deprecation Notice", "value": "Official policy states at least 30 days notice before deprecation and removal"},
283+
],
284+
},
222285
],
223286
"capabilities": [
224287
{
@@ -252,6 +315,12 @@ def _system_sml(config: dict) -> dict:
252315
"label": "Event Types",
253316
"value": "earthquake, quarry blast, explosion, ice quake, other",
254317
},
318+
{
319+
"type": "Text",
320+
"name": "enrichment_policy",
321+
"label": "Enrichment Policy",
322+
"value": "Summary feed by default, detail and FDSN only when stronger per-event context is needed",
323+
},
255324
],
256325
},
257326
],
@@ -276,16 +345,19 @@ def _datastream_schema() -> dict:
276345
"per new or revised earthquake."
277346
),
278347
"documentation": [
279-
{"title": "USGS Earthquake Hazards Program", "href": USGS_EQ_HOME, "rel": "about"},
280348
{"title": "GeoJSON Summary Feed", "href": USGS_EQ_FEED_DOC, "rel": "documentation"},
281-
{"title": "ComCat Data Glossary", "href": USGS_EQ_GLOSSARY, "rel": "describedby"},
349+
{"title": "GeoJSON Detail Feed", "href": USGS_EQ_DETAIL_DOC, "rel": "documentation"},
350+
{"title": "Feed Lifecycle Policy", "href": USGS_EQ_LIFECYCLE, "rel": "policy"},
351+
{"title": "Event Terms", "href": USGS_EQ_EVENT_TERMS, "rel": "describedby"},
352+
{"title": "FDSN Event API", "href": USGS_EQ_FDSN_EVENT_API, "rel": "service"},
282353
],
283354
"characteristics": [
284355
{"label": "Observation Model", "value": "One observation per earthquake event"},
285-
{"label": "Coverage", "value": "Global — all earthquakes worldwide"},
286-
{"label": "Feed Variant", "value": "all_day (200-400 events per fetch, ~300 KB)"},
287-
{"label": "Deduplication", "value": "Skip unchanged (id, updated) tuples; re-publish revised events"},
288-
{"label": "Magnitude Types", "value": "ml, mb, ms, mw, mww, md (reported by magType field)"},
356+
{"label": "Default Runtime Surface", "value": "GeoJSON summary feed"},
357+
{"label": "Selective Enrichment Surface", "value": "GeoJSON detail feed and FDSN query.geojson"},
358+
{"label": "Coverage", "value": "Global"},
359+
{"label": "Dedupe", "value": "Use (eventId, updatedTime) to skip unchanged events and republish revisions"},
360+
{"label": "Omitted But Available Summary Fields", "value": "url, sig, alert, tsunami, net, types, nst, dmin, rms, gap"},
289361
],
290362
"schema": {
291363
"obsFormat": "application/om+json",
@@ -332,7 +404,9 @@ def _deploy_root() -> dict:
332404
),
333405
"documentation": [
334406
{"title": "USGS Earthquake Hazards Program", "href": USGS_EQ_HOME, "rel": "about"},
335-
{"title": "GeoJSON Summary Feed", "href": USGS_EQ_FEED_DOC, "rel": "documentation"},
407+
{"title": "GeoJSON Summary Feed Docs", "href": USGS_EQ_FEED_DOC, "rel": "documentation"},
408+
{"title": "GeoJSON Detail Feed Docs", "href": USGS_EQ_DETAIL_DOC, "rel": "documentation"},
409+
{"title": "Feed Lifecycle Policy", "href": USGS_EQ_LIFECYCLE, "rel": "policy"},
336410
],
337411
"validTime": [VALID_TIME_START, ".."],
338412
},
@@ -352,9 +426,11 @@ def _deploy_feed(system_server_id: str) -> dict:
352426
"featureType": "sosa:Deployment",
353427
"name": "USGS Earthquake Feed",
354428
"description": (
355-
"Configured USGS earthquake feed-adapter deployment. Polls the all_day "
356-
"GeoJSON feed every 60 seconds, publishing one observation per earthquake "
357-
"event. Global coverage — 200-400 events per feed cycle."
429+
"Configured USGS earthquake feed-adapter deployment. Polls one official "
430+
"USGS GeoJSON summary feed variant on a fixed cadence and publishes one "
431+
"observation per earthquake event. The deployment documents the detail "
432+
"feed and FDSN event service as optional enrichment companions rather than "
433+
"baseline polling dependencies."
358434
),
359435
"validTime": [VALID_TIME_START, ".."],
360436
"platform@link": {
@@ -363,9 +439,10 @@ def _deploy_feed(system_server_id: str) -> dict:
363439
"title": "USGS Earthquake Feed",
364440
},
365441
"links": [
366-
{"rel": "about", "title": "USGS Earthquake Hazards Program", "href": USGS_EQ_HOME},
367-
{"rel": "documentation", "title": "GeoJSON Feed Docs", "href": USGS_EQ_FEED_DOC},
368-
{"rel": "describedby", "title": "ComCat Glossary", "href": USGS_EQ_GLOSSARY},
442+
{"rel": "documentation", "title": "GeoJSON Summary Feed Docs", "href": USGS_EQ_FEED_DOC},
443+
{"rel": "documentation", "title": "GeoJSON Detail Feed Docs", "href": USGS_EQ_DETAIL_DOC},
444+
{"rel": "describedby", "title": "Event Terms", "href": USGS_EQ_EVENT_TERMS},
445+
{"rel": "service", "title": "FDSN Event API", "href": USGS_EQ_FDSN_EVENT_API},
369446
],
370447
},
371448
}

0 commit comments

Comments
 (0)