Skip to content

Expand the incident contract and incident record to support more forms worldwide #615

Description

@chetanr25

Expand the incident contract and incident record for Pipeline C

Background

Discussion #609 settled the extraction architecture debate. We are building Pipeline C (And Pipeline B): the LLM reads a narrative once and extracts it into one shared incident schema, and every form is filled from that stored document afterward instead of running a fresh extraction per form. The incident contract is the schema that makes this possible, so it has to actually hold what a real fire, EMS or hazmat report needs, not just a sketch.

The current contract was a first draft. It covered the obvious sections but was missing large parts of what NFIRS, NERIS, NEMSIS, ICS-209 and the international standards we looked at (UK IRS, Australia AIRS, Canada NFID, CTIF, UN SSIRS) actually ask for: dispatch timing, per-unit response records, rescues, evacuations, investigation findings, mobile property, and a proper losses breakdown. Without these, several form types simply cannot be filled from the contract alone.

What needs to change

  • Add the missing top-level sections: dispatch, actions taken, per-unit response, resources summary, explosion, risk reduction, exposures, rescues, evacuation/displacement, emerging hazards (battery/EV/solar), investigation, persons involved, mobile property, and losses.
  • Add shared value types used across sections: Money (amount + ISO 4217 currency), CodeRef (external standard codes), Quantity (value with reported unit), PresenceStatus, OperationStatus, Coordinates.
  • Standardize field conventions: SI units with the unit in the field name, money always as amount/currency, absent means unknown, explicit undetermined where standards distinguish it, PII fields flagged.
  • Add x-aliases on high-traffic fields, alternate names a user might type when searching for a field (zip, pincode, and so on), so the field catalog and mapping suggester can use them later.
  • Rework IncidentRecord to own the contract document as the single source of truth: add incident_datetime (derived from the contract, replacing the old date-only field) and an IncidentAnalytics block with stats promoted out of the JSONB (location, casualties, losses, response-time intervals) so reporting queries do not need to dig into the document.
  • Open up FormType from a closed enum to a plain string, since users register their own templates for any jurisdiction now, and add FieldSource (schema, static, manual, open) to describe where a template field's value comes from.

Why this order

Every other layer (extraction, form generation, templates) reads from or writes into this contract. Getting the shape right first means the rest of the work is filling in behavior around a stable schema instead of chasing a moving target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions