OpenStreetMap logo OpenStreetMap

Introduction

Hi everyone! As the first evaluation period is closing in, I am writing this diary entry as an update on the progress of my GSoC project for OSM, the OpeningHoursEvaluator.

Using the test-driven development approach (which, by the way, works wonderfully with this project), suggested by one of my mentors, Simon Poole, my project OpeningHoursEvaluator, an evaluator for the opening hours tag defined by OSM, is progressing fairly well, with the evaluator supporting almost all the syntaxes defined by the specifications, ranging from something as small as time and a wider range such as year, except for certain syntax where the OpeningHoursParser have yet to cover, variable time (dawn, sunrise, sunset, dusk), and also country-specific public holidays and school holidays (PH, SH). This is something I intend to complete in the second period of GSoC.

Current project location

GitHub repository: https://github.com/goodudetheboy/OpeningHoursEvaluator

Timeline

  • Jun 8-13:
    • Set up project development environment and continuous integration
    • Set up test suite, which includes the opening hours, input time, and answers, and test driver
    • Add support for 24/7
    • Add support for open and closed rule modifier
    • Add basic support for time selector (checking within 24 hours)
    • Add basic support for weekday selector (checking Monday to Sunday)
  • Jun 14-20
    • Add support for unknown rule modifier
    • Add support for time spilling (wrapping) between days (for opening hours like “20:00-1:00”)
    • Add support for additional rule (doesn’t override day)
    • Add support for interval in time selector
    • Add support for day spilling (wrapping) between weeks (for opening hours like “Sa-Mo”)
  • Jun 21-27
    • Add support for time selector with open end (for opening hours like “18:00+”)
    • Add support for fallback rule
    • Add support for Nth weekday (for opening hours like “Mo[1]”, or the first Monday of month)
  • Jun 28-Jul 4
    • Add support for negative Nth weekday (for opening hours like “Mo[-1]”, or the first Monday of the month, counted from the end)
    • Add support for day offset for Nth weekday (for opening hours like “Mo[1] +2 days, or 2 days after the first Monday of the month)
    • Add support for date of month (for opening hours like “Jun 28-Jul 4 open”)
    • Add support for date offset in date of month
    • Add support for weekday offset in date of month (for opening hours like “Jul 1 +Su”, or the first Sunday after Jul 1)
    • Add support for easter
    • Add support for month range
    • Add support for week of year (for opening hours like “week 1-5” or opening from week 1 to week 5 of the year)
    • Add support for interval in week of year (for opening hours like “week 1-6/2”, or opening in week 1, 3, and 5)
    • Add support for year range
  • Jul 5-11
    • Add support for date of month with open end
    • Add open/close next feature

Additionally, throughout the period, I have set up non-grammar exception handling for error such as:

  • Empty Rule (for opening hours where there is an empty rule like “Mo open; ; Tu off”, where the middle rule is an empty one)
  • Obviously illegal date, month, and year range (for example, “2019 Jun – May”)
  • Illegal Nth range (for example, “Mo[4-1]” or “Mo[-1-3]”)
  • Time spanning more than two days
  • Open end of ambiguous date of month without a year (for example, “May 12+”)
  • Illegal placement of year such as “May 12-2021 Jun 15”

Initial goal satisfaction

Compared to the initial goal of this first period, which is to cover all the opening hours syntaxes excluding the stage of day (dawn, dusk, etc.) and the country-specific holidays, the current state of the project has been quite satisfactory. Even though I have decided to go with a completely different approach from what I imagined during the application period, I have managed to cover almost all the syntaxes, which work closely to what I planned it to be due to features being test-driven.

Currently, the project is to a certain extent in good shape, so I encourage anyone who is interested in this project to test it out. There is a GitHub repository link above which you can clone from, and any issues should be raised in the GitHub link.

Shortcomings

However, due to some limitations with my design, there are some features that I have yet to fully implement, including:

  • Time cutting when a definite time range cut an open-end time range
  • Country-specific start of week-related features (the start weekday of a week is different depending on the countries. According to ISO 8601, Monday is considered to be the first day of the week, while in countries like the US, Canada, and Japan, it is Sunday instead. More info here)

I have also not written a dedicated documentation for my project yet, due to some time constraints on my side.

Acknowledgments

Throughout the first period, I am really grateful to my mentors Simon Poole and Rebecca Schmidt, who have been extremely helpful to me for answering my questions about evaluation of certain opening hours, giving feedbacks about code snippets, and providing all the help they can regarding the technical side of things. I alsow would like to thank to the authors of opening_hours.js, whose Javascript version of the evaluator has helped me a great deal in creating test cases for my evaluator.

What’s next for the second period?

In the next 5 weeks of the second period, I will carry out the two remaining goals I have set out, which are “Adding support for sunrise/sunset information” and “Adding support for holidays information”. I will also complete whatever is left in the Shortcomings section.

Discussion

Log in to leave a comment