mirror of
https://github.com/zvx-echo6/central.git
synced 2026-06-10 11:54:37 +02:00
Central - data hub spine. Adapters -> NATS/JetStream -> archive.
- Python 89.1%
- HTML 9.3%
- CSS 1.3%
- PLpgSQL 0.3%
SAME format (FCC standard) is PSSCCC: P=area-type indicator, SS=state FIPS,
CCC=county FIPS. Pre-v0.10.7 _build_regions read code[:2] (PS) as the state,
so the leading P=0 collapsed every SAME code to state 01 = Alabama. The
dumped CAP envelope from CENTRAL_WX#968 showed Bannock County Idaho alerts
flagged as US-AL-FIPS016005 + primary_region=US-AL-FIPS016005, which then
routed to central.wx.alert.us.al.county.fips016005 instead of
central.wx.alert.us.id.county.fips16005.
Fix:
- Slice code[1:3] for the state FIPS, code[1:] for the 5-digit ANSI county
FIPS (SSCCC -- standard interoperable form). Drops the P padding from
emitted region/subject; P stays preserved verbatim in data.geocode.SAME
for any power user that needs it.
- Length guard tightened: ==6 + isdigit + isinstance str (was >= 2). Now
malformed entries (too short, too long, non-digit, None) are silently
skipped with no crash.
- Deleted dead _extract_states_from_codes (defined but never called; same
bug, removed rather than fixed).
Tests:
- New TestSameStateParse parametrized over 4 distinct-state cases per spec:
016005 -> US-ID-FIPS16005 (Bannock area), 001005 -> US-AL-FIPS01005
(Autauga area), 056005 -> US-WY-FIPS56005 (Carbon area), 049005 ->
US-UT-FIPS49005 (Cache UT).
- Area-subset (P>=1) and unknown-state-FIPS coverage.
- Malformed-input parametrize: empty, too short (2 forms), too long (7
digits), non-digit char, all-alpha, None -- each silently skipped.
- Existing SAMPLE_FEATURE_* fixtures updated from constructed-to-match-bug
values (160001/410051/060037/530033) to proper 0SSCCC format
(016001/041051/006037/053033); existing TestBuildRegions assertions
updated to expect 5-digit ANSI form.
Followup ticket (NOT v0.10.7 scope, recorded in PR body):
(a) Null-geometry alerts with valid Idaho UGC zones are silently dropped
by _geometry_intersects_region (line 297-298): needs UGC-fallback or
geometry-or-UGC check. NWS issues many Special Weather Statements
without GeoJSON polygons but with UGC IDZ* zones that should pass.
(b) Configured monitoring bbox north=44.5 only covers the southern third
of Idaho; Idaho extends to 49.0N, so Coeur d'Alene / Lewiston / etc.
are out of scope. Verify whether the narrow bbox was an intentional
dev limit or accidental.
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.