Skip to content

Commit

Permalink
Include alert status in alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemaeyer committed May 2, 2024
1 parent bf821db commit be4aba6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions brightsky/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class AlertExporter(DBExporter):
"""
ELEMENT_FIELDS = [
'alert_id',
'status',
'effective',
'onset',
'expires',
Expand Down
7 changes: 6 additions & 1 deletion docs/brightsky.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ paths:
$ref: "#/components/schemas/Alert"
location:
$ref: "#/components/schemas/Location"
example: {"alerts":[{"id":279977,"alert_id":"2.49.0.0.276.0.DWD.PVW.1691344680000.2cf9fad6-dc83-44ba-9e88-f2827439da59","effective":"2023-08-06T17:58:00+00:00","onset":"2023-08-07T08:00:00+00:00","expires":"2023-08-07T19:00:00+00:00","category":"met","response_type":"prepare","urgency":"immediate","severity":"minor","certainty":"likely","event_code":51,"event_en":"wind gusts","event_de":"WINDBÖEN","headline_en":"Official WARNING of WIND GUSTS","headline_de":"Amtliche WARNUNG vor WINDBÖEN","description_en":"There is a risk of wind gusts (level 1 of 4).\nMax. gusts: 50-60 km/h; Wind direction: west; Increased gusts: near showers and in exposed locations < 70 km/h","description_de":"Es treten Windböen mit Geschwindigkeiten zwischen 50 km/h (14 m/s, 28 kn, Bft 7) und 60 km/h (17 m/s, 33 kn, Bft 7) aus westlicher Richtung auf. In Schauernähe sowie in exponierten Lagen muss mit Sturmböen bis 70 km/h (20 m/s, 38 kn, Bft 8) gerechnet werden.","instruction_en":null,"instruction_de":null}],"location":{"warn_cell_id":705515101,"name":"Münster-Nord","name_short":"Münster-Nord","district":"Münster","state":"Nordrhein-Westfalen","state_short":"NW"}}
example: {"alerts":[{"id":279977,"alert_id":"2.49.0.0.276.0.DWD.PVW.1691344680000.2cf9fad6-dc83-44ba-9e88-f2827439da59","status":"actual","effective":"2023-08-06T17:58:00+00:00","onset":"2023-08-07T08:00:00+00:00","expires":"2023-08-07T19:00:00+00:00","category":"met","response_type":"prepare","urgency":"immediate","severity":"minor","certainty":"likely","event_code":51,"event_en":"wind gusts","event_de":"WINDBÖEN","headline_en":"Official WARNING of WIND GUSTS","headline_de":"Amtliche WARNUNG vor WINDBÖEN","description_en":"There is a risk of wind gusts (level 1 of 4).\nMax. gusts: 50-60 km/h; Wind direction: west; Increased gusts: near showers and in exposed locations < 70 km/h","description_de":"Es treten Windböen mit Geschwindigkeiten zwischen 50 km/h (14 m/s, 28 kn, Bft 7) und 60 km/h (17 m/s, 33 kn, Bft 7) aus westlicher Richtung auf. In Schauernähe sowie in exponierten Lagen muss mit Sturmböen bis 70 km/h (20 m/s, 38 kn, Bft 8) gerechnet werden.","instruction_en":null,"instruction_de":null}],"location":{"warn_cell_id":705515101,"name":"Münster-Nord","name_short":"Münster-Nord","district":"Münster","state":"Nordrhein-Westfalen","state_short":"NW"}}
"400":
$ref: "#/components/responses/InvalidAlertRequest"
"404":
Expand Down Expand Up @@ -551,6 +551,11 @@ components:
description: Unique CAP message identifier
type: string
example: "2.49.0.0.276.0.DWD.PVW.1691344680000.2cf9fad6-dc83-44ba-9e88-f2827439da59"
status:
description: Alert status
type: string
enum: ["actual", "test"]
example: "actual"
effective:
description: Alert issue time
type: string
Expand Down
4 changes: 4 additions & 0 deletions migrations/0018_alerts_status.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TYPE alert_status AS ENUM ('actual', 'test');

ALTER TABLE alerts ADD COLUMN status alert_status NOT NULL DEFAULT 'actual';
ALTER TABLE alerts ALTER COLUMN status DROP DEFAULT;

0 comments on commit be4aba6

Please sign in to comment.