OpenStreetMap

goodudetheboy's Diary

Recent diary entries

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.

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.

Introduction

Hi OSM community! My name is Vuong Ho, an international student at the University of Rochester in the U.S. I am currently living in Ho Chi Minh City, Vietnam, though, since due to Covid-19, I haven’t had the chance to go the States yet. In my free time, I like to tinker away with my small personal projects, play games with my friend, and watch cat videos on Youtube. Once this pandemic is over, I am thinking of going mapping around too!

Though I have never contributed to open-source, I really like the idea of openly sharing software for public use and would like to contribute to a project someday. Therefore, I am really glad to have the opportunity in this GSoC to contribute to OpenStreetMap!

My GSoC project: Opening hours tag evaluator

As noted by Simon Poole, the current opening hours parser lacks a complete evaluator for its input opening hours tag. This project will center around building an evaluator to determine if an input of date and time translates to a location is currently opened or closed based on an opening hours tag (specifications here). This evaluator will also support checking sunrise/sunset and holiday information, if any is provided in the opening hours tag, since these are supported by the parser.

The evaluator will be in the form of a data structure resembling a compact calendar, though this may change over the course of the project since I will be making use of the test-driven development framework to develop the evaluator. The information on sunrise/sunset and holidays is taken externally, using other open-source libraries and data. My full project proposal can be found here.

The milestones for my project in the span of two months of this year’s GSoC are:

  1. Creating a simple evaluator that supports checking open/close status of time and day
  2. Adding support for sunrise/sunset information
  3. Adding support for holidays information

Thank you for reading my introduction! I look forward to working with everyone in the OSM community! I will be regularly updating my diary as I move along with my project, and if you have any questions, feel free to put them in the comments!

Location: Ben Thanh Ward, District 1, Ho Chi Minh City, Vietnam