Error on NTSB feed generation with missing tier 2 event code #125

Closed
opened 2023-09-07 14:49:49 +00:00 by lucidiot · 0 comments
Owner

jq: error (at stdin:160188): Cannot index object with null

Two investigations have some tier 2 event codes (cm_tier2Num) missing in the events for one of their vehicles:

$ jq '.[] |(.cm_vehicles // [])[] | (.cm_events // [])[] | select(.cm_tier2Num == null)' file.json
{
  "cm_eventNum": 1,
  "cicttPhaseSOEGroup": "Enroute",
  "cm_isDefiningEvent": true,
  "cm_sequenceNum": 1,
  "cm_tier1Num": "402"
}
{
  "cm_eventNum": 1,
  "cicttPhaseSOEGroup": "Approach",
  "cm_isDefiningEvent": true,
  "cm_sequenceNum": 1,
  "cm_tier1Num": "509"
}

This should be handled so that the script falls back to cm_tier1Num.

`jq: error (at stdin:160188): Cannot index object with null` Two investigations have some tier 2 event codes (`cm_tier2Num`) missing in the events for one of their vehicles: ``` $ jq '.[] |(.cm_vehicles // [])[] | (.cm_events // [])[] | select(.cm_tier2Num == null)' file.json { "cm_eventNum": 1, "cicttPhaseSOEGroup": "Enroute", "cm_isDefiningEvent": true, "cm_sequenceNum": 1, "cm_tier1Num": "402" } { "cm_eventNum": 1, "cicttPhaseSOEGroup": "Approach", "cm_isDefiningEvent": true, "cm_sequenceNum": 1, "cm_tier1Num": "509" } ``` This should be handled so that the script falls back to `cm_tier1Num`.
lucidiot added the
bug
feed
labels 2023-09-07 14:49:49 +00:00
lucidiot self-assigned this 2023-09-07 14:49:49 +00:00
Sign in to join this conversation.
No description provided.