OpenStreetMap logo OpenStreetMap

Introduction

Hi everyone! As GSoC 2021 is coming to a close, I am writing this diary entry as a final report on the progress of my GSoC project, the OpeningHoursEvaluator, in the second period of GSoC.

Previous entries

Project Summary

An evaluator for opening hours tag according to OSM opening hours specification.

Second Period’s Summary

Just to recap, the evaluator from the first period supports almost all the syntaxes defined by the specifications, ranging from something as small as time and a wider range such as year. Building from my previous progress, I have added geocoding to the evaluator, for use in calculation of variable time such as dawn, dusk, sunrise, sunset. I have also added support for holiday data for the corresponding opening hours tag PH and SH, which currently supports 168 countries. Combined with my progress in the first period, the current evaluator now supports evaluation of all the syntax defined by the grammar, and is ready for use in production.

Source code

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

Timeline

  • Jul 12-18
    • Add more detailed documentations for first period’s word
    • Test and fix bugs
  • Jul 19-25
    • Add support for variable time (dawn, dusk, sunrise, sunset)
    • Add dedicated geocoding for evaluator, with automatic lookup of timezone and location based on coordinates
    • Look up suitable holiday data for use when checking holidays
    • Add documentation
  • Jul 26-Aug 2: Since the holiday data I found is only raw strings, and needs pre-processing to calculation to date, from this point on, I worked on creating a parser for this holiday data. The work was done on a different repository, which can be found here
    • Create custom gson deserializer to create objects from holiday data
    • Add support for Gregorian dates (MM-DD and YYYY-MM)
    • Add support for start of month
    • Add support for easter/orthodox calculation
    • Add support for Hijra calendar
    • Add support for Hebrew calendar
    • Add support for East Asian calendars, including Chinese, Korean, and Vietnamese
    • Add support for astronomical time calculation such as Equinox and Solstice
    • Add support for different start time
    • Add support for nth weekday in month
    • Add support for changing weekday if holiday falls on certain weekday
  • Aug 2-8: Keep working on the parser
    • Add support for extra weekday if holiday falls on certain weekday
    • Add support for enabling holiday only on certain years
    • Add support for enabling holiday only on certain weekdays
    • Add support for enabling holiday only in year interval
    • Add support for enabling holiday since certain years
    • Add support for Julian calendar
    • Add documentation
  • Aug 9-15
    • Add support for public holidays (PH) and school holidays (SH) on a national level
    • Add support for PH and SH on a regional level (including states and subregions of a country)
    • Add documentation
    • 0.0.1 published to Maven Central!

Initial goal satisfaction

I have set out to add support for the variable time calculation and holiday support for the evaluator, and I believe that I have completed both of the core objectives for my second period. I even went ahead and created a Java library to grab holidays of countries in the world. However, I did also set out to fix all the bugs that I have listed in my previous diary entry, but due to some time constraints I did not get around to dealing with all of them in this period. More information on this in the Shortcomings section.

Shortcomings

Though I have set out to finish these bugs, 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

This bug will be dealt with post-GSOC, as well as other core improvements.

Acknowledgments

Throughout GSOC, 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. Special thanks to Simon for hosting the namespace where my project is published to on Nexus Repository!

I would like to thank 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.

I would like to thank the authors of date-holidays for their incredible data of holidays in the world, supporting 168 countries and many other subregions, which I used to add support for the PH and SH in the evaluator.

And I would like to thanks OSM and its community for giving me this opportunity to participate in Google Summer of Code with them!

What’s next after GSoC?

There are many bugs that I have not have the time to deal with, and these will be fixed later. More improvements on core features will be planned in a later date, or taken from the Issues section of the repository.

I will keep maintaining this project for as long as I can! If there are any issues, please raise them on the Issues section of the OpeningHoursEvaluator and I will deal with them as soon as possible.

Discussion

Comment from gileri on 19 August 2021 at 06:45

Thank you for this tool and presentation. I hope you had a good time too :)

Log in to leave a comment