Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liturgy of the Hours and Weeks of the Psalter #44

Open
padrecedano opened this issue Jun 24, 2021 · 8 comments
Open

Liturgy of the Hours and Weeks of the Psalter #44

padrecedano opened this issue Jun 24, 2021 · 8 comments

Comments

@padrecedano
Copy link
Contributor

Thanks for this wonderful job. I am moving my application Liturgia+ to offline mode and would like to include a precalculated annual calendar taken from your API. But since the application incorporates the Liturgy of the Hours, I want to know if you plan to include the week of the psalter for each day.

One of the most delicate points for an application to work with a perpetual calendar is the part of the liturgy of the hours, especially the rules to decide the psalms, antiphons, office readings in two cycles (biennial) etc. Do you have something projected on this?

@JohnRDOrazio
Copy link
Member

Padre Cedano I'm glad you are taking this project into consideration! I'm glad to be of service.
I would say that the only drawback of a precaculated annual calendar (if you mean having a JSON file for a given year), is that you will need a JSON file for each following year also... I suppose it's not so much of a problem if you decide to include like the next 10 years, or the next 20 years...
In any case, online or offline, I can certainly include the week of the psalter for sure, I will look into this

@padrecedano
Copy link
Contributor Author

Thanks for answering.

I still don't know how to incorporate the perpetual calendar into the application. I can think of two possibilities:

  • On the one hand, I was reviewing the JSON that is generated from the API and although it could help me, it has more information than I need (if I decide on it I could simplify it, keeping only the eventidx for each date for example and obtaining everything else by that id in my database). In my case, the main problem with JSON is that it is not organized to easily search the liturgy of a given day. For a more efficient search I would create a JSONArray with the days in order, I would determine which day of the year (1 to 365) is the given date and I would search the JSON for the object by that index (1 to 365) ... But this does not it would solve the more complex need that would be to determine the liturgy to apply for a given day.

  • On the other hand, I was reviewing the code implementing in LitCalEngine.php and an interesting option would be to implement that code directly in the application (Java), so that from the same application it can generate a perpetual calendar year after year, saving it internally in a database or file and then searching in that table / file for the corresponding liturgy. Keeping N pre-saved calendars and giving the possibility of calculating the celebration of a given date even when said date does not belong to any of the N pre-saved years.

The interesting thing about the second possibility is that it would allow me to decide all complex situations dynamically. To give an example: in the Liturgy of the hours, depending on the type of celebration, the psalms are taken from Sunday I, or from Common, or from the current week of the Psalter, and according to the time, festivity, etc the norms change ... for example, in some celebrations the Complementary Psalmody for the Middle Hour is used.

Complex situations also occur with regard to the Readings of Mass, to the liturgical forms to be used (Preface, etc.). And the same with those celebrations that have first vespers, vigil mass, etc.

My idea is that the application is capable of determining all content is needed for one given date and putting together an SQL query that obtains all the elements of the liturgy of that day based on the rules that apply for that day. All the content of the liturgy is organized in tables: Psalms, Antiphons, Hymns, Mass Readings, etc. and the idea is to have a kind of Query Builder that will obtain the index of each element applying the liturgical norms.

It's not an easy task, but the code in this project is very inspiring and paves the way for what I want to achieve quite a bit.

@JohnRDOrazio
Copy link
Member

JohnRDOrazio commented Jul 25, 2021

