Skip to content

Migrate school holidays to OpenHolidays API#544

Merged
KristjanESPERANTO merged 1 commit intoopening-hours:developfrom
KristjanESPERANTO:sh
Jan 24, 2026
Merged

Migrate school holidays to OpenHolidays API#544
KristjanESPERANTO merged 1 commit intoopening-hours:developfrom
KristjanESPERANTO:sh

Conversation

@KristjanESPERANTO
Copy link
Copy Markdown
Member

@KristjanESPERANTO KristjanESPERANTO commented Jan 10, 2026

Migrates school holiday data from manually maintained YAML to automated OpenHolidays data via Git submodule, expanding coverage to 33 countries 🎈

Approach Evolution

Initially implemented using the OpenHolidays REST API, but switched to Git submodule approach for reliability:

Why the change?

  • Network dependency breaks offline builds
  • Submodule provides reproducible builds (exact commit tracked)
  • All data auditable in repository

Changes

  • Added openholidaysapi.data as Git submodule
  • Migrated 8 countries to OpenHolidays: at, be, de, fr, hr, hu, lu, ro
  • Added 25 new countries via OpenHolidays data
  • Created automated fetch script (scripts/fetch-school-holidays.mjs) that parses CSV files from submodule
  • Added release process step in CONTRIBUTING.md

Benefits

  • Fully reproducible builds: Exact data commit tracked in Git
  • No network dependency: Works offline, no API timeouts
  • Expanded coverage: 25 new countries with school holidays
  • One-command updates: node scripts/fetch-school-holidays.mjs
  • Auditable: All data visible in submodule
  • Easy updates: git submodule update to get latest data

Breaking Change

No. Our historical school holiday data was transferred to OpenHolidays. Existing functionality remains unchanged.

@KristjanESPERANTO KristjanESPERANTO force-pushed the sh branch 2 times, most recently from 12b5fb2 to e7f787e Compare January 10, 2026 18:36
@HolgerJeromin
Copy link
Copy Markdown

Is it easy possible to keep historic data in the existing files?

@ypid
Copy link
Copy Markdown
Member

ypid commented Jan 11, 2026

Looks very promising! This PR relates to #300.

I also have a slight preference to keep historical data. But I don’t see a real use case either. If the default release we do only contains say a few years into the past than that should be fine. A build option could be added that creates a release with all holiday definitions. But that is optional. I guess the proper way to keep the historic data would be to upstream it to https://github.com/openpotato/openholidaysapi.data but I would also say it is not worth the effort.

Another idea: Instead of using the API, https://github.com/openpotato/openholidaysapi.data could be added as git submodule. It is very small and having it as submodule would make the process of generating more auditable/reproducible. But I only peeked at the data files and your script.

@HolgerJeromin
Copy link
Copy Markdown

I asked over there and they would be happy to have this historic data...

@KristjanESPERANTO
Copy link
Copy Markdown
Member Author

Instead of using the API, openpotato/openholidaysapi.data could be added as git submodule.

I'll take a look at it.

I asked over there and they would be happy to have this historic data.

Thanks for checking it out! I'll see if I can somehow convert it into their format.

@KristjanESPERANTO
Copy link
Copy Markdown
Member Author

About the historic data we made some progress (openpotato/openholidaysapi.data#152). There is still an open PR (openpotato/openholidaysapi.data#154) on this; but once it has been done, we can close this topic and don't lose our historic data with the migration 😃

I have changed this PR to draft and will leave the status until I have dealt with the topic “using the data from the repository instead of the API”.

@KristjanESPERANTO
Copy link
Copy Markdown
Member Author

The migration of the historic data is done 😃

Before proceed with this PR here, I would like to resolve that issue: openpotato/openholidaysapi.data#155

@KristjanESPERANTO
Copy link
Copy Markdown
Member Author

KristjanESPERANTO commented Jan 21, 2026

I converted the PR from a API approach to a submodule approach as suggested (and updated the PR text accordingly). PR is ready for review 🙂

Migrate school holiday data from manually maintained YAML files to
automated generation from OpenHolidays Git submodule, expanding
coverage from 8 to 33 countries.

Implementation:
- Add openholidaysapi.data as Git submodule
- Create fetch-school-holidays.mjs to parse CSV files from submodule
- Generate subdivision entries using full names from subdivisions.csv
- Merge generated SH data with existing YAML PH data
- Add export validation for index.js

Migrated countries (8): at, be, de, fr, hr, hu, lu, ro
New countries (25): ad, al, bg, by, ch, ci, cz, dk, ee, es, ie, it,
li, lt, lv, mc, md, mt, mx, nl, pl, pt, rs, si, sk, sm, za

Tests updated from 2014-2015 to 2024-2025 timeframe.
Update data: node scripts/fetch-school-holidays.mjs
Copy link
Copy Markdown
Member

@ypid ypid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed through it. Nice work! Looks good.

@KristjanESPERANTO KristjanESPERANTO merged commit ec76a4c into opening-hours:develop Jan 24, 2026
5 checks passed
@KristjanESPERANTO
Copy link
Copy Markdown
Member Author

KristjanESPERANTO commented Jan 24, 2026

@ypid Thanks! I think now after merging this is a good time for a release 🙂

If that goes well, I might look at migrating PH next.

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.

3 participants