diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 17de83d..dab11f7 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -187,6 +187,17 @@ backend/src/cyclone/ ├── payers.py — Payer ORM row accessor (SP9) ├── providers.py — Payer / Clearhouse / Provider ORM row DTOs (SP9) ├── pubsub.py — NDJSON live-tail EventBus +├── rebill/ — (SP41 — in-window rebill pipeline) +│ ├── parse_835_svc.py — SVC-level 835 reparse w/ member_id +│ ├── reconcile.py — visit-to-835 join (member, procedure, DOS) +│ ├── carc_filter.py — CARC-aware filter +│ ├── timely_filing.py — 120-day DOS age gate +│ ├── pipeline_a.py — denied/partial → frequency-7 +│ ├── pipeline_b.py — NOT_IN_835 → fresh 837Ps by (member, week) +│ ├── summary.py — summary CSV generator +│ ├── run.py — orchestrator (run_rebill) +│ ├── pull_999_acks.py — 999-ack dump + classify +│ └── __init__.py — package surface ├── reconcile.py — 835 → 837 auto-reconciliation engine ├── scheduler.py — SP16 MFT polling scheduler ├── scoring.py — 4-field lane scoring (40/25/20/15, hard-coded — backlog item) diff --git a/docs/REQUIREMENTS.md b/docs/REQUIREMENTS.md index 216c15e..85a900f 100644 --- a/docs/REQUIREMENTS.md +++ b/docs/REQUIREMENTS.md @@ -145,6 +145,19 @@ Each requirement is `FR-NN`, traceable to one or more sub-projects. Verification | FR-37 | (Sibling project, not in this repo) Drive the full 7-phase round-trip — preflight → browser upload → parse verify → SFTP submit → TA1 wait → 999 wait → scan + report — with crash-safe resume, structured JSON logging, idempotency dedup, per-run folder. | SP22 (`cyclone-pipeline/`) | | FR-38 | Provide a `DrillStackProvider` + `DrillDrawerHeader` shell so every drillable cell across the app opens a consistent drawer or peek modal. | SP21 | +### 3.1 In-window rebill pipeline FRs (SP41) + +The `FR-RB-*` IDs are SP41-specific functional requirements for the in-window rebill pipeline. They sit alongside `FR-1`..`FR-38` in §3 but use the `RB` prefix to indicate they cover the rebill sub-domain. Each row links to its implementation module under `cyclone.rebill.*` (or, for FR-RB-5, the store-side `cyclone.store.submission_dedup` helper that the pipeline integrates with). + +| ID | Requirement | SP | +|---|---|---| +| FR-RB-1 | Visit-to-835 reconciliation on `(member_id, procedure, DOS)`. Match key plus a best-of-N across duplicate SVC rows (per-SVC charge tolerance within 5% to absorb legitimate AxisCare-vs-835 differences). Implemented in `cyclone.rebill.reconcile.reconcile_visits_to_835`. | SP41 | +| FR-RB-2 | CARC-aware filter. Excluded reasons (CO-45 / CO-26 / CO-129) trip the `EXCLUDED_CARC` outcome; review reasons (PI-16, OA-18, etc.) produce `REBILLED_A` with `needs_review=true`. Implemented in `cyclone.rebill.carc_filter.decide_carc`. | SP41 | +| FR-RB-3 | 120-day timely-filing gate with per-batch override. Default window = 120 days from DOS as of run date; `--override-filing/--no-override-filing` CLI flag (and matching API flag) relaxes the gate for past-window visits. Implemented in `cyclone.rebill.timely_filing.timely_filing_decision`. | SP41 | +| FR-RB-4 | Pipeline A (frequency-7 replacement) for denied/partial visits + Pipeline B (member-week batched fresh 837Ps) for `NOT_IN_835` visits. Pipeline A emits a single 837P per visit with `CLM05-3 = '7'`; Pipeline B batches by `(member_id, ISO-week)`. Implemented in `cyclone.rebill.pipeline_a` and `cyclone.rebill.pipeline_b`. | SP41 | +| FR-RB-5 | Claim-id dedup at SFTP pre-flight (30-day window, configurable). Implemented in `cyclone.store.submission_dedup.check_duplicate`; integrated into `cyclone.submission.submit_file` which raises `DuplicateClaimError` before any upload bytes are sent. | SP41 | +| FR-RB-6 | Summary CSV with `REBILLED_A / REBILLED_B / EXCLUDED_CARC / EXCLUDED_TIMELY_FILING / EXCLUDED_PAYER / EXCLUDED_NO_EVV` rows plus a per-disposition tally. Implemented in `cyclone.rebill.summary.write_summary_csv` and surfaced by `cyclone.rebill.run.run_rebill`. | SP41 | + --- ## 4. Non-functional requirements