feat(sp32): _content_keys_match prefers typed NPI columns over raw_json fallback
This commit is contained in:
@@ -846,3 +846,50 @@ def test_remittance_835_row_includes_service_provider_npi():
|
||||
assert parsed.claims[0].service_provider_npi == "2222222222"
|
||||
row = _remittance_835_row(parsed.claims[0], batch_id="test-batch")
|
||||
assert row.rendering_provider_npi == "2222222222"
|
||||
|
||||
|
||||
# --- SP32 Task 5: typed-column NPI preference in _content_keys_match -------
|
||||
|
||||
|
||||
def test_content_keys_match_typed_npi_columns_match(db_session, make_claim, make_remit):
|
||||
"""SP32: typed-column NPI contributes to the matched set when both sides have it."""
|
||||
from cyclone.reconcile import _content_keys_match
|
||||
from datetime import date
|
||||
claim = make_claim(
|
||||
patient_control_number="PCN1",
|
||||
total_charge=Decimal("85.40"),
|
||||
rendering_provider_npi="2222222222",
|
||||
service_date_from=date(2025, 1, 1),
|
||||
)
|
||||
remit = make_remit(
|
||||
payer_claim_control_number="PCN1",
|
||||
total_charge_amount=Decimal("85.40"),
|
||||
rendering_provider_npi="2222222222",
|
||||
service_date=date(2025, 1, 1),
|
||||
)
|
||||
matched = _content_keys_match(remit, claim)
|
||||
assert "npi" in matched
|
||||
assert "pcn" in matched
|
||||
assert "charge" in matched
|
||||
|
||||
|
||||
def test_content_keys_match_npi_mismatch_does_not_match(db_session, make_claim, make_remit):
|
||||
"""SP32: NPI arm does not fire when NPIs differ."""
|
||||
from cyclone.reconcile import _content_keys_match
|
||||
from datetime import date
|
||||
claim = make_claim(
|
||||
patient_control_number="PCN2",
|
||||
total_charge=Decimal("10.00"),
|
||||
rendering_provider_npi="2222222222",
|
||||
service_date_from=date(2025, 1, 1),
|
||||
)
|
||||
remit = make_remit(
|
||||
payer_claim_control_number="PCN2",
|
||||
total_charge_amount=Decimal("10.00"),
|
||||
rendering_provider_npi="9999999999", # different NPI
|
||||
service_date=date(2025, 1, 1),
|
||||
)
|
||||
matched = _content_keys_match(remit, claim)
|
||||
assert "npi" not in matched
|
||||
assert "pcn" in matched
|
||||
assert "charge" in matched
|
||||
|
||||
Reference in New Issue
Block a user