Criticality bulletins¶
dpc_radar.bulletins ¶
The DPC criticality bulletin: the official hydro-geological alert, as data.
Every day by 16:00 the Civil Protection Department publishes the national
criticality bulletin (bollettino di criticità e allerta) in its GitHub
repository pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica
<https://github.com/pcm-dpc/DPC-Bollettini-Criticita-Idrogeologica-Idraulica>_
(CC BY 4.0): one GeoJSON for today and one for tomorrow, with the ~190 alert
zones of Italy. It is already structured: no language model reads it, it is
imported.
Each zone carries four levels, written in words in the file ("Ordinaria per rischio idrogeologico / ALLERTA GIALLA"): the one on the map, and the ones for hydro-geological risk (landslides), hydraulic risk (rivers) and thunderstorms. They become numbers: 0 none, 1 yellow, 2 orange, 3 red.
This is the official alert. Whatever a model computes from the radar is not, and should be shown next to it, never instead of it.
Needs shapely for the zone shapes: pip install "dpc-radar[bulletins]".
Zone
dataclass
¶
One alert zone on one day.
Bulletin
dataclass
¶
One bulletin: its name, when it was issued, and its zones for today and tomorrow.
level ¶
level(text: str | None) -> int
«Ordinaria per rischio temporali / ALLERTA GIALLA» → 1; no alert → 0.
issued ¶
issued(name: str) -> datetime | None
When a bulletin was issued, from its file name (Italian time); None if not one.
zones_from_geojson ¶
zones_from_geojson(data: dict[str, Any], valid: date) -> list[Zone]
The zones of one bulletin file (today or tomorrow). Features with no name are skipped.
latest_name_from ¶
latest_name_from(listing: dict[str, Any]) -> str | None
The newest bulletin name in a GitHub tree listing of files/geojson.
latest_name
async
¶
latest_name(client: AsyncClient | None = None, *, send: Send | None = None) -> str | None
The file name of the newest bulletin (…_today.json), or None.
Three small calls to the repository tree instead of one recursive call: the
archive holds thousands of files. Unauthenticated, GitHub allows 60 calls an
hour; pass a client with a token header for more, or a send hook to use
your own HTTP layer.
fetch
async
¶
fetch(name: str, client: AsyncClient | None = None, *, send: Send | None = None) -> Bulletin
Today and tomorrow of the bulletin name (YYYYMMDD_hhmm_today.json).
latest
async
¶
latest(client: AsyncClient | None = None, *, send: Send | None = None) -> Bulletin
The newest bulletin.