The only limit to using the application logic from LitCalEngine.php is that it relies on data from MySQL tables both for the Sanctorale and for translations into different languages. So in order to implement that logic directly in your application (translating to Java I'm guessing) you would also need to create the relative database tables, even in SQLite would probably work fine.

Another thing to consider is that the application logic in LitCalEngine.php will continue to be updated in the future, every time a new feast day or memorial is instituted or when a notification from the Congregation of Divine Worship clarifies how a coincidence should be handled for a given year.

As regards getting the celebration for a single day or for the current day, it should be easy enough by searching and filtering by date. Take for example LiturgyOfTheDay.php that serves an Amazon Alexa news brief:

https://github.com/JohnRDOrazio/LiturgicalCalendar/blob/2d8c5f28ca00766c146eb6bc2e1c31d348b3fb81/LiturgyOfTheDay.php#L562-L564

https://github.com/JohnRDOrazio/LiturgicalCalendar/blob/2d8c5f28ca00766c146eb6bc2e1c31d348b3fb81/LiturgyOfTheDay.php#L608

https://github.com/JohnRDOrazio/LiturgicalCalendar/blob/2d8c5f28ca00766c146eb6bc2e1c31d348b3fb81/LiturgyOfTheDay.php#L615-L616

https://github.com/JohnRDOrazio/LiturgicalCalendar/blob/2d8c5f28ca00766c146eb6bc2e1c31d348b3fb81/LiturgyOfTheDay.php#L620-L625

Of course creating a Date object in Java will be slightly different than creating a Date object in PHP.

In any case, I believe that the best solution for you would be to gather the JSON data from the API endpoint and cache it locally. For example, the App can work in offline mode but requires internet access the first time data is requested for a given year, that way the app can cache the calendar locally. If the calendar for a given year is not cached locally, you can give a message explaining that internet access will be required just once to cache the data for that year.
I suppose you will also have a way to send notifications to users? It would be useful for example, if an error were to be found in any of the data (perhaps a misspelling or something), and a correction is made in LitCalEngine.php, and the resulting JSON data receives an update, it would be useful to be able to let users know that they need to refresh the cache with the calendar data. So perhaps you could have a button in a settings menu somewhere that would allow to flush the cache (which would require internet access to download the new JSON data).

As regards having more data than you need in the JSON calendar data, I don't think that's a big problem: just use what you need, and don't use what you don't need. It could be a problem if there wasn't enough data. As for example, it is currently missing the data for the Liturgy of the Hours. I will look into that soon I hope...

@JohnRDOrazio
Copy link
Member

I also wonder, are you only wanting to use the Calendar data for the Universal calendar? or will you take into account a specific national calendar?
I have made LitCalEngine.php flexible enough that it can pick up diocesan calendar data that has been defined separately, and I created a user interface where diocesan data can be defined, see https://johnromanodorazio.com/LiturgicalCalendar/extending.php?choice=diocesan .

For now, the data for national calendars is hard-coded into LitCalEngine.php, because it tends to be more complex (for example, in the case of the United States of America, a number of festivities are moved around to make way to national festivities, this would be tricky to define through a user interface, or at least it will take a lot of work to try to create in a coherent fashion).

If you have data for a national calendar that you would like to add to this project, let me know and we can work on it together. For example, if you have a Spanish Missal on hand, we can compare the Sanctorale from the Missal with that of the Universal calendar and implement any differences into LitCalEngine.php for Spain for example.

@JohnRDOrazio
Copy link
Member

I am starting to implement a psalterWeek property for each liturgical event generated in the calendar. I must confess that in the past few years I have become lazy by using the liturgy apps, rather than the paper breviary, so I haven't been as attentive to looking up the correct celebration for each day, for each time of the year, seeing that the app does it for you. So I am a little rusty on the rules for the week of the psalter, and when it is used / required.

So far I have, for the weeks of ordinary time, and the weeks of Advent, Lent and Easter: Psalter Week = Week of (Ordinary Time / Advent / Lent / Easter) modulus 4 (and 0 == 4).

I don't have a paper breviary on hand right now seeing I am traveling, would you be able to tell me whether the Week of the Psalter is needed for any other liturgical days / celebrations?

@JohnRDOrazio
Copy link
Member

I have added an indication of the Psalter Week to the fullcalendar example, let me know if it is missing in places where it is needed: https://johnromanodorazio.com/LiturgicalCalendar-staging/examples/fullcalendar/examples/month-view.html

@matthewa26
Copy link

I'm not seeing the Psalter on the fullcalendar view. Was it removed, or am I just looking in the wrong place on the site linked in the previous comment?

@JohnRDOrazio
Copy link
Member

Oh my you're right. I'll have to look into that. I'm having a harder time working on these projects ever since, in my office, they have blocked access to any outside servers via SSH. I'm currently making another request to get my server unblocked, here's to hoping the request will be successful...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants