Add cable health scoring layer with NGA signal processing#134
Closed
Add cable health scoring layer with NGA signal processing#134
Conversation
Implement a new Cable Health layer that computes per-cable health status (ok/degraded/fault/unknown) from NGA maritime warnings. The system uses operator fault signals and repair ship activity as primary inputs, with time-decayed scoring, conservative attribution rules (no fault from inference alone), and evidence-first display. Backend: new /api/cable-health endpoint with Upstash caching Frontend: polling service, health-aware cable rendering on both DeckGL and D3/SVG maps, and a detail popup showing score, confidence, and top-3 evidence items. https://claude.ai/code/session_013WGb1wGHvPX6amYn54fHzG
Add comprehensive test suite for cable health feature: - 31 API unit tests covering signal processing, health computation, cable matching, coordinate parsing, and handler integration - 10 data integrity tests for landing-asn.json validating structure, ASN format, cable coverage, and landing point consistency - Register cable-health tests in package.json test:sidecar script Add cable health documentation to docs/DOCUMENTATION.md covering scoring algorithm, signal types, API endpoint, map rendering, and configuration across variants. https://claude.ai/code/session_013WGb1wGHvPX6amYn54fHzG
Backend (api/cable-health.js): - Fix parseIssueDate to return epoch on failure instead of now, preventing malformed dates from inflating signal importance - Remove dead code branch in computeHealthMap (ternary that always evaluated to 'degraded') - Fix WACS UK landing coordinates to match London (consistent with landing-asn.json and geo.ts) Frontend (DeckGLMap.ts): - Add missing popup.setCableActivity() forwarding so cable popups show advisory/repair data in DeckGL mode - Fix health cache signature to include status values, not just IDs - Fix updateTriggers to use valid deck.gl accessor names (getColor, getWidth) instead of non-existent 'highlighted' key - Remove dead getDashArray/dashJustified/extensions code (requires PathStyleExtension which is not installed) - Use i18n t() for layer toggle labels Frontend (MapPopup.ts): - Replace all hardcoded English strings with i18n t() calls i18n (en.json): - Add cable health popup translation keys - Add cableHealth layer toggle label Documentation: - Fix cable count (16 → 18) and landing count (60+ → 69) - Fix fault threshold description to include both conditions https://claude.ai/code/session_013WGb1wGHvPX6amYn54fHzG
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Remove the separate cableHealth layer toggle and integrate health status directly into the existing cables layer. When cables are enabled, health data is automatically fetched and only problems (fault/degraded) are visually highlighted — healthy cables keep their default appearance. Merge health evidence into the unified cable popup instead of having a separate popup type.
Owner
Author
|
@SebastienMelki this needs to move to sebuf, we shouldn't drop it |
Collaborator
|
Ok will port and merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds cable health scoring via a new
/api/cable-healthendpoint that processes NGA maritime warnings to detect submarine cable faults and repair activity. Health status is integrated directly into the existing cables layer — no separate toggle — with only problems (fault/degraded) visually highlighted. Healthy cables retain their default appearance.Type of change
/api/*)Affected areas
/api/*)Design decisions
fault(red, thick, pulsing) anddegraded(orange, medium) cables get visual treatment. Cables withokorunknownhealth keep the default cyan appearance.Changes
Backend
api/cable-health.js(427 lines): New edge function that:operator_fault(severity 0.6–1.0, TTL 3–5 days) andrepair_activity(severity 0.5–0.8, TTL 12–24 hours)effective = severity × confidence × recencyWeightapi/cable-health.test.mjs(474 lines): Comprehensive test suite covering signal extraction, DMS parsing, nearest cable lookup, health map computationdata/landing-asn.json(108 lines): Maps 18 cables' 69 landing points to local ASNsFrontend
src/services/cable-health.ts: Service layer with 1-minute local cache to fetch cable health datasrc/types/index.ts: New types:CableHealthStatus,CableHealthRecord,CableHealthResponse,CableHealthEvidencesrc/components/DeckGLMap.ts: Cable layergetColor/getWidthnow check health map — fault → red/thick, degraded → orange/medium, everything else → default cyansrc/components/Map.ts: SVG fallback appliescable-health-fault/cable-health-degradedCSS classessrc/components/MapPopup.ts: Cable popup enriched with health evidence section when fault/degraded status detectedsrc/App.ts: Health data auto-fetched alongside cable activity when cables layer is enabled (5-min refresh)src/styles/main.css: CSS for fault (dashed red + pulse animation) and degraded (orange) cable stylesTests
tests/cable-health-data.test.mjs(132 lines): Data integrity checks forlanding-asn.jsonTest plan
npm run build)