GothenburgBitFactory / holidata

Holidata is the core of holidata.net, a no-nonsense, ad-free provider of international holiday data.
https://holidata.net
MIT License
47 stars 13 forks source link

Support location in addition to ISO 3166-2 codes as region #57

Open vice opened 4 years ago

vice commented 4 years ago

In Spain we have national and regional holidays that can be covered by ISO 3166-2:ES codes but also 2 days of local holidays. And by local I mean holidays different by location not province. i.e. a Granada, Málaga or Seville holiday is not for the whole province but just for the city.

I think we must use ISO 3166 codes for regions that are covered but for smaller divisions accept the complete localized name of the location. Holidays by regions smaller and/or not in ISO 3266 codes could be the case in other countries. At least it is for Spain. region meaning
AN for Andalusia autonomous community ISO 3166-2:ES
GR for Granada province ISO 3166-2:ES
MA for Málaga province ISO 3166-2:ES
SE for Seville province ISO 3166-2:ES
Granada for Granada city (proposed)
Málaga for Málaga city (proposed)
Sevilla for Seville city (proposed)

But I don't know if the region parameter can handle safely UTF-8 and spaces present in some location's name.

lauft commented 4 years ago

You are not alone: There is a similar problem in Germany, where the city of Augsburg has its own holiday. Another holiday in Saxonia is only held in communities with mostly catholic population, which may change according to the current census data. Also there are some regions in Australia, where holidays are only held in parts of that region.

The advantage of ISO codes is that they are a standard, i.e. they are the same regardless of language. Adding city names to the region definition also adds (apart from the mentioned UTF-8 and spaces) the problem of internationalization: how do you refer to these in a different locale for the same country? (Unfortunately ZIP codes seem not to be impractical as they often do not coincide with commuity borders.)

You also have to consider the consumer side: For example the refresh scripts of taskwarrior and timewarrior lets you choose the region for your holiday data and filters the holidata accordingly. How shall the additional location be implemented here? How can one retrieve all holidays from region X except/including location Y from holidata?

So far I chose to merge those holidays into the larger region or to ignore them for simplicity sake and least impact on the consumer side.

That said, this is not a "no" to your proposal, but we need a solution that is feasible for all locales in holidata.

A first compromise for #56 would be to include those holidays with an additional note "sólo para la ciudad de Granada". 🤔

vice commented 4 years ago

You are right. Is more complex than I though. For #56 I am going to include some national corrections and try to include more regions (comunidades autónomas) than just Andalusia. Keeping out local holidays for now. Just that is going to be more work than expected.