9bca4b608a
Backend:
- New POST /api/batches/{id}/export-837: regenerate X12 837 files
for a list of claim_ids into a ZIP using HCPF file naming standards,
with a unique interchange/group control number per export. Wire
the clearhouse Loop 1000A (NM1*41 + PER) and per-payer receiver
(NM1*40) blocks so the serializer no longer falls back to
CYCLONE / RECEIVER placeholders.
- /api/parse-837 and /api/parse-835 now surface the server-side
batch_id in both JSON and NDJSON response shapes so the frontend
can hit batch-scoped endpoints without an extra listBatches
round-trip.
- Filename helpers and the 837 serializer updated to match the new
HCPF envelope; tests cover batch export, parse batch_id, and the
serializer's control-number uniqueness guarantee.
Frontend:
- New shared components: ClaimCard, ClaimCard837, DominantKpiCard,
EditorialNote, ExportBar, TickerTape, and a charts/ set
(BarChart, HBarChart, SegmentedBar, AgingBars).
- New useBatchExport hook driving ExportBar's download flow against
the new endpoint.
- ClaimDrawer, Lane, and Layout migrated from raw CSS-variable
colors to Tailwind theme tokens (bg-card, text-foreground,
border/60, etc.) for consistency with the rest of the instrument
chrome; the active tab indicator gains a subtle accent glow.
- Upload, Inbox, Batches, BatchDiff, Reconciliation, and Acks pages
reworked to compose the new shared components and consume the new
batch-scoped API surface (notably ExportBar wired into Batches).
Tooling / Docs:
- Add audit-uiux.mjs and a docs/goodclaim.x12 sample fixture.
- Update ClaimDrawer testids and add coverage for the new
components and the useBatchExport hook.
Rolls up into the v0.2.0 release tag.
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
"""Tests that /api/parse-837 includes the persisted batch_id in its
|
|
JSON response, so the frontend can correlate its in-memory batch with
|
|
the server's row (and later call /api/batches/{id}/export-837).
|
|
|
|
The 409 (duplicate) path has always included batch_id; the 200 path
|
|
did not. This brings the 200 path in line so the frontend doesn't have
|
|
to query listBatches after every parse just to learn the server's id.
|
|
"""
|
|
import io
|
|
from pathlib import Path
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from cyclone.api import app
|
|
|
|
|
|
def test_parse_837_happy_path_includes_batch_id_in_response():
|
|
with TestClient(app) as client:
|
|
fixture = Path("tests/fixtures/co_medicaid_837p.txt").read_text()
|
|
r = client.post(
|
|
"/api/parse-837",
|
|
files={"file": ("claim.txt", io.BytesIO(fixture.encode()), "text/plain")},
|
|
headers={"Accept": "application/json"},
|
|
)
|
|
assert r.status_code == 200, r.text
|
|
body = r.json()
|
|
assert "batch_id" in body, "parse-837 response must include batch_id so the frontend can call /api/batches/{id}/export-837"
|
|
# Sanity: the batch_id should be a non-empty string (UUID-shaped).
|
|
assert isinstance(body["batch_id"], str) and body["batch_id"]
|