fix: set <event> to 'Flood' per CAP 1.2 §3.2.4#80
Open
johnswarbrick wants to merge 1 commit intoDEFRA:masterfrom
Open
fix: set <event> to 'Flood' per CAP 1.2 §3.2.4#80johnswarbrick wants to merge 1 commit intoDEFRA:masterfrom
johnswarbrick wants to merge 1 commit intoDEFRA:masterfrom
Conversation
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.
Problem
The
<info><event>field in published CAP alerts currently contains a reference to the message type, e.gIssue,UpdateorRemoverather than describing the hazard as required by the CAP 1.2 specification.This PR fixes the issue by setting the
<info><event>field for every alert to"Flood".As a future piece of work, a more specific OET event term could be derived from the FWIS area code or warning type to be more specific, e.g. using
Coastal Floodfor coastal alerts instead of the genericFlood.Examples from the live feed
Source:
https://environment.data.gov.uk/cap/flood-alerts.atomEvery alert checked in the current feed exhibits this pattern —
<event>always mirrors<msgType>.CAP 1.2 specification
Per the OASIS CAP 1.2 standard, these are distinct fields with different purposes:
<msgType>(§3.1) — the nature of the message: "Alert", "Update", "Cancel", "Ack", "Error"<event>(§3.2.4) — "The text denoting the type of the subject event of the alert message"<msgType>describes what the message is doing (issuing, updating, cancelling).<event>describes the hazard (flooding).The Google Public Alerts documentation further clarifies that
<event>appears in alert titles and should be "short (less than 35 characters) and descriptive enough for the public to understand", with examples like<event>Tornado</event>.Suggested
<event>valuesThe OASIS CAP Event Terms List (ETL) v1.2 defines standardised event terms.
From that list, the following terms are relevant for the Environment Agency flood warning service:
Using
Floodfor all alerts is a pragmatic starting point and is implemented in this PR.As a future piece of work, the event term could be derived from the FWIS area code or warning type to be more specific, e.g. using
Coastal Floodfor coastal alerts instead of the genericFlood.Impact
<event>to categorise and display alerts by hazard type<event>value is what end users see first — "Update" tells them nothing; "Flood" tells them everything they needRoot cause
The
<event>value comes from the upstream FWIS system and passes throughprocessMessage.jsunchanged. The test fixtures in this repository confirm the upstream has historically sent incorrect values in this field (e.g."064 Issue Flood Alert EA"intest/lib/functions/data/capAlert.json).The
updateReferences()function already transforms<msgType>and<references>but does not touch<event>. A similar one-line transformation resolves the issue.Fix
This PR sets
<event>toFloodafter the existingupdateReferences()call inlib/functions/processMessage.js:As mentioned above, as a future piece of work, the event term could be derived from the FWIS area code or warning type to be more specific, e.g. using
Coastal Floodfor coastal alerts instead of the genericFlood.References