Announcing an opening hours validator

That is already done in the opening hours library using the JavaScript Intl API.

It’s there for the truly invalid, I’ll replace either “Suggested fix” or “Invalid hours” sort with a date sort for the fixable ones.

I haven’t added all countries yet, happy to have more added though. (It’s built on github servers which don’t have space for the whole planet at once, so it’s using country extracts and each one needs some configuring).

Hmm, I guess that couldn’t really mean anything else, I could add a special case for that.

Well there’s my user page or the github repo, but I’ll think about a start page now that I have a few different tools

1 Like

There’s a false positive:

Kiosk Grenzstüberl

opening_hours

“summer”: 07:00-20:00; “winter”: 09:00-17:00

Vorgeschlagene Korrektur

07:00-20:00 “summer”:; 09:00-17:00 “winter”:

Auswertungswerkzeug

vor 2 Jahren newrandomusername

This is excellent. Any chance you could extend it to also provide an “Edit in iD Editor” button?

The URL format is https://www.openstreetmap.org/edit?node=<id> or https://www.openstreetmap.org/edit?way=<id>. (I see that clicking the icon will already take you to the entity on openstreetmap.org, so it’s already just two clicks.)

Post can't be empty.

2 Likes

That isn’t strictly valid per the opening_hours spec though. Quotes indicates a comment (which should be placed after the times). summer and winter are not valid date ranges since they are too ambiguous. If specific dates can’t be used then some comment or fallback rule should be used here I think

1 Like

assuming this has been directly copied, the evaluation tool says"

“ <— (Please use notation “”" for ““”. Although using ““” is typographical correct, it is not defined in the opening_hours syntax. Correct typography should be done on application level …)

After changing that the tool is still not satisfied:

“summer”: <— (You have used the optional symbol in the wrong place. Please check the syntax specification to see where it could be used or remove it.)

Removing the optional symbol : removes error reports but leads to “unknown” opening hours.

Removing the " and leaving the : in place is still not perfect but the evaluation tool does handle it (more or less):

summer <— (Assuming “Jun-Aug” for “summer”.)

But leads to the object being closed for Sep-Nov and Mar-May.

In the next release of opening-hours.js summer will no longer be assumed to mean “Jun-Aug” (and similarly for other seasons) after being reported.

1 Like

I actually agree in general. But then it should be marked as not repearable maybe.

Nevertheless nice work.

You can consider adding Croatia when you’d be adding them…

4 Likes

Croatia is now included

(And since it’s the same backend, you get the report on phone numbers too)

1 Like

This is really great, thank you for the time you’ve spent to put it together and share it!

Also, if you were curious to see the edits people make from the tool using the iD link, you could add a hashtag to the URL, e.g. https://www.openstreetmap.org/edit?editor=id&way=822359512#map=19/44.0481767/-77.581523#hashtags=osmphonereport

3 Likes

Thanks!

For those which are not able to fixed (semi-)automatically, i.e. “Invalid Numbers”, would it be possible to also have an option “Comment in Changeset” in addition to existing “Open Note”?

(it is of course somewhat more work to find a changeset which added that broken phone=* tag, but it would be much more useful as I’d be contacting responsible party directly, and they’re most likely to know what is correct value or what they did wrongly; especially if that is relatively recent change)

3 Likes

I can see that would be good, but that means working with history extracts, which are harder to come by, or hitting the API a lot. There’s a link to the changeset of the object’s most recent edit, which I know is not always the changeset responsible for the issue.

But you can use the /history endpoint to get the history, and it’s only when no correction makes sense. You don’t need to use a history extract of the whole database.

1 Like

As far as I am aware, you can only get the history of one element at a time, so it would mean thousands of requests, which would at least take a lot of time, even if that’s considered acceptable use of the API (and I’m unsure about suitable limits there)

You don’t need more than the history of a single object at a time.

For those which are not able to fixed (semi-)automatically, i.e. “Invalid Numbers”, would it be possible to also have an option “Comment in Changeset” in addition to existing “Open Note”?

This mean ONE request, not thousands.

1 Like

Ah ok, I was thinking of working that out at compile time, when all the numbers are processed, but yes it could be done when the button is clicked on the client side.

2 Likes

Buttons should be more stable now (website is on its own row if it exists)

And the fixable items can now be sorted by date (defaulting to most recent first)

4 Likes

Just a minor thing I just noticed: The Phone Report is used as “created_by” :slight_smile:

And another thing that would be very useful in the similar vein:

When using Apply fix to automatically apply suggested formatting fix for opening_hours, would it be possible for OSM Phone Number Validation Reports to not only update opening_hours=* tag, but also add check_date:opening_hours=* tag, set to the last time when the opening_hours was modified (also perusing looking at object history at time of the click).

e.g. on OSM Opening Hours Validation Report - Osječko-baranjska županija first match is Zagrebačka banka, which (correctly) suggests changing Mo-Fr 8:00-18:00 to Mo-Fr 08:00-18:00 (i.e. adding a leading zero).

However, that node was last modified more then decade ago. It is quite likely that the opening hours have changed since then.

If only the opening_hours was changed (and an OSM element timestamp on update was thus set to today), many a data consumer will assume that this opening_hours was recently updated and is thus valid.

Common way to override that assumption[1] is by explicitly setting check_date:opening_hours which explicitly indicates when opening_hours were last verified.

It is especially useful for that particular tag, as opening hours changes often and are decisive factor for choosing where to go[2], and is used by editors and data consumers (e.g. CoMaps, StreetComplete) to give feedback to the user about recentness (and thus, trustworthiness) of the opening_hours.


So, for this particular example, I would suggest when Apply fix is clicked, the webapp would make API call to retrieve history of that node 356919117, find out that while last modification was just 11 years ago, opening_hours=* was last changed 16 years ago at 2010-04-20T08:40:46Z and thus add check_date:opening_hours=2010-04-20 in addition to fixed opening_hours=* tag.

I would find it very useful, as otherwise I’m wary of fixing the opening_hours tag (especially such minor deviations from specs) via that nice Apply fix button, unless the error was introduced relatively recently – as it would otherwise IMHO do more damage then help.


  1. which is just a wild guess, flawed by variety or reasons, e.g. changing unrelated tags, or even mass-aligning without any tag changes etc ↩︎

  2. you don’t want to go to a shop which is closed at the time you arrive there! You might rather go to farther shop, but which is known to be working at that time ↩︎

6 Likes