-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resurveying opening hours #1651
Comments
Showing the input for new opening hours right away would also be an option. That's certainly what the user would expect. My preference is to have a parser written "from scratch" that only understands what the app can also display. Because, even if you took that javascript-parser-version, or any other, you'd still need a validator that checks whether the syntax can be displayed in StreetComplete. |
It sounds relatively simple to check whatever data in some reasonable structured format meets SC requirements. I looked a bit more and found https://github.com/simonpoole/OpeningHoursParser that seems promising.
Do you have any preference/advise for which kind of parsing library would be a good idea? I had some limited experience with parsing and not using parsing library from start was a big mistake.
That would be the ideal form. |
https://github.com/simonpoole/OpeningHoursParser indeed looks very good! The parsing result can then be scanned for elements that can not be represented in the form in StreetComplete quite easily! If this library is used, then the current data structures for the model (not the view model) should probably be replaced. |
There are some values that are gibberish or using syntax not supported by StreetComplete. Such opening hours will not be supported and due to both complexity and rarity are probably not worth supporting. But there are also some opening hours that can be entered with StreetComplete but also seem not worth supporting. I listed some spotted so far, I would welcome idea if someone has a good way to support some of them or feels that supporting them is necessary. This issues are related to intentional limitations of opening hours edit form. It is able to display certain subset of opening hours, in some cases it may be a bit surprising.
|
You can always start with supporting less and adding support for more things later. This is what I recommend anyway, since the initial effort is big enough anyway, as you need to probably replace all the data structures currently used for the model with the ones from that library. In detail regarding you questions:
Anyway, two things I want to comment on in general:
|
What about lossles conversions, without changing structure? For example:
Here I think that converting should be OK. If not, it would be fairly easy to add one more filter excluding tags where "nothing is changed" answer would edit
To make things simpler I ended with:
Objects returned by this parsing library are designed to represent all kinds of opening hours including things like
I worry here that reaction may be „it is open all the time, but not during PH” and then discover that it is not specifiable (I even attempted initially to use „PH 06:00-06:00” to specify „PH off”). But anyway, for now I decided to skip this in the initial version. I prefer to limit myself to reusing an existing UI.
For rules that target ranges without overlap is perfectly OK and valid. Fun appears where ranges overlap, but I have now code that successfully detects such opening hours and refuses to process them.
That is why first made simple prototype first – with display of raw opening hours tag ( I think that it is a really good idea. Also, I may be still bitter that I arrived to a closed IKEA because I trusted opening hours from OSM.
I noticed the problem. And I went with this one as I though about finishing one of open tasks where I spend some time on digging around. Though now I see that it would be better to finish one of cases where I have nearly finished code except some small irritating part. |
I stopped writing an issue because of this one, so my question is: what's the state of tje opening hours? Background is here, that in 4 of 5 cases when i try to answer this quest, it's more complex than 8h/day from Mo-fr. So i downloaded Vespucci to read other opening information and added stuff to my own changes, not very comfortable. Is it or will it be possible to select many different hours for this quest? |
implemented! |
based on more general #1112 #1364
In context of resurveying things
opening_hours
tag is a bit special:To handle it properly and to not end with something horrible for start it would be nice to have something along lines: "Is following opening hours still correct for $NAME?" and show opening hours data.
On answering yes, it would add
check_date:opening_hours
.On answering no it would delete
opening_hours
tag andcheck_date:opening_hours
if present, what should trigger opening hours quest allowing to enter correct data.Most of the fun is in "show opening hours data". Raw tag value is used in test version, but it is obviously not a proper solution, parsing opening hours data into some readable format is necessary, with unparsable opening hours fields ignored.
For parsing I see two solutions - (1) follow JOSM and embed js code from https://github.com/opening-hours/opening_hours.js and use it for parsing or (2) write a new parser from scratch, starting from one handling a small subset of
opening_hours
syntax.@westnordost For me both versions sounds a bit frustrating and I have no strong preference - do you have any preference toward either one? I predict that running js code within SC may have some issues with getting more dependencies (js library itself, runner of js code that would be probably Rhino or an other Java library) while new parser will take more time to recreate something already written.
Working on this was triggered by going to a shop and discovering there that it is closed because OSM data for
opening_hours
was old and wrong.The text was updated successfully, but these errors were encountered: