KOpeningHours in kdereview
Volker Krause
vkrause at kde.org
Thu Dec 10 16:56:15 GMT 2020
Hi,
KOpeningHours is a library with C++ and QML API for parsing and evaluating OSM
opening hours expressions. That might sound simple, and for basic cases like
`Mo-Fr 09:00-17:00` it is, but it gets quite a bit more complex for more
elaborate expressions that consider e.g. public holidays or seasonal changes.
https://invent.kde.org/libraries/kopeninghours
The most notable feature gap compared to the official specification is
probably school holidays, we lack a collection of international data for that
so far. That only occurs in about 2k out of the 1.8M opening hours expressions
in the full OSM database, so that's not a massive problem in practice.
The API is prepared to handle the very similar OSM service time format ("point
in time mode") as well, but evaluation for that hasn't been implemented yet.
The first users are KOSMIndoorMap and KDE Itinerary, for graying out elements
on the map that aren't going to be available during a layover, and for showing
a human-readable interpretation of the opening hours for a selected entity.
You were at Akademy 2018 and got surprised by shops/restaurants suddenly being
closed on Wednesday? That's exactly why you want this :)
PBI also has previously shown interest in supporting schema.org opening hours
data, which KOpeningHours can consume as well. That was the original
motivation to do this as a separate library, but meanwhile it's also being
evaluated for use in OSM validation tooling: https://github.com/osm-fr/osmose-backend/issues/555. That has already resulted in a number of contributions
increasing the tolerance for non-conforming expressions, which benefits all
other use-cases as well.
Two command line demos and a QML example are included, if you want to try it
I'd recommend to also get the latest KF5::Holidays to have all needed fixes
and performance improvements.
My goal would be to have this join the release service for 21.04, so KDE
Itinerary can properly depend on it.
Thanks,
Volker
More information about the kde-core-devel
mailing list