docs: surface SP14 (Payer-Rejected UI + acknowledge) + SP15 (key rotation) #3

Closed
tyler wants to merge 14 commits from docs/sp14-15-readme-sync into main
3 changed files with 9 additions and 17 deletions
Showing only changes of commit 6aa440d3e4 - Show all commits
+7 -15
View File
@@ -23,6 +23,8 @@ from fastapi import APIRouter, HTTPException
from cyclone import db
from cyclone.audit_log import AuditEvent, append_event
from cyclone.parsers.parse_837 import parse
from cyclone.parsers.serialize_837 import serialize_837
from cyclone.store import store
router = APIRouter()
@@ -99,16 +101,12 @@ def submit_to_clearhouse(body: dict):
def _serialize_claim_for_submit(claim_id: str) -> str:
"""Serialize a claim to X12 for SFTP submission. Lazy import of the
serializer to avoid pulling FastAPI machinery at module import time."""
from cyclone import db as _db
with _db.SessionLocal()() as s:
row = s.get(_db.Claim, claim_id)
"""Serialize a claim to X12 for SFTP submission."""
with db.SessionLocal()() as s:
row = s.get(db.Claim, claim_id)
if row is None:
raise ValueError(f"claim {claim_id!r} not found")
# Re-parse the stored raw_json to get a ClaimOutput
raw = row.raw_json or {}
# Reconstruct minimal ClaimOutput from raw_json; this is best-effort.
return _serialize_claim_from_raw(row, raw)
@@ -116,19 +114,13 @@ def _serialize_claim_from_raw(claim_row, raw: dict) -> str:
"""Best-effort serializer that uses the stored raw_json to emit a fresh 837.
For SP9 this delegates to the existing serialize_837 helper if the
claim has a complete raw_segments array. Otherwise it returns a
minimal placeholder.
claim has a complete raw_segments array. Otherwise it raises.
"""
from cyclone.parsers.serialize_837 import serialize_837
from cyclone.parsers.parse_837 import parse
# Re-parse the original batch text (need to re-derive from store).
# SP9 stub: if the claim has a `raw_json` with `x12_text`, use that.
if isinstance(raw, dict) and raw.get("x12_text"):
result = parse(raw["x12_text"])
if result.claims:
return serialize_837(result.claims[0])
# Fallback: raise so the caller sees an error.
raise RuntimeError(
f"claim {claim_row.id!r} cannot be re-serialized: no stored x12_text"
)
)
+1 -1
View File
@@ -53,4 +53,4 @@ def list_payer_configs(payer_id: str):
live = store.get_payer_config(payer_id, tx)
if live is not None:
configs.append({"transaction_type": tx, "config_json": live, "source": "db"})
return configs
return configs
+1 -1
View File
@@ -46,4 +46,4 @@ def list_providers(
"total": total,
"returned": returned,
"has_more": has_more,
}
}