igneus / calendarium-romanum

liturgical calendar library (Roman Catholic, post-Vatican II)
50 stars 21 forks source link

Data source and license? #65

Closed sdegutis closed 3 years ago

sdegutis commented 3 years ago

Hi, I've been looking for formatted data about Catholic feast days, so I can use it in some of my apps/websites. Did you collect this data yourself, or did you find it from another pre-formatted data source? If you collected it manually, what license do you have for using the data? I don't use Ruby or any code here, and would just be transforming the data into JSON for my own personal use. Thanks in advance. God bless and keep you!

igneus commented 3 years ago

what license do you have for using the data?

For licensing purposes the whole content of the repository is considered a single thing (no special license for the data), dual-licensed: GNU/LGPL 3 or MIT license. What you probably want to do is "Great, thanks, picking the MIT option." It definitely permits you to transform the data as you wish; and my understanding is that the data files alone are not "copies or substantial portions of the Software" and hence there are no obligations binding you.

Did you collect this data yourself, or did you find it from another pre-formatted data source?

In cases where pre-existing digital data sources were used when creating a data file, the respective data source is usually referenced in a comment near the file's beginning. Virtually all data files have since been updated, sources of the updates are (not always) mentioned in the commit messages.

In case you were interested, here is an XML file encoding complete post-Vatican II development of the General Roman Calendar (Latin- and sanctorale-only), all collected from primary sources and rigorously referencing them: https://github.com/calendarium-romanum/historical/blob/master/data/general-roman-la.xml

sdegutis commented 3 years ago

Thanks! Impressive work. That XML file is all Latin, but universal-en.txt looks more practical for me, once I figure out how to parse it, which looks like a bit of a challenge. Anyway, in case you were interested in free Catholic books/resources, check out this site. God bless!

sdegutis commented 3 years ago

By the way, I don't mind giving any kind of attribution. You worked hard to collect and format this data, and that work should be honored. What kind of attribution would you like on my site?

igneus commented 3 years ago

You worked hard to collect and format this data

I (as well as other contributors of data files) definitely worked, but not that hard.

What kind of attribution would you like on my site?

If you wish to give some kind of attribution, link to this Github repository with an appropriate comment (e.g. something like "liturgical calendar data extracted from the calendarium-romanum Ruby gem") would be the preferred form.

... once I figure out how to parse it, which looks like a bit of a challenge ...

The data format is (at least IMO) well documented. If anything is not clear enough, feel free to ask questions.

Naturally the easiest way to do the data transformation is to use this very Ruby gem to load the data and then serialize them. I may even do this for you, if you already have a good idea what the resulting JSON should look like. Quite probably it won't require but a few lines of Ruby code.

sdegutis commented 3 years ago

Thanks. I may do just as you suggest, as I haven't done Ruby in years and it would be a fun trip down memory lane. It would also make a good lesson for my son in some Ruby, and give me a good reason to explain why I prefer JS lately.

igneus commented 3 years ago

Code snippet to start with:

require 'calendarium-romanum'

sanctorale = CalendariumRomanum::Data::GENERAL_ROMAN_ENGLISH.load
# => a Sanctorale instance with contents of data/universal-en.txt loaded
igneus commented 3 years ago

Conversation seems to be over, closing.

Feel free to reopen should there be further related questions.

sdegutis commented 3 years ago

Thanks for the code snippet. Ruby is not hard for me, as I have become more than proficient in it years ago. But knowing what to do next with you code snippet is extremely difficult, and I think for two reasons. First, because I don't really understand the liturgical calendar in the depth that you clearly do. Second, because you Ruby API, adhering to the inherent complexity of the calendar and its applications to real life purposes, is necessarily also very complicated. My goal is to get a list of feast days for every day of the year, in the modern calendar, with the color and saint/feast name for each day. I think we're going to manually parse universal-en.txt since it seems to have all these properties.

One question I do have though: is any of this data time-dependent? I mean, my goal is to reproduce my Catholic wall calendar's feast days list using software in an app. Can I just produce a single JSON file that's always accurate, from this data? Or, aren't there feasts that don't fall on calendar days, but situations where a feast fall on something like "ever first Tuesday of October" which inherently must be in another data source? Is that part of what your Ruby gem takes care of? I'd like to have static data to work with, which I plan to port to JSON format, since my apps are browser-based and thus use JS natively. Can you point me to what I need to reproduce my wall calendar in app form? (And more?)

igneus commented 3 years ago

A complete script converting data/universal-en.txt to JSON may look like this

require 'calendarium-romanum'
require 'json'

sanctorale = CalendariumRomanum::Data::GENERAL_ROMAN_ENGLISH.load

normalized = sanctorale.each_day.collect do |date,celebrations|
  {
    date: "#{date.month}/#{date.day}",
    celebrations: celebrations.collect do |c|
      # it may be worth looking in the code or API docs for more Celebration properties, but these are the fundamental ones
      {title: c.title, rank: c.rank.priority, colour: c.colour.symbol}
    end
  }
end

puts JSON.dump normalized

But your questions seem to suggest that what you really want is not contents of data/universal-en.txt alone: the data file contains only celebrations celebrated on a fixed date and belonging to the sanctorale cycle. A liturgical calendar for a given year is built by combining two cycles of celebrations - temporale and sanctorale - and correctly resolving conflicts between them. If you want to have correct calendar data for a given day/week/month/year/..., you need to use a complete calendar computing engine.

If the web browser is your platform, you have following options:

sdegutis commented 3 years ago

Thanks!