Skip to content

Database

Christian Joe edited this page Jan 23, 2019 · 6 revisions

Database

We use MongoDB as database. On this wiki site, you'll find information about the used data models.

Data model for alert events

We store all alerts and alert-updates as events from the DWD-API in collection.unwetter.events.

areas - Since we use the API COMMUNEUNION level and not DISTRICT, the areas are affected local communities.

disctricts, states - affected districts, given due to the areas[-]['warn_cell_id'] code, where the last 8 digits are given by Amtlicher Gemeindeschlüssel

regions - rule based naming of regions by areas

geometry - true affected areas, given as list of polygons, where each polygons can have several wholes. The are given as a list of exclude_polygons

special_type- Is either UpdateAlert or None

has_changes - Is True if changes in one of the event-objects: dates, districts, areas, severity, event occur, related to the config.yml applied at the time of the event creation.

Example event:

{
    "_id": {
        "$oid": "5c175614794a30000429fcc1"
    },
    "id": "2.49.0.1.276.0.DWD.PVW.1545033240000.b2c23e3b-1cc9-4ba2-a252-a891fe71db62.DEU",
    "sender": "CAP@dwd.de",
    "sent": {
        "$date": "2018-12-17T07:54:00.000Z"
    },
    "status": "Actual",
    "msg_type": "Alert",
    "special_type": "None", 
    "event": "LEICHTER SCHNEEFALL",
    "response_type": "None",
    "urgency": "Immediate",
    "severity": "Minor",
    "certainty": "Likely",
    "effective": {
        "$date": "2018-12-17T07:54:00.000Z"
    },
    "onset": {
        "$date": "2018-12-17T08:30:00.000Z"
    },
    "expires": {
        "$date": "2018-12-17T11:00:00.000Z"
    },
    "headline": "Amtliche WARNUNG vor LEICHTEM SCHNEEFALL",
    "description": "Es tritt im Warnzeitraum oberhalb 600 m leichter Schneefall mit Mengen um 2 cm auf. Die Schneefallgrenze steigt auf 800 Meter. Verbreitet wird es glatt.",
    "instruction": null,
    "parameters": {
        "Schneefall": "~2 [cm]"
    },
    "areas": [
        {
            "name": "Stadt Bad Homburg v.d. Höhe",
            "warn_cell_id": "806434001"
        },
        {
            "name": "Gemeinde Glashütten",
            "warn_cell_id": "806434003"
        },
...
    ],
    "geometry": [
        {
            "polygons": [
                [
                    [
                        51.057301,
                        7.971276
                    ],
...
                    [
                        51.043313,
                        7.938009
                    ],
                    [
                        51.057301,
                        7.971276
                    ],
                    [
                        51.057301,
                        7.971276
                    ]
                ]
            ],
            "exclude_polygons": []
        }
    ],
    "districts": [
        {
            "name": "Hochsauerlandkreis",
            "warn_cell_id": "105958000"
        },
        {
            "name": "Hochtaunuskreis",
            "warn_cell_id": "106434000"
        },
        {
            "name": "Kreis Marburg-Biedenkopf",
            "warn_cell_id": "106534000"
        },
    ],
    "states": [
        "NW",
        "HE"
    ],
    "regions": [
        [
            "Südwestfalen",
            0.6
        ]
    ],
    "has_changes": true
}

Must read

  1. Introduction

Data

  1. Datamodel
  2. DWD API

Maps

  1. Map Generator

Text-Generator

  1. Region Algorithm
  2. TV Crawl
  3. Tweet

Output-Channels

  1. RSS Feed
  2. SLACK
  3. MS TEAMS
Clone this wiki locally