healthcare: daily batched paper-filing fulfillment

Standard (no-login) CMS filings are mailed in one Priority Mail envelope per
destination agency, batched each postal working-day morning to save postage.

- migration 089: paper_filing_batches table + esign_records.paper_batch_id /
  filing_destination_key (idempotent: a filing is batched at most once).
- batch_cover_sheet.py: per-agency cover sheet (sender/dest/date/manifest) +
  merged print-job PDF (cover + all enclosed signed filings).
- daily_paper_batch.py worker: gather signed+unbatched cms855/cms10114 filings,
  group by destination (MAC by state via mac_routing; Fargo for CMS-10114),
  build cover+merged PDF per agency, persist batch, mark filings batched.
  Self-gates on postal working days (skips weekends + federal/USPS holidays).
  Phase 1 = human prints+mails; phase 2 = wire print-mail API.
- worker-crons: pw-paper-batch systemd timer (Mon-Fri 13:30 UTC, self-gated).
- test_paper_batch.py: 15/15 pass (working-day gating, routing, cover+merge).
This commit is contained in:
justin 2026-06-07 00:30:01 -05:00
parent 258d23bdc6
commit 138fec17e9
5 changed files with 542 additions and 0 deletions

View file

@ -219,3 +219,16 @@ worker_crons:
module: scripts.workers.intake_reminder
on_calendar: "*-*-* 16:00:00 UTC"
persistent: true
# Daily paper-filing batch (Standard no-login CMS filing path) — weekday
# mornings 13:30 UTC (08:30 CT). Groups all signed, not-yet-mailed CMS filings
# by destination agency (provider's MAC; NPI Enumerator in Fargo for NPPES)
# and builds one cover sheet + merged print job per agency, for a human to
# print and mail in a single Priority Mail envelope. The worker self-gates on
# postal working days (skips weekends AND federal/USPS holidays via
# business_days.py), so the Mon-Fri OnCalendar is just a coarse pre-filter.
- name: pw-paper-batch
description: Build daily per-agency CMS paper-filing batch (cover sheet + merged print job)
module: scripts.workers.daily_paper_batch
on_calendar: "Mon..Fri *-*-* 13:30:00 UTC"
persistent: true