feat(comments): scheduled post-close re-farm script for CMS-2026-2377 (refs #615)
This commit is contained in:
43
dev/scripts/refarm_cms_2026_2377.sh
Executable file
43
dev/scripts/refarm_cms_2026_2377.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Post-comment-close re-farm for docket CMS-2026-2377 (CY2027 PFS NPRM,
|
||||
# CMS-1848-P). Scheduled via host crontab for 2026-09-15 (comment period
|
||||
# closes 2026-09-14 per 91 FR 43842 DATES block). Tracker: issue #615.
|
||||
#
|
||||
# Every step is resumable/incremental — safe to re-run on partial failure.
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
set -a; source .env; set +a
|
||||
|
||||
LOG=.state/comments/refarm-CMS-2026-2377.log
|
||||
exec >>"$LOG" 2>&1
|
||||
echo "=== re-farm run $(date -Is) ==="
|
||||
|
||||
uv run stack bib fetch-pfs-comments || echo "WARN: fetch-pfs-comments rc=$?"
|
||||
uv run stack bib backfill-comments || echo "WARN: backfill rc=$?"
|
||||
uv run stack comments extract --docket CMS-2026-2377 || echo "WARN: extract rc=$?"
|
||||
uv run stack comments extract-ocr --docket CMS-2026-2377 || echo "WARN: ocr rc=$?"
|
||||
uv run stack llm index --collection comments --docket CMS-2026-2377 \
|
||||
|| echo "WARN: index rc=$?"
|
||||
|
||||
COUNTS=$(uv run python - <<'EOF'
|
||||
from conf import connect
|
||||
s = connect.bib()
|
||||
con = s._con()
|
||||
total, enriched = con.execute(
|
||||
"SELECT count(*), sum(CASE WHEN coalesce(abstract,'')<>'' THEN 1 ELSE 0 END) "
|
||||
"FROM items WHERE url LIKE 'https://www.regulations.gov/comment/CMS-2026-2377-%'"
|
||||
).fetchone()
|
||||
print(f"comments={total} enriched={enriched}")
|
||||
s.close()
|
||||
EOF
|
||||
)
|
||||
echo "$COUNTS"
|
||||
|
||||
curl -sf -X POST \
|
||||
"https://git.fhirworx.io/api/v1/repos/homelab/stack/issues/615/comments" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent: curl/8.5.0" \
|
||||
-d "{\"body\": \"Automated post-close re-farm ran $(date -I): $COUNTS. Log: .state/comments/refarm-CMS-2026-2377.log. Review counts, spot-check indexing, then close this issue and milestone P37.\"}" \
|
||||
|| echo "WARN: gitea comment failed"
|
||||
echo "=== done $(date -Is) ==="
|
||||
Reference in New Issue
Block a user