feat(backend): PayerConfig with co_medicaid and generic factories
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
"""Payer-specific configuration for the 837P parser.
|
||||
|
||||
The same parser module can ingest 837P files from any payer, but the
|
||||
validation rules differ. ``PayerConfig`` carries the differences so
|
||||
``validator.validate(claim, config)`` can be payer-aware without branching
|
||||
in the parser.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class PayerConfig(BaseModel):
|
||||
model_config = ConfigDict(frozen=True)
|
||||
|
||||
name: str
|
||||
sbr09_claim_filing: str = "MC"
|
||||
allowed_claim_frequencies: set[int] = Field(default_factory=lambda: {1, 7, 8})
|
||||
require_ref_g1_for_adjustments: bool = False
|
||||
allowed_bht06: set[str] = Field(default_factory=lambda: {"CH"})
|
||||
payer_id: str = ""
|
||||
payer_name: str = ""
|
||||
no_patient_loop: bool = False
|
||||
encounter_claim_in_same_batch: bool = False
|
||||
|
||||
@classmethod
|
||||
def co_medicaid(cls) -> "PayerConfig":
|
||||
"""Defaults for Colorado Medical Assistance Program (FFS).
|
||||
|
||||
Source: ``docs/companionguides/837p.md``.
|
||||
"""
|
||||
return cls(
|
||||
name="Colorado Medical Assistance Program",
|
||||
sbr09_claim_filing="MC",
|
||||
allowed_claim_frequencies={1, 7, 8},
|
||||
# Lenient in v1 — see spec §9 R031.
|
||||
require_ref_g1_for_adjustments=False,
|
||||
allowed_bht06={"CH"},
|
||||
payer_id="SKCO0",
|
||||
payer_name="COHCPF",
|
||||
no_patient_loop=True,
|
||||
encounter_claim_in_same_batch=False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def generic_837p(cls) -> "PayerConfig":
|
||||
"""Relaxed defaults for an unknown payer. Structural rules only."""
|
||||
return cls(
|
||||
name="Generic 837P",
|
||||
sbr09_claim_filing="",
|
||||
allowed_claim_frequencies={1, 2, 3, 4, 5, 6, 7, 8, 9},
|
||||
require_ref_g1_for_adjustments=False,
|
||||
allowed_bht06={"CH", "RP"},
|
||||
payer_id="",
|
||||
payer_name="",
|
||||
no_patient_loop=False,
|
||||
encounter_claim_in_same_batch=True,
|
||||
)
|
||||
Reference in New Issue
Block a user