# prostredie: bathing water, air quality, recycling rate (Senec)

First assembled by hand on 16 Sep 2026. Since 10 Oct 2026 it is rebuilt by `scripts/fetch_prostredie.py` from public
sources plus `prostredie-manual-inputs.json`. Background shared with the health and safety files:
`zdravie-bezpecnost-README.md` (section "Environment").

## Rebuild

```bash
python scripts/fetch_prostredie.py            # ~35 s; writes prostredie.json + prostredie.csv
```

Raw responses are kept in `raw/prostredie/` (not committed). The `eea/*.json` files store each discodata query's SQL
with its result and, since 8 Nov 2026, the date it was retrieved; `eea/arcgis_*.json` are the ArcGIS replies. `odpady/`
holds the senec.sk PDFs and the WP search reply. EEA is queried on every run, 3 s between requests to one host. The
PDFs come from the cache unless you pass `--refresh`. Needs `httpx`, `pdfplumber`.

Discodata answered on 10 Oct 2026; since at least 5 Nov it answers HTTP 403 to every query with a WHERE clause from
this network. The run doesn't fail: a discodata query that fails is replaced by its last saved result in
`raw/prostredie/eea/` (with the date it was retrieved), and when there is none, by the values of the published
`prostredie.json`. Both `source` texts then say which date the values are from.

The script prints `!` warnings when:
- a discodata query fails, and which saved values it uses instead;
- EEA moves past the season named in the manual tail note;
- EEA's map service gives a different class for a season already published, or the service can't be read (the
  published classes stay);
- EEA's air quality statistics layer differs from a validated row, or has a validated year the data lacks;
- senec.sk posts a recycling-rate notice for a year with no value yet.

## Files

