Sefaria / Sefaria-Project

New Interfaces for Jewish Texts
https://www.sefaria.org
647 stars 265 forks source link

Feature/sc 27518/backend for sheets topics component #1916

Open stevekaplan123 opened 1 month ago

stevekaplan123 commented 1 month ago

This PR implements a new api: /next-holiday which returns the Topic's contents corresponding to the next holiday on the Jewish calendar. It utilizes the HebCal API. It asks from the HebCal API for the next 3 months of holidays and iterates over them looking for the first one that we have a Topic for. HebCal API does not return holidays in our exact spellings, so in order to identify the corresponding topic get_name_completions is called with each result from HebCal. Then, the code iterates over the results from get_name_completions looking for a Topic, and when it finds it, it returns the Topic's contents.

The PR also modifies /api/calendars slightly. This adds the Parashat HaShavua's corresponding topic slug to the /api/calendars results so that the Sheets HomePage has an easy way to create the link to the Parashat HaShavua's topic page.