# poziare: fires per year (okres Senec, Bratislavský kraj)

The number of fires, the direct damage and the people killed and injured in them, per year, for okres Senec and,
beside it, for Bratislavský kraj, as the yearly report of the Požiarnotechnický a expertízny ústav MV SR (PTEÚ)
„Rozbor požiarovosti v Slovenskej republike za rok …“ prints them. Built on 26 Oct 2026 by
`scripts/fetch_poziare.py`.

## Rebuild

```bash
python scripts/fetch_poziare.py              # writes poziare.json + poziare.csv (~3 min the first time, OCR; seconds after)
python scripts/fetch_poziare.py --offline    # from the cache only
python scripts/fetch_poziare.py --refresh    # download the reports and OCR them again
```

Raw PDFs and the OCR output (page TSVs, each number's second reading) are cached in `raw/poziare/` (not committed)
and re-used unless `--refresh` is given. Needs `httpx`, `pdfplumber` (and Pillow, which it installs), poppler
(`pdftoppm`) and tesseract with `slk`.

## Files

| File | Content |
|---|---|
| `poziare.json` | a list of records, two per year (okres Senec, Bratislavský kraj), sorted by year |
| `poziare.csv` | the same records, one row each, same columns. UTF-8, CRLF, empty = null |

## Source

| What | URL |
|---|---|
| The report for year Y | `https://www.minv.sk/swift_data/source/hasici_a_zachranari/pteu1/kuban/statistiky/<Y>.pdf` |
| Index | https://www.minv.sk/?statistika-poziarovosti-na-slovensku-2 |

The index links the reports for 2016 to 2024 (26 Oct 2026). The 2025 report is at the same path and not linked
yet. The script takes every year from 2019 until the path answers 404.

Two tables of each report are read: „Požiarovosť v SR za rok Y … podľa krajov“ (PDF page 8) and „… podľa
okresov“ (PDF page 9 in every year from 2019 to 2025). Each row gives, for year Y, the number of fires, the
direct damage in €, the people killed and the people injured, and the number of fires in year Y−1.

## Records

| Year | okres Senec: fires | direct damage (€) | killed | injured | Read from |
|---|---|---|---|---|---|
| 2019 | 136 | 248 060 | 0 | 4 | OCR |
| 2020 | 96 | 287 280 | 0 | 0 | OCR |
| 2021 | 90 | 1 291 800 | 0 | 0 | OCR |
| 2022 | 93 | 551 100 | 0 | 3 | OCR |
| 2023 | 90 | 2 082 050 | 2 | 0 | OCR |
| 2024 | 98 | 491 000 | 0 | 0 | text layer |
| 2025 | 97 | 686 660 | 0 | 2 | text layer |

## Fields

- `record_id`: `okres-senec-<year>` or `bratislavsky-kraj-<year>`. Stable.
- `territory`: `okres Senec` or `Bratislavský kraj`. `year`: the calendar year the report covers.
- `fires` („Počet požiarov“), `direct_damage_eur` („Priame škody (€)“), `killed` („Usmrtené osoby“), `injured`
  („Zranené osoby“), as printed.
- `read_from`: `text layer` (the PDF has text, 2024 and later) or `OCR` (a scan, 2019 to 2023).
- `note`: null, or which of the record's numbers had two different OCR readings and the value the table's sums
  give (see Method).
- `source_page`: the page of the PDF (counted from 1) with the row. `source_url`: the report.
  `last_update`: the day the record last changed.

## Method

- **Text layer (2024, 2025):** the words of the two pages (pdfplumber), grouped into lines by their height on
  the page and split into cells where the gap between two words is wider than 12 pt (a thousands space is about
  3 pt).
- **Scans (2019 to 2023):** each page is rendered at 300 dpi (`pdftoppm`) and read by tesseract (`slk`,
  `--psm 6`) with word boxes; a table row is one of tesseract's lines (the 2022 scans are skewed, so the cells of
  a row are not at one height), split into cells the same way. Every number used is then read a second time from
  its own cell, cropped, with digits only (`--psm 7`). Where the two readings agree, that is the value.
- **Checks, each of which stops the build:**
  - the eight okresy of Bratislavský kraj (Bratislava I to V, Malacky, Pezinok, Senec) add up to the kraj's row
    in all five columns;
  - the eight kraje add up to Slovakia's row („spolu“) in all five columns;
  - the next year's report repeats the year's number of fires, in its previous-year column, for okres Senec and
    for the kraj (2019 to 2024).
- **Where the two OCR readings differ** (or one is not a number), the value is the only combination of the
  readings in that column with which both sums hold; no combination, or more than one, stops the build. On
  26 Oct 2026 this decided 13 numbers, three of them in this dataset's records (their `note` says so):
  okres Senec killed 2023 (read 2 and 4; 2, as the page shows), Bratislavský kraj killed 2020 (4 and 7; 7) and
  2023 (3 and 5; 5, as the page shows). The others are rows of other okresy and kraje used only by the checks:
  2019 Trenčiansky kraj fires (707) and injured (27); 2020 Prešovský kraj fires (1 172), Bratislava II damage
  (762 600) and Trnavský kraj injured (11); 2021 Bratislava V damage (795 225); 2022 Prešovský kraj damage
  (7 055 505), Trenčiansky kraj injured (41) and Košický kraj injured (27); 2023 Trnavský kraj injured (27).
- The okres Senec values of 2023, 2024 and 2025 match those noted in the source registry on 25 Oct 2026 (90, 98
  and 97 fires; 686 660 € and 2 injured in 2025).

## Caveats

- **Okres level only.** The report has no row for a town: okres Senec is every municipality of the okres, not the
  town alone. No event-level fire data is public (registry `safety-events-absent`): no list of fires with a place
  and a date.
- The okres table gives only these four numbers. The report's other tables (causes, places, saved values,
  months, hours) are for Slovakia as a whole.
- The figures are the report's, as published once a year; a later correction would show only in the next
  report's previous-year column, which the build checks against the number of fires.
- Reports for 2016 to 2018 exist and are not read; the series starts in 2019, as `bezpecnost` does.

## License

Published by Som Senec under the Creative Commons Attribution 4.0 International licence (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/. You may use it for any purpose, commercial use included, if you credit "Som Senec, somsenec.sk". The source documents that each record links to keep their own terms.
