mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
feat(squawk): carry emergencySource + observation time into analyst records
Review on #856 (kvnloo): the analyst projection flattened a 7700 squawk and the readsb ADS-B emergency field into the same emergency/emergencyKind pair. - mapAnalystRecord (flights, military) adds emergencySource ('squawk' | 'ads-b' | null, from aircraftEmergency().source), emergencyBroadcast (new pure emergencyBroadcastPhrase: "broadcasting squawk 7700 (general emergency)" vs "ADS-B reports general emergency") and observedAtMs (the record's lastContactEpochMs: last transponder message, epoch ms). - emergencySource is a queryable analyst text field; the voice payload passes it and emergencyBroadcast through, and observedAtMs only for aircraft with a status. Tool description asks the model to narrate with the phrase. - Source-to-analyst fixture test: OpenSky 7700 vs adsb.lol emergency=general on squawk 1200 differ in provenance and timestamp; filterable by source. - Voice tool-payload pins re-derived for the additive description change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
6c643c8113
commit
7d6f31e54d
10 files changed
+227
-4
No files matched your search
@@ -63,6 +63,22 @@ export function aircraftEmergency({ squawk, emergency } = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* How a summary may phrase the status without flattening it into an incident:
|
||||
* quote the code when the Mode A squawk itself names the status, otherwise
|
||||
* attribute it to the ADS-B emergency field.
|
||||
* @param {{kind?: string, squawk?: string|null, source?: string}|null|undefined} status
|
||||
* @returns {string|null} e.g. 'broadcasting squawk 7700 (general emergency)'
|
||||
* or 'ADS-B reports general emergency'; null when there is no status.
|
||||
*/
|
||||
export function emergencyBroadcastPhrase(status) {
|
||||
if (!status || !Object.hasOwn(KINDS, status.kind)) return null;
|
||||
const label = KINDS[status.kind].label.toLowerCase();
|
||||
return status.source === 'squawk' && status.squawk
|
||||
? `broadcasting squawk ${status.squawk} (${label})`
|
||||
: `ADS-B reports ${label}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the aircraft is broadcasting an emergency (not a priority status).
|
||||
* @param {{severity?: string}|null|undefined} status
|
||||
|
||||
Reference in new issue
Block a user