mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
Central - data hub spine. Adapters -> NATS/JetStream -> archive.
- Python 90.5%
- HTML 9.1%
- PLpgSQL 0.4%
Adds the GDACS (Global Disaster Alert and Coordination System) adapter against the self-describing framework. Polls https://www.gdacs.org/xml/rss.xml every 600s, parses the RSS items, and publishes to a new CENTRAL_DISASTER JetStream stream on central.disaster.<eventtype_lower>.<country_lower>. Locked decisions: - Keep: WF, DR, FL, VO, TC. Drop: EQ (USGS canonical on central.quake.>), plus any future-unknown eventtype. - Filter via settings_schema event_types: list[str] so operators can re-allow without a code change. - Dedup by RSS guid (format <eventtype><eventid>, stable across reissue). - Severity from gdacs:alertlevel (Green=1, Orange=2, Red=3, default 0). - Fall-off uses GDACS gdacs:iscurrent=false as explicit tombstone signal, with a fallback for items that vanish entirely from the feed. Tombstones publish on disaster.removed.<eventtype>.<country>. - Geo: centroid from geo:Point, bbox from gdacs:bbox (reordered to Geo (minLon, minLat, maxLon, maxLat)), primary_region from gdacs:iso3. CENTRAL_DISASTER stream: 7d retention, 1 GiB max_bytes, mirroring CENTRAL_FIRE / CENTRAL_QUAKE / CENTRAL_SPACE. Migrations 020 (adapter row, enabled=false, default event_types in settings) and 021 (stream seed). STREAM_SUBJECTS, archive STREAMS, GUI DASHBOARD_STREAMS each pick up the new stream. Tests: 14 new in tests/test_gdacs.py using frozen RSS fixtures with WF/DR/EQ/XX items (covering normalization, EQ drop, unknown drop, settings override, guid dedup, iscurrent=false tombstone, missing-from-feed tombstone, helper boundaries). Stream-count assertions bumped 4->5 and 5->6 for the new stream (anti-pattern noted; queued as a follow-up PR E.5). +1 membership test test_streams_contains_central_disaster. Full suite: 426 passed. End-to-end on CT104: 48 events published on first poll (44 disaster.wf + 4 disaster.fl), zero EQ events, all subjects under central.disaster.> with lowercase-hyphenated country suffixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| docs | ||
| etc-templates | ||
| scripts | ||
| sql | ||
| src/central | ||
| systemd | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .python-version | ||
| CHANGELOG.md | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Central
Central is the data hub spine for the infrastructure. Adapters normalize upstream sources into a canonical event shape, publish CloudEvents to NATS/JetStream, and archive to TimescaleDB for historical query. Single-LXC deployment.
Status
Phase 0 — scaffold. Not yet operational.
Architecture
- Python 3.12 (uv-managed)
- NATS + JetStream for live event bus
- TimescaleDB + PostGIS for archive and geospatial query
- One supervisor process managing adapter lifecycle
- One archive consumer process persisting events to TimescaleDB
- Both processes systemd-managed
Testing
See docs/test-database.md for test database setup.
License
MIT. See LICENSE.