This tool processes CSV files containing tables of Bible references and converts them into a structured JSON format, matching each set of readings to the correct liturgical day using the romcal library for the liturgical calendar.
The CSV files processed by this tool contain Bible references for various liturgical days, organized in a table format with columns for:
- Day/Sunday description (e.g., "1st Sunday of Advent - A")
- First Reading
- Responsorial Psalm
- Second Reading
- Gospel Acclamation (which may be labeled as "Alleluia" or "Verse before the Gospel")
- Gospel
- Extracts readings from CSV files in the
inputdirectory - Processes multiple CSV formats (Advent, Christmas, Lent) with different header structures
- Handles special cases like Palm Sunday with cycle-specific readings
- Processes Bible references into both OSIS and standard human-readable formats
- Recognizes and properly formats special annotations like Gospel titles after dashes
- Identifies alternative readings, optional readings, and shorter forms
- Matches readings to official liturgical days using romcal's calendar definitions
- Generates a structured JSON file (
output/lectionary.json) following the schema inschemas/lectionary.schema.json - Includes Sunday cycles (A/B/C) with proper seasonal organization
- Clone this repository
- Install dependencies:
npm install
- Place your CSV files containing lectionary tables in the
inputdirectory - Run the script:
npm start
- The output JSON file will be generated as
output/lectionary.json
The tool supports multiple CSV formats with different header structures:
Sunday or Feast - Year,First Reading,Responsorial Psalm,Second Reading,Alleluia,Gospel
1st Sunday of Advent - A,Isa 2:1-5,"Ps 122:1-2, 3-4a, 4b-5, 6-7, 8-9",Rom 13:11-14,Ps 85:8,Matt 24:37-44Sunday or Feast,First Reading,Responsorial Psalm,Second Reading,"Verse before the Gospel",Gospel
1st Sunday of Lent – A,Gen 2:7-9; 3:1-7,"Ps 51:3-4, 5-6, 12-13, 14+17","Rom 5:12-19 or 5:12, 17-19",Matt 4:4b,Matt 4:1-11 – TemptationThe tool intelligently handles several special cases:
-
Gospel titles - Gospel readings that include a title after a dash (e.g., "Matt 4:1-11 – Temptation")
-
Multiple reading options - References separated by "or" (e.g., "Rom 5:12-19 or 5:12, 17-19")
-
Palm Sunday special format - With different readings for cycles A, B, and C:
A: Matt 21:1-11 B: Mark 11:1-10 or John 12:12-16 C: Luke 19:28-40 -
Optional readings - Marked with "opt:" prefix
-
Reference composition - Converting "+" into "," for Bible reference parsing (e.g., "John 11:25a+26" becomes "John 11:25a,26")
The generated JSON file follows the schema in schemas/lectionary.schema.json. Example structure:
{
"lectionaryTitle": "USCCB Lectionary (based on 1998)",
"schemaVersion": "1.3",
"cycles": {
"sundays": {
"A": [
{
"identifier": "advent_1_sunday_a",
"name": "First Sunday of Advent",
"romcalKey": "advent_1_sunday",
"season": "ADVENT",
"week": 1,
"dayOfWeek": "Sunday",
"date": null,
"rank": "Sunday",
"massType": null,
"readings": {
"first_reading": [
{
"referenceOsis": "Isa.2.1-Isa.2.5",
"referenceStandard": "Isa 2:1-5",
"note": null
}
],
"responsorial_psalm": [
{
"referenceOsis": "Ps.122.1-Ps.122.9",
"referenceStandard": "Ps 122:1-2, 3-4a, 4b-5, 6-7, 8-9",
"note": null
}
],
"second_reading": [
{
"referenceOsis": "Rom.13.11-Rom.13.14",
"referenceStandard": "Rom 13:11-14",
"note": null
}
],
"gospel_acclamation": [
{
"referenceOsis": "Ps.85.8",
"referenceStandard": "Ps 85:8",
"note": null
}
],
"gospel": [
{
"referenceOsis": "Matt.24.37-Matt.24.44",
"referenceStandard": "Matt 24:37-44",
"note": null
}
]
}
}
],
"B": [ { /* Year B Sundays */ } ],
"C": [ { /* Year C Sundays */ } ]
},
"weekdays": {
"I": [],
"II": []
}
},
"properOfSaints": [],
"commons": [],
"ritualMasses": [],
"votiveMasses": [],
"massesForTheDead": []
}Each liturgicalDay object includes:
identifier: Unique identifier for the day (e.g., "advent_1_sunday_a")name: Liturgical name (e.g., "First Sunday of Advent")romcalKey: Identifier key from romcal library (e.g., "advent_1_sunday")season: Liturgical season (e.g., "ADVENT", "CHRISTMAS", "LENT")week: Week number within the seasondayOfWeek: Always "Sunday" for current implementationdate: Fixed date in MM-DD format (e.g., "01-01" for Mary, Mother of God)rank: Liturgical rank (e.g., "Sunday", "Feast", "Solemnity")massType: For special cases like Christmas (e.g., "Vigil Mass", "Mass during the Night")readings: Set of readings (first_reading, responsorial_psalm, second_reading, gospel_acclamation, gospel)
Each reading contains options with both OSIS and standard reference formats:
{
"referenceOsis": "Matt.4.1-Matt.4.11",
"referenceStandard": "Matt 4:1-11",
"note": "Temptation"
}The note field may contain:
- Gospel titles (e.g., "Temptation", "Samaritan Woman")
- Reading options (e.g., "alternative/option", "optional", "short form")
- Cross-reference information (e.g., "cf.")
- Citations (e.g., "cited in Lk 4:18")
- Multiple notes combined with semicolons
- romcal - For generating the liturgical calendar and day metadata
- Bible Passage Reference Parser - For parsing Bible references
- csv-parse - For CSV parsing
This project is licensed under the MIT License. See the LICENSE file for details.