| File | Content |
|---|---|
| `prostredie.json` | `meta` (`generated`, `last_update`, `notes`; both dates are the day the file was built from the sources and the manual inputs, and the CSV's `last_update` is the same day on every row), `slnecne_jazera_kupacia_voda`, `ovzdusie`, `odpady_miera_vytriedenia` |
| `prostredie.csv` | all numeric series in long form. Columns `section, subject, year, period, indicator, value, unit, source_url, last_update`. Sections `kupacia_voda`, `kupacia_voda_vzorky`, `ovzdusie`, `odpady`. UTF-8, CRLF, empty = null |
| `prostredie-manual-inputs.json` | the values no script can read, plus the hand-written context texts. Every entry has `source_url`. Edit this file, not the JSON |

On [somsenec.sk/data](https://somsenec.sk/data) this dataset is `prostredie.json`, `prostredie.csv` and this README; `prostredie-manual-inputs.json` stays in the project's source data.

## Sources

| Block | Source | URL |
|---|---|---|
| bathing water classes, `SKREK032` and the other Slnečné jazerá beaches | EEA's bathing water map service, the newest `BathingWater_Dyna_WM_<year>` (2025 now): layer "Bathing water quality (point)" (class per season for 11 seasons, name, position, the ÚVZ profile) and table "mapViewer_mapviewer_timeseries" (the class as reported) | https://water.discomap.eea.europa.eu/arcgis/rest/services/BathingWater/BathingWater_Dyna_WM_2025/MapServer/3/query?where=… |
| bathing water assessments and samples, `SKREK032` | EEA WISE_BWD `latest`: `assessment_BathingWaterQuality` (4-season assessment), `assessment_MonitoringResult` (samples 2023–2024) | https://discodata.eea.europa.eu/sql?query=… (SQL in `raw/prostredie/eea/bw_*.json`) |
| air, station SK0068A Senec – Boldocká | EEA `[AirQualityDataFlows].[latest].[AirQualityStatistics]`. E1a = validated, E2a = up-to-date unverified | same endpoint, `raw/prostredie/eea/aq_statistics.json` |
| air, check of the validated years | EEA's air quality statistics layer `AQ_Statistics_WM`: the validated years' statistics as whole numbers (no E2a, no PM2.5 or NO2 days >50, no O3 days >100 or annual mean) | https://air.discomap.eea.europa.eu/arcgis/rest/services/AirQuality/AQ_Statistics_WM/MapServer/0/query?where=AirQualityEoICode%3D%27SK0068A%27… |
| recycling rate | senec.sk "Správa o stave odpadového hospodárstva", text PDFs | https://www.senec.sk/wp-content/uploads/2024/09/SPRAVA-o-stave-OH-v-meste-Senec-za-obdobie-2019_2020_final.pdf, …-2020_2021.pdf, …-2021_2022.pdf |
| recycling rate 2025 | town notice + scanned PDF (no text layer) → manual input | https://www.senec.sk/oznamy-mesta/2026/informacia-o-urovni-vytriedenia-komunalnych-odpadov-za-predchadzajuci-kalendarny-rok-2025/, https://www.senec.sk/wp-content/uploads/2026/02/SKM_C224e26022518150.pdf |
| new notices | senec.sk WP search | https://www.senec.sk/wp-json/wp/v2/search?search=úrovni%20vytriedenia |

## Fields

- **bathing:**
  - `eu_classification_by_season[]` (`SKREK032`, from 2015): `season`, `eu_classification` (the map layer's class for the season), `original` (the timeseries table's `qualityOriginalClassification`). Both in EEA's coded form ("1 - Excellent", "2 - Good", "3 - Sufficient", "4 - Poor", "0 - Not classified"), as discodata wrote them: the layer gives the class as a word ("Excellent") and the table gives seasons before 2018 as lower-case words ("good"); the script turns both into the code. Any other reported value ("new", "closed") stays as given.
  - `beaches[]` (since 8 Nov 2026): every Slnečné jazerá bathing water in the newest season of the map service. `bathing_water_id`, `name` (as EEA writes it), `lat`, `lon` (EEA's position), `season`, `eu_classification`, `original` (as above), `profile_url` (the ÚVZ bathing water profile EEA links), `source_url` (the layer query for that beach).
  - `assessment_details[]`: `season`, `class_code`, `ecoli_95pct` and `enterococci_95pct` (cfu/100 ml, 1 dp), `n_samples_4yr` (E. coli sample count).
  - `samples_2023_2024[]`: `date`, `ecoli_cfu_100ml`, `enterococci_cfu_100ml`, `type` (EEA `sampleStatus`).
  - `latest_classification`: the newest season of the map service and its class. `note` is generated from the last assessment held (with a line saying so when it is older than the class's season), plus the manual tail.
  - `eea_source` names both services and the date each was read.
- **air:**
  - `rows[]`: `year`, `data_status`. Per pollutant: `annual_mean_ugm3` (EEA `P1Y`) and day/hour counts (`P1Y-daysAbove50`, `P1Y-hrsAbove200`, `P1Y-dmaxAbove100`, `P1Y-dmaxAbove120`), 1 dp.
  - `exceedances_summary` and `gap` are generated from the rows.
  - `source` names the discodata date of the rows and, since 8 Nov 2026, the result of the check against the statistics layer.
  - From EEA: `station.eoi_code`, `lat`, `lon`, `type`. From manual inputs: name, operator, distances.
- **recycling:**
  - `rows[]`: `year`, `rate_pct` (official full-year), `partial` (`period`/`rate_pct`, `period2`/`rate_pct2`), `source`, `note`.
  - The partial rates come from each report's "Medziročný prehľad … január až <month>" table.
  - Official rates come from the sentence "za rok YYYY vykázalo úroveň vytriedenia". When two reports cover the same period, the later one wins.

## Manual inputs (and why)

| Value | Why not scripted |
|---|---|
| `rate_pct` 2025 = 59.73 | the only source is a one-page scan without a text layer |
| `season_2026`, `bans_warnings_2024_2026` | press and town/SCR pages. uvzsr.sk returns 401 to scripts, so ÚVZ's weekly reports were not read |
| `bathing_water_id`, `history_note`, the tail of `latest_classification.note` | descriptive text: the 3-beach split since 2025, the bioremediation date |
| station name, operator, `distance_from_centre_km`, `next_nearest` | hand-measured |
| `limits_reference`, `legal_basis` | legal constants (Directive 2008/50/EC; zákon 329/2018 Z. z.) |
| row `source` / `note` texts, `annual_waste_reports`, `gap` | research notes |

## Caveats

- Bathing water: since 2025 Slovakia reports Slnečné jazerá as three beaches. EEA names `SKREK032` "SLNEČNÉ JAZERÁ - JUH" for every season of its series; `SKREK043` (Sever) and `SKREK044` (Východ) start in 2025, "Not classified", the status EEA gives when there are not enough samples for a classification. The CSV's `subject` is EEA's name in sentence case with the id ("Slnečné jazerá – Juh SKREK032").
- Bathing water: the 2025 class is in the map service, but its 4-season assessment (2022–2025: percentiles, sample count) and the 2025 samples are only in discodata, which doesn't answer (8 Nov 2026). `assessment_details` ends with 2024, and the note says so.
- Air: the rows are those discodata gave on 10 Oct 2026. The statistics layer confirms the validated years 2021–2025 (whole numbers), but it can't replace discodata: it has no E2a year and lacks four of the ten fields. The 2026 E2a row stays as calculated by EEA in October 2026 until discodata answers again.
- The 2021 air row covers only part of the year (the station started in 2021; EEA data coverage 27–32 %). Its annual means are not comparable with 2022+.
- The 2026 air row is E2a: unverified and revised continuously. "Jan–Oct" is the month of EEA's latest calculation, not a full month of data.
- Recycling: the 2020/21 report gives Jan–Oct 2021 = 42.60 %, the 2021/22 report 42.80 %. The later figure is used.
- Recycling: the full-year official rates for 2019, 2020, 2022, 2023 and 2024 are still missing (see `gap`).
- `samples_2023_2024` keeps its literal key and seasons.
- The CSV links each EEA value to the encoded query that returns it: the class rows to the map layer's query for that beach, the assessment, sample and air rows to the discodata query.

## Regression, 10 Oct 2026

Every value of the 16 Sep file is reproduced:
- the EEA classes, assessments and samples;
- the 2021–2024 air rows;
- all recycling rows and partials;
- the generated note, summary and gap texts.

Run against the old row set, the summary and gap templates give the old strings exactly.

Changed upstream: the 2026 E2a air row was revised by EEA.

| 2026 E2a field | 16 Sep | 10 Oct |
|---|---|---|
| PM2.5 annual mean | 13.7 | 13.5 |
| NO2 annual mean | 18.2 | 18.5 |
| O3 annual mean | 58.1 | 57.3 |
| O3 days > 100 | 47 | 48 |

New: the 2025 validated (E1a) air row:
- PM10 18.9 µg/m³, 5 days > 50;
- PM2.5 10.9;
- NO2 16.3;
- O3 10 days > 120.

Because of the new row, `exceedances_summary` now reads 2021–2025 and `gap` now names 2026. No new bathing season and no new recycling figure.

## 8 Nov 2026: EEA's map services, the 2025 bathing season

EEA's discodata SQL endpoint has answered HTTP 403 (an Azure gateway) to every query with a WHERE clause from this
network since at least 5 Nov (it answered on 10 Oct), so the script now reads the bathing water classes from EEA's
bathing water map service (ArcGIS REST) and checks the air rows against EEA's air quality statistics layer. SHMÚ's open data
(`opendata.shmu.sk/airQuality/`) hold no statistics, only a link to EEA's Air Quality Download Service, which gives
measurements rather than EEA's statistics; it is not used.

Every value of the 10 Oct file is kept. The map service gives the same classes for 2015–2024 as discodata did.

New:
- season 2025 for `SKREK032`: "1 - Excellent" (reported "1 - Excellent");
- `beaches`: `SKREK032` (Juh, 48.2151, 17.4111), `SKREK043` (Sever) and `SKREK044` (Východ), the last two "0 - Not
  classified" for 2025, each with its ÚVZ profile;
- three CSV rows (the three 2025 classes); the bathing rows' `subject` now names the beach, and the class rows link to
  the map layer.

Kept from the discodata result of 10 Oct 2026: `assessment_details` (to 2021–2024), `samples_2023_2024` and every air
row. The air check on 8 Nov: the six statistics the layer has agree for 2021–2025.

Manual inputs changed: `bathing_water_id` (the three beaches; the coordinates of the old text dropped, `beaches` has
EEA's), `history_note` (Excellent 2023–2025) and the tail of `latest_classification.note`, which now applies while
2025 is EEA's newest season.

## 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.
