chore: stash in-progress test edit
Captures the modified state of test_api_parse_persists.py so the in-progress test work is preserved on the claims-unique-fix branch as the sp-prefixed worktrees are cleaned up. The .venv and .gitignore_local noise in the working tree are intentionally left untracked.
This commit is contained in:
@@ -357,3 +357,60 @@ def test_prodfile_cross_pipeline_reconciles(client: TestClient):
|
|||||||
assert claim_rows >= len(unique_837_pcns), (
|
assert claim_rows >= len(unique_837_pcns), (
|
||||||
f"claim_rows {claim_rows} < unique_837_pcns {len(unique_837_pcns)}"
|
f"claim_rows {claim_rows} < unique_837_pcns {len(unique_837_pcns)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_409_response_includes_existing_batch_id_for_837(client: TestClient) -> None:
|
||||||
|
"""When a CLM01 already exists in a prior batch, the 409 body has existing_batch_id."""
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
from cyclone import db as _db
|
||||||
|
from cyclone.db import Batch, Claim
|
||||||
|
|
||||||
|
# Seed a prior batch with claim CLM-X.
|
||||||
|
with _db.SessionLocal()() as s:
|
||||||
|
s.add(Batch(
|
||||||
|
id="PRIOR", kind="837p", input_filename="prior.txt",
|
||||||
|
parsed_at=datetime(2026, 1, 1, tzinfo=timezone.utc),
|
||||||
|
raw_result_json={},
|
||||||
|
))
|
||||||
|
s.add(Claim(id="CLM-X", batch_id="PRIOR", patient_control_number="M"))
|
||||||
|
s.commit()
|
||||||
|
|
||||||
|
# Build a file with two CLM* segments both using CLM-X (forces PK collision).
|
||||||
|
text = (
|
||||||
|
"ISA*00* *00* *ZZ*SUBMITTERID *ZZ*RECEIVERID "
|
||||||
|
"*240101*1200*^*00501*000000001*0*P*:~\n"
|
||||||
|
"GS*HC*SUBMITTERID*RECEIVERID*20240101*1200*1*X*005010X222A1~\n"
|
||||||
|
"ST*837*0001*005010X222A1~\n"
|
||||||
|
"BHT*0019*00*1*20240101*1200*CH~\n"
|
||||||
|
"NM1*41*2*SUBMITTER*****46*SUBMITTERID~\n"
|
||||||
|
"PER*IC*CONTACT*TE*5555555555~\n"
|
||||||
|
"NM1*40*2*RECEIVER*****46*RECEIVERID~\n"
|
||||||
|
"HL*1**20*1~\n"
|
||||||
|
"NM1*85*2*BILLING*****XX*1881068062~\n"
|
||||||
|
"N3*123 MAIN*\nN4*DENVER*CO*80202~\n"
|
||||||
|
"REF*EI*123456789~\n"
|
||||||
|
"HL*2*1*22*0~\n"
|
||||||
|
"SBR*P*18*******CI~\n"
|
||||||
|
"NM1*IL*1*DOE*JOHN****MI*M~\n"
|
||||||
|
"N3*456 ELM*\nN4*DENVER*CO*80202~\n"
|
||||||
|
"DMG*D8*19700101*M~\n"
|
||||||
|
"NM1*PR*2*MEDICAID*****PI*MCD~\n"
|
||||||
|
"CLM*CLM-X*100***11:B:1*Y*A*Y*Y~\n"
|
||||||
|
"LX*1~\nSV1*HC:99213*100*UN*1***1~\n"
|
||||||
|
"DTP*472*D8*20240101~\n"
|
||||||
|
"CLM*CLM-X*100***11:B:1*Y*A*Y*Y~\n"
|
||||||
|
"LX*2~\nSV1*HC:99213*100*UN*1***1~\n"
|
||||||
|
"DTP*472*D8*20240101~\n"
|
||||||
|
"SE*30*0001~\n"
|
||||||
|
"GE*1*1~\n"
|
||||||
|
"IEA*1*000000001~\n"
|
||||||
|
)
|
||||||
|
resp = client.post(
|
||||||
|
"/api/parse-837",
|
||||||
|
files={"file": ("dup.txt", text, "text/plain")},
|
||||||
|
headers={"Accept": "application/json"},
|
||||||
|
)
|
||||||
|
assert resp.status_code == 409, resp.text
|
||||||
|
body = resp.json()
|
||||||
|
assert body.get("existing_batch_id") == "PRIOR"
|
||||||
|
|||||||
Reference in New Issue
Block a user