Skip to content

feat(calendar): per-Bundesland school-holiday features (roadmap #6)#364

Merged
bartzbeielstein merged 3 commits into
developfrom
feat/school-holiday-bundesland
Jun 12, 2026
Merged

feat(calendar): per-Bundesland school-holiday features (roadmap #6)#364
bartzbeielstein merged 3 commits into
developfrom
feat/school-holiday-bundesland

Conversation

@bartzbeielstein

Copy link
Copy Markdown
Collaborator

Implements roadmap item #6: bundled per-Bundesland school-holiday table + calendar features.

  • create_school_holiday_df / get_school_holiday_features (calendar family, mirrors the day-type pair; single state-selected is_school_holiday int column, state="NW" default, DE-only)
  • Bundled interval table datasets/csv/school_holidays_de.csv (626 rows, 16 states, 2022-01-01 → 2027-12-31 validity from companion meta CSV; records kept in natural API form)
  • License sign-off requested: data from the OpenHolidays API (https://openholidaysapi.org), bundled under ODbL-1.0 with REUSE sidecars + LICENSES/ODbL-1.0.txt. ODbL is share-alike for the database only; attribution and notice are preserved via the sidecars. If ODbL is unacceptable, the fallback is a manual KMK transcription.
  • Fail-safe: requests outside the validity range raise ValueError (no fill parameter); country_code != "DE" raises
  • Config flag include_school_holiday_features on ConfigMulti (ConfigEntsoe inherits) + selector branch + multitask wiring, mirroring include_day_type_features
  • Opportunistic fix: day-type pair added to the sidebar Calendar section (pre-existing autosummary/sidebar drift)
  • Reviewed (REQUEST-CHANGES round resolved: HE Weihnachtsferien 2027 record restored, 23 truncated-duplicate rows de-duplicated, tz-aware boundary false-raise fixed + regression tests)

Full pipeline green: 2434 passed, ruff/reuse clean, full quarto render OK.

🤖 Generated with Claude Code

bartzbeielstein and others added 3 commits June 12, 2026 01:23
Adds school-holiday calendar features for all 16 German Bundesländer,
sourced from the OpenHolidays API (ODbL-1.0), covering 2022-01-01 to
2027-12-31.  Requests outside the covered range raise ValueError (fail-safe;
no fill/extrapolation).  Only country_code="DE" is supported.

Data:
- datasets/csv/school_holidays_de.csv (648 rows, 16 states)
- datasets/csv/school_holidays_de_meta.csv (validity range metadata)
- LICENSES/ODbL-1.0.txt
- REUSE sidecar .license files for both CSVs

Code:
- calendar/holiday.py: create_school_holiday_df() + get_school_holiday_features()
- calendar/__init__.py: export both symbols
- data/fetch_data.py: load_school_holidays_de() loader
- manager/features.py: select_exogenous_features() gains include_school_holiday_features kwarg
- configurator/config_multi.py: include_school_holiday_features: bool = False field
- multitask/base.py: wires include_school_holiday_features into the concat + select pipeline

Docs:
- _quarto.yml: adds both new symbols to autosummary and sidebar; also fixes
  pre-existing sidebar drift by adding create_day_type_df/get_day_type_features
- quartodoc reference pages generated for create_school_holiday_df and
  get_school_holiday_features

Tests (tests/test_calendar_school_holiday.py, 30 tests):
- determinism, dtype/no-NaN/binary, known NW 2024 vacations (Osterferien,
  Sommerferien, Herbstferien), state isolation (BY vs NW on 2024-08-21),
  inclusive edges, hourly broadcast, fail-safe both edges, country_code
  validation, selector toggle, bundled-data integrity (16 states, schema,
  row count in [500,650], meta)

Full-repo follow-up (spotforecast2, not this repo):
- No wiring changes needed in the full repo: include_school_holiday_features
  is fully wired in sf2-safe's multitask/base.py concat + select blocks.
  ConfigEntsoe inherits include_school_holiday_features via ConfigMulti
  (dataclass inheritance).  The full repo reads sf2-safe; no additional
  wiring or re-exports required there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FIX 1 — datasets/csv/school_holidays_de.csv: add missing HE Weihnachtsferien
2027-12-23/2028-01-11 record; de-duplicate all 23 truncated-duplicate pairs in
MV and SH (keep natural/longer end_date per DATA POLICY); re-sort by (state,
start_date).  Final row count: 626, 16 states, 0 duplicate keys.

FIX 2 — calendar/holiday.py create_school_holiday_df: normalize tz-aware
timestamps in range check via .tz_convert(None).normalize() so a boundary
timestamp such as 2027-12-31 23:00 UTC no longer falsely raises ValueError.
Also fix pd.date_range call to localize string start/end to inferred_tz before
mixing with a tz-aware counterpart.

FIX 3 — tests: pin HE Weihnachtsferien 2027 (test_he_weihnachtsferien_2027):
2027-12-22 == 0, 2027-12-23 through 2027-12-31 all == 1.

FIX 4 — tests: tz-aware boundary tests: end=2027-12-31 23:00 UTC does not
raise; end=2028-01-01 00:00 UTC raises ValueError.

FIX 5 — data/fetch_data.py load_school_holidays_de: sort returned DataFrame
by (state, start_date) as docstring claims.

FIX 6 — same docstring: reword datetime64 dtype claim to "resolution depends
on the pandas version".

FIX 7 — same regeneration note: replace endDate-truncation rule with the
natural-form DATA POLICY (keep startDate in range, verbatim endDate).

FIX 8 — configurator/config_multi.py: add include_ephemeris_features and
include_day_type_features entries to Args and Attributes docblocks; place
include_school_holiday_features directly after include_day_type_features to
match field order.

FIX 9 — calendar/holiday.py create_school_holiday_df: rename params
start_date/end_date → start/end, mirroring create_day_type_df; update call
site in get_school_holiday_features and docstring.

FIX 10 — data/fetch_data.py load_school_holidays_de: remove unused data_home
parameter entirely; update signature and docstring.

FIX 11 — manager/features.py: inline single-element allowlist for
is_school_holiday, eliminating intermediate variable.

FIX 12 — multitask/base.py: replace both getattr fallbacks with direct
self.config.include_school_holiday_features (field is declared on ConfigMulti).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bartzbeielstein bartzbeielstein merged commit c84d387 into develop Jun 12, 2026
10 checks passed
@bartzbeielstein bartzbeielstein deleted the feat/school-holiday-bundesland branch June 12, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant