igneus / calendarium-romanum

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

Calendar for The Ordinariate of the Chair of St. Peter #44

Closed RussellHaley closed 4 years ago

RussellHaley commented 4 years ago

Hi,

I'm a member of The Ordinariate of The Chair of St. Peter. I wanted to automate our church calendar on our new website. I'm not sure about the specific differences between the Roman Calendar and the Ordinariate Calendar as of yet but I assume I will need to change the universal-en.txt data file and possibly make modifications to calendarium-romanum/lib/calendarium-romanum/temporale.rb.

Should I be looking at implementing the new Calendar in this project, or the Church Calendar API? I don't see a corresponding temporale.rb in the CC API project.

Any advice you could offer would be great.

igneus commented 4 years ago

Hi,

I must admit having no prior knowledge of the Anglican ordinariates' liturgy and calendar(s). Trying to find some kind of a "formal specification" of the calendar, I found this - I am, however, not at all sure how un/official this document is, by whom it was prepared and how exact it is.

If it describes the calendar correctly, the calendar system is very similar to the current Roman one, but there are some differences in Sunday counting and there seems not to exist a single "Ordinary Time", but instead two liturgical seasons (after Epiphany, after Trinity) spanning the same periods of time. This would mean that in order to implement the ordinariate's calendar, you can mostly use this gem's code. You will have to prepare a sanctorale data file and a class extending Temporale and implementing the ordinariate's specifics (liturgical seasons not known to the Roman calendar, Sunday numbering, custom movable feasts if there are any differences).

require 'calendarium-romanum'

module OrdinariateCalendar
  class Temporale < ::CalendariumRomanum::Temporale
    # most of the hard work comes here
  end
end

year = 2019
sanctorale = CalendariumRomanum::SanctoraleLoader.new.load_from_file 'path/to/your/ordinariate_chair_st_peter.txt'
temporale = OrdinariateCalendar::Temporale.new(year)
calendar = CalendariumRomanum::Calendar.new(year, sanctorale, temporale)

In the custom Temporale implementation you will have to override all the public season-computing methods:

then the protected method prepare_solemnities (which computes dates of all movable celebrations, not only solemnities) and possibly also methods ferial and sunday, in order to correctly handle ferial and Sunday naming for the seasons unknown to the Roman calendar.

Feel free to ask questions along the way. I suspect the process could inspire some modifications to calendarium-romanum itself, making it more suitable for extensions like this.

RussellHaley commented 4 years ago

Thank you, I look forward to drilling in.

RussellHaley commented 4 years ago

I used the the ordinariate calendar file you found and modified the sanctorale data file universal-en.txt. I also added an ordinariate-temporal.rb file that just calls super. I added a file called cmds.rb to run the commands as you specified them. https://github.com/RussellHaley/calendarium-romanum/commit/0db980bd5d28be228fd5dfc7f044711dda4743c1

I am getting an error when reading the sanctorale files. I get the same error with universal-en.txt and ordinariate-en.txt. The error occurs before any changes that I made (other than the title). Thoughts?

ruby cmds.rb 
Traceback (most recent call last):
        6: from cmds.rb:5:in `<main>'
        5: from /var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:82:in `load_from_file'
        4: from /var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:35:in `load'
        3: from /var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:35:in `with_index'
        2: from /var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:35:in `each_line'
        1: from /var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:63:in `block in load'
/var/lib/gems/2.5.0/gems/calendarium-romanum-0.6.0/lib/calendarium-romanum/sanctorale_loader.rb:66:in `rescue in block in load': L8: Syntax error, line skipped '2 m basil_gregory : Saints Basil the Great and Gregory Nazianzen, bishops and doctors' (CalendariumRomanum::InvalidDataError)

Here is the diff of the sanctoral files for your reference:

--- universal-en.txt    2019-09-23 21:34:53.048062909 -0700
+++ ordinariate-en.txt  2019-09-23 21:35:20.196066101 -0700
@@ -1,13 +1,17 @@
 ---
-title: General Roman Calendar
+title: General Calendar for The Ordinariate of the Chair of Saint Peter
 locale: en
 # source: https://en.wikipedia.org/wiki/General_Roman_Calendar
+# source: http://prelaturaspersonales.org/wp-content/uploads/2012/02/Calendar_for_Ordinariate.pdf
 ---

 = 1
 2 m basil_gregory : Saints Basil the Great and Gregory Nazianzen, bishops and doctors
 3 name_jesus : The Most Holy Name of Jesus
+4 elizabeth_ann_seton : Saint Elizabeth Ann Seton, Religious
+5 john_henry_newman : Saint John Henry Newman, Bishop
 7 raymond : Saint Raymond of Penyafort, priest
+12 benedict_biscop : Saint Benedict Biscop, Abbot
 13 hilary : Saint Hilary of Poitiers, bishop and doctor
 17 m anthony_of_egypt : Saint Anthony of Egypt, abbot
 20 R fabian : Saint Fabian, pope and martyr
@@ -22,9 +26,10 @@
 31 m bosco : Saint John Bosco, priest

 = 2
-2 f2.5 presentation_of_lord : Presentation of the Lord
+2 f2.5 presentation_of_lord : Presentation of the Lord (Candlemas)
 3 R blase : Saint Blase, bishop and martyr
 3 ansgar : Saint Ansgar, bishop
+4 gilbert_of_sempringham : Saint Gilbert of Sempringham, Religious
 5 m R agatha : Saint Agatha, virgin and martyr
 6 m R paul_miki : Saints Paul Miki and companions, martyrs
 8 jerome_emiliani : Saint Jerome Emiliani, priest
@@ -38,6 +43,8 @@
 23 m R polycarp : Saint Polycarp, bishop and martyr

 = 3
+1 st_david_bishop : Saint David, Bishop
+3 katharine_drexel : Saint Katharine Drexel, Virgin
 4 casimir : Saint Casimir
 7 m R perpetua_felicity : Saints Perpetua and Felicity, martyrs
 8 john_of_god : Saint John of God, religious
@@ -69,6 +76,8 @@
 1 joseph_worker : Saint Joseph the Worker
 2 m athanasius : Saint Athanasius, bishop and doctor
 3 f R philip_james : Saints Philip and James, Apostles
+4 english_martyrs : The English Martyrs
+10 damien_de_veuster : Saint Damien de Veuster, Priest
 12 R nereus_achilleus : Saints Nereus and Achilleus, martyrs
 12 R pancras : Saint Pancras, martyr
 13 bvm_fatima : Our Lady of Fatima
@@ -82,7 +91,7 @@
 25 de_pazzi : Saint Mary Magdalene de Pazzi, virgin
 26 m neri : Saint Philip Neri, priest
 27 augustine_of_canterbury : Saint Augustine (Austin) of Canterbury, bishop
-29 paul_vi : Saint Paul VI, pope
+#29 paul_vi : Saint Paul VI, pope
 31 f visitation : Visitation of the Blessed Virgin Mary

 = 6
@@ -92,36 +101,48 @@
 5 m R boniface : Saint Boniface, bishop and martyr
 6 norbert : Saint Norbert, bishop
 9 ephrem : Saint Ephrem, deacon and doctor
+9 st_columba : Saint Columba, Abbot
 11 m R barnabas : Saint Barnabas the Apostle
 13 m anthony_of_padua : Saint Anthony of Padua, priest and doctor
+16 richard_of_chichester : Saint Richard of Chichester, Bishop
 19 romuald : Saint Romuald, abbot
+20 st_alban : Saint Alban, Protomartyr of England
 21 m aloysius : Saint Aloysius Gonzaga, religious
-22 paulinus : Saint Paulinus of Nola, bishop
+#The ordinariate Calendar has Paulinus of Nola on June 23 not 22
+#22 paulinus : Saint Paulinus of Nola, bishop
 22 R fisher_more : Saints John Fisher, bishop and martyr and Thomas More, martyr
+23 all_holy_nuns : Sts Hilda, Etheldreda, Mildred and All Holy Nuns
 24 s baptist_birth : Birth of Saint John the Baptist
 27 cyril_of_alexandria : Saint Cyril of Alexandria, bishop and doctor
 28 m R irenaeus : Saint Irenaeus, bishop and martyr
 29 s R peter_paul : Saints Peter and Paul, Apostles
 30 R first_martyrs_of_rome : First Martyrs of the Church of Rome

-= 7
+= 7 
+1 junipero_serra : Blessed Junipero Serra, Priest
 3 f R thomas_apostle : Saint Thomas the Apostle
-4 elizabeth_of_portugal : Saint Elizabeth of Portugal
+# The ordinariate calendar has elizabeth_of_portugal on July 5
+#4 elizabeth_of_portugal : Saint Elizabeth of Portugal
+5 elizabeth_of_portugal : Saint Elizabeth of Portugal
 5 anthony_zaccaria : Saint Anthony Zaccaria, priest
 6 R goretti : Saint Maria Goretti, virgin and martyr
+9 lady_of_atonment : Our Lady of Atonement
 9 R chinese_martyrs : Saint Augustine Zhao Rong and companions, martyrs
 11 m benedict : Saint Benedict, abbot
 13 henry : Saint Henry
-14 camillus_de_lellis : Saint Camillus de Lellis, priest
+# Ordinariate Calendar has Camillus de Lellis on july 18
+#14 camillus_de_lellis : Saint Camillus de Lellis, priest
+14 tekakwitha : Blessed Kateri Tekakwitha, Virgin
 15 m bonaventure : Saint Bonaventure, bishop and doctor
 16 bvm_mount_carmel : Our Lady of Mount Carmel
+18 camillus_de_lellis : Saint Camillus de Lellis, priest
 20 R apollinaris : Saint Apollinaris, bishop and martyr
 21 lawrence_of_brindisi : Saint Lawrence of Brindisi, priest and doctor
 22 f mary_magdalene : Saint Mary Magdalene
 23 birgitta : Saint Birgitta, religious
 24 sharbel : Saint Sharbel Makhluf, hermit
 25 f R james : Saint James, apostle
-26 m joachim_anne : Saints Joachim and Anne
+26 m joachim_anne : Saints Joachim and Anne, Parents of the Blessed Virgin Mary
 29 m R martha : Saint Martha
 30 peter_chrysologus : Saint Peter Chrysologus, bishop and doctor
 31 m ignatius_of_loyola : Saint Ignatius of Loyola, priest
@@ -154,10 +175,15 @@
 25 joseph_calasanz : Saint Joseph of Calasanz, priest
 27 m monica : Saint Monica
 28 m augustine : Saint Augustine of Hippo, bishop and doctor of the Church
-29 m R baptist_beheading : The Beheading of Saint John the Baptist, martyr
+# Ordinariate calendar has it as passion, not beheading
+#29 m R baptist_beheading : The Beheading of Saint John the Baptist, martyr
+29 m R baptist_passion : The Passion of Saint John the Baptist, martyr
+30 clitherow_line_ward : Saints Margaret Clitherow, Anne Line, and Margaret Ward, Martyrs
+31 aidan_lindisfame : Saints Aidan, Bishop, and the Saints of Lindisfame

 = 9
 3 m gregory_great : Saint Gregory the Great, pope and doctor
+3 cuthbert : Saint Cuthbert, Bishop
 8 f bvm_birth : Birth of the Blessed Virgin Mary
 9 claver : Saint Peter Claver, priest
 12 bvm_name : Holy Name of the Blessed Virgin Mary
@@ -167,6 +193,8 @@
 16 m R cornelius_cyprian : Saints Cornelius, pope, and Cyprian, bishop, martyrs
 17 bellarmine : Saint Robert Bellarmine, bishop and doctor
 19 R januarius : Saint Januarius, bishop and martyr
+19 theodore : Saint Theodore of Canterbury, Bishop
+19 adrian : Saint Adrian, Abbot
 20 m R korean_martyrs : Saint Andrew Kim Taegon, priest, and Paul Chong Hasang and companions, martyrs
 21 f R matthew : Saint Matthew the Evangelist, Apostle, Evangelist
 23 m padre_pio : Saint Pio of Pietrelcina (Padre Pio), priest
@@ -182,10 +210,15 @@
 2 m guardian_angels : Guardian Angels
 4 m francis_assisi : Saint Francis of Assisi
 6 bruno : Saint Bruno, priest
+6 durocher : Blessed Marie Rose Durocher, Virgin
 7 m bvm_rosary : Our Lady of the Rosary
+9 john_henry_newman_priest : Blessed John Henry Newman, Priest
 9 R denis : Saint Denis and companions, martyrs
 9 leonardi : Saint John Leonardi, priest
-11 john_xxiii : Saint John XXIII, pope
+# Saint John XXII is not listed in the ordinariate calednar
+#11 john_xxiii : Saint John XXIII, pope
+12 wilfrid : Saint Wilfrid
+13 edward_the_confessor : Saint Edward The Confessor
 14 R callistus_i : Saint Callistus I, pope and martyr
 15 m teresa_avila : Saint Teresa of Jesus, virgin and doctor
 16 hedwig : Saint Hedwig, religious
@@ -201,22 +234,27 @@

 = 11
 1 s all_saints : All Saints
-2 s all_souls : All Souls
+2 s all_souls : The Commemoration of All The Faithful Departed (All Souls)
 3 R de_porres : Saint Martin de Porres, religious
 4 m borromeo : Saint Charles Borromeo, bishop
 9 f lateran_basilica : Dedication of the Lateran basilica
 10 m leo_great : Saint Leo the Great, pope and doctor
 11 m R martin : Saint Martin of Tours, bishop
 12 m R josaphat : Saint Josaphat, bishop and martyr
+#On the Ordinariate Calendar?
+13 m xavier : Saint Frances Xavier Cabrini, Virgin
 15 albert : Saint Albert the Great, bishop and doctor
 16 margaret_of_scotland : Saint Margaret of Scotland
 16 gertrude : Saint Gertrude the Great, virgin
 17 m elizabeth_of_hungary : Saint Elizabeth of Hungary, religious
 18 peter_paul_basilicas : Dedication of the basilicas of Saints Peter and Paul, Apostles
+20 edmund : Saint Edmund, Martyr
 21 m bvm_presentation : Presentation of the Blessed Virgin Mary
 22 m R cecilia : Saint Cecilia, virgin and martyr
 23 R clement_i : Saint Clement I, pope and martyr
 23 columban : Saint Columban, religious
+#Ordinariate?
+23 agustin_pro : Blessed Miguel Agustin Pro, priest and martyr
 24 m R vietnamese_martyrs : Saint Andrew Dung Lac and his companions, martyrs
 25 R catherine_of_alexandria : Saint Catherine of Alexandria
 30 f R andrew : Saint Andrew the Apostle
igneus commented 4 years ago

The problem is you have installed calendarium-romanum version 0.6.0 (which gets used - see the backtrace), but the sanctorale data file is in a newer format (with machine-readable feast identifiers added), prepared for the not yet released version 0.7.0.

You can remedy this by explicitly telling Ruby to load calendarium-romanum source you have checked out from git: (cd in the project's root directory and then) ruby -I lib cmds.rb

RussellHaley commented 4 years ago

Ah, yes, I see that now. Ha ha. Thanks!

RussellHaley commented 4 years ago

You sir, are a brilliant developer. I've never written a line of ruby in my life and in a few short hours I was able to largely implement the Ordinariate Calendar. Your code is concise and well organized and wonderfully expressive. I was - not two weeks ago - railing against the pitfalls of Object Oriented Design and you, my good man, have made me eat my hat.

Here is what I have so far: https://github.com/RussellHaley/calendarium-romanum/compare/8209e2055..d7e0f4b79

Outstanding Issues:

Vivat Jesus, Russell

igneus commented 4 years ago

Had you ever worked with some other codebases I've written, you would probably be more cautious calling me a "brilliant developer" and rather say something like "calendarium-romanum is definitely one of the better pieces of software you've ever written," which I would wholeheartedly agree with :wink: It should also be noted that a great deal of the code being "wonderfully expressive" is owed to the Ruby language, which is known both for extraordinary expressiveness and friendliness/accessibility to beginners.

Having read through what you have so far I have one suggestion: implementing (or modifying) a library like this (which consists mostly of pure computation, i.e. is almost free of side-effects like interaction with a database and the like) is a great playground for exercising TDD. calendarium-romanum has (or at least I believe it has) good coverage by RSpec tests which you can build upon. In the commit history you will find numerous examples of a commit implementing a small new feature (or fixing a bug) and consisting of a test (which originally failed) and code which makes the test pass - see e.g. https://github.com/igneus/calendarium-romanum/commit/2f867bc1971c6f94f53fb5f3b4a5dd6be605565a https://github.com/igneus/calendarium-romanum/commit/398e6394573c4dac9b235dc987c632fefb07df28 https://github.com/igneus/calendarium-romanum/commit/6b77665d89cf1ed7de523c6b8a98b1b0a37e4886 https://github.com/igneus/calendarium-romanum/commit/8c52ad8525c5d2c3349e44e8ea01f04a7d1372fb - and many more. Working in steps like this has numerous advantages.

(Tip: in the TDD cycle you will want the tests to run fast. In order to skip a particularly slow subset of the test suite - tests of the calendariumrom command - run tests like rspec --exclude-pattern spec/cli_spec.rb)

RussellHaley commented 4 years ago

Thank you, unit tests are an excellent suggestion.

So, funny story: Someone reminded me that I actually PURCHASED a calendar from the parish earlier in the year! So I have an accurate reference point to test with (and build unit tests) going forward.

I'm trying to add some celebrations: septuagesima, sexagesima, quinquagesima.

I've added them in the temporale/celebrations_factory.rb:

      celebration(:septuagesima, Ranks::SOLEMNITY_GENERAL)
      celebration(:sexagesima, Ranks::SOLEMNITY_GENERAL)
      celebration(:quinquagesima, Ranks::SOLEMNITY_GENERAL)

I've added them to the temporale/dates.rb:


      def self.septuagesima(year)
         self.ash_wednesday(year) - 17
      end

      def self.sexagesima(year)
          self.ash_wednesday(year) - 10
      end

      def self.quinquagesima(year)
             self.ash_wednesday(year) - 3 
      end

      def self.ash_wednesday(year)
        easter_sunday(year) - (6 * WEEK + 4)
      end

and I've added them to the config/locales/en.yml file:


    time_after_epiphany:
      ferial: '%{weekday}, %{week} week after Epiphany'
      septuagesima: 'Septuagesima'
      sexagesima: 'Sexagesima'
      quinquagesima: 'Quinquagesima'
      sunday: '%{week} Sunday after Epiphany'      

When I run the date of Qunquagesima which was on calendar year 2019, 03, 03:

russellh@pureos:~/git/calendarium-romanum$ ruby -I lib cmds.rb 2018 3 3
Calendar Date: 2019-03-03
9th Sunday after Epiphany
#<CalendariumRomanum::Day @date=2019-03-03 @season=#<CalendariumRomanum::Season time_after_epiphany> @season_week=9 celebrations=[#<CalendariumRomanum::Celebration @title="9th Sunday after Epiphany" @rank=#<CalendariumRomanum::Rank @priority=2.6 desc="Unprivileged Sundays"> @colour=#<CalendariumRomanum::Colour rose> symbol=nil date=nil cycle=:temporale>] vespers=nil>

I have test code in ordinariate-temporale.rb (sunday) that shows it "should be working" :

if date == (ash_wednesday - 3)
              puts "Ash wednesay: " + ash_wednesday.to_s
              puts "Quinquagesima"
          end

which outputs:

russellh@pureos:~/git/calendarium-romanum$ ruby -I lib cmds.rb 2018 3 3
Ash wednesay: 2019-03-06
Quinquagesima
Calendar Date: 2019-03-03

Any thoughts as to what I've missed?

igneus commented 4 years ago

For reference: example of adding a single new temporale celebration is https://github.com/igneus/calendarium-romanum/commit/0a5c820239697a4a6ba964a186af32aafcc82ec4

I don't see your complete code, so I'm not 100% sure, but considering what you show in the snippets and what you do not, I probably see the reason why your temporale on the given day doesn't produce the desired celebration: All temporale feasts of the given year are built on Temporale initialization, in Temporale#prepare_solemnities. It iterates through Temporale.celebrations, computes and stores date for each entry. But your pre-Lenten Sundays are not in this list.

RussellHaley commented 4 years ago

Thank you!

RussellHaley commented 4 years ago

Rogation Days are the three days following the Sixth Sunday of Easter. Do you have any suggestions how I would accomplish that in CR?

igneus commented 4 years ago

I've no idea what's their rank in the Ordinariate calendar, but depending on the rank they would be handled either by Temporale#prepare_solemnities or #ferial.

igneus commented 4 years ago

Closing due to inactivity, feel free to reopen if needed.