feat(sp41): claim-id dedup at SFTP pre-flight (30-day window, configurable)

This commit is contained in:
Nora
2026-07-07 22:02:46 -06:00
parent 13dd240328
commit 0e130579b4
6 changed files with 138 additions and 10 deletions
+4 -3
View File
@@ -128,14 +128,15 @@ def test_migration_latest_idempotent_on_fresh_db(tmp_path: Path) -> None:
service_provider_npi on claims and remittances.
SP37 bumped it to 20 with batch transaction_set_control_number.
SP39 bumped it to 21 with the resubmissions audit table.
SP41 bumped it to 22 with submission_dedup.
"""
engine = _fresh_engine(tmp_path)
db_migrate.run(engine)
v_after_first = _user_version(engine)
assert v_after_first == 21, f"expected head=21, got {v_after_first}"
assert v_after_first == 22, f"expected head=22, got {v_after_first}"
db_migrate.run(engine)
assert _user_version(engine) == 21, "second run should not bump version"
assert _user_version(engine) == 22, "second run should not bump version"
def test_drop_claims_unique_constraint_migration(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
@@ -161,7 +162,7 @@ def test_drop_claims_unique_constraint_migration(tmp_path: Path, monkeypatch: py
engine = _fresh_engine(tmp_path)
db_migrate.run(engine)
assert _user_version(engine) == 21, f"expected head=21, got {_user_version(engine)}"
assert _user_version(engine) == 22, f"expected head=22, got {_user_version(engine)}"
# Two claims in one batch with the same patient_control_number
# must be insertable. If 0015's table recreation re-introduced a