diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 14:12:31 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 14:12:31 +0200 |
| commit | e01cfff5ddddd9cefdb19536e31257cdae5821f6 (patch) | |
| tree | 744ce0953a95dc490618a5237cafc5353190d882 /scripts/build-oracle-ef.sh | |
| parent | 78825639eab3c84d84a60fbd1f1781bcfa332044 (diff) | |
| download | lectio-e01cfff5ddddd9cefdb19536e31257cdae5821f6.tar.gz lectio-e01cfff5ddddd9cefdb19536e31257cdae5821f6.zip | |
test(calendar): EF oracle vs missalemeum 2025-2026 (0 season mismatches)
temporalEF validated against Divinum Officium data. Season-mapping handles the
Whit octave (Paschaltide), the Christmas vigil (Advent), and the resumed
Epiphany Sundays (within Time after Pentecost).
Diffstat (limited to 'scripts/build-oracle-ef.sh')
| -rwxr-xr-x | scripts/build-oracle-ef.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/build-oracle-ef.sh b/scripts/build-oracle-ef.sh new file mode 100755 index 0000000..71174ae --- /dev/null +++ b/scripts/build-oracle-ef.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# build-oracle-ef.sh — generate the EF (1962) regression oracle by fetching +# missalemeum's per-date proper API (the same source lectio's trad scraper uses, +# built on Divinum Officium data) for 2025-2026. +# +# NOT run by `go test`. Requires network + curl + jq + GNU date. From repo root: +# scripts/build-oracle-ef.sh +# Writes internal/calendar/testdata/oracle-ef.json: +# { "YYYY-MM-DD": {"tempora": "...", "title": "...", "rank": N, "colour": "w"} } +# tempora is "" when missalemeum returns null (then the temporal identity is in +# title); the Go test derives the season from tempora-or-title. +set -euo pipefail + +out=internal/calendar/testdata/oracle-ef.json +mkdir -p "$(dirname "$out")" +work=$(mktemp -d) + +for y in 2025 2026; do + d="$y-01-01" + while [ "$(date -d "$d" +%Y)" = "$y" ]; do + echo "$d" + d=$(date -d "$d +1 day" +%F) + done +done > "$work/dates" + +fetch() { + local d="$1" + local j + j=$(curl -sf "https://www.missalemeum.com/en/api/v5/proper/$d" || true) + printf '%s' "$j" | jq -c --arg d "$d" \ + '{($d): (.[0].info | {tempora:(.tempora // ""), title:.title, rank:.rank, colour:(.colors|join(""))})}' \ + 2>/dev/null || true +} +export -f fetch + +xargs -P 12 -I{} bash -c 'fetch "$@"' _ {} < "$work/dates" | jq -s 'add' > "$out" +echo "wrote $out ($(jq 'length' "$out") days)" >&2 +rm -rf "$work" |
