feat(sp7): LineReconciliation ORM model
This commit is contained in:
@@ -342,6 +342,49 @@ class ServiceLinePayment(Base):
|
||||
)
|
||||
|
||||
|
||||
class LineReconciliation(Base):
|
||||
"""One row per matched (or explicitly unmatched) 837 service line within a claim.
|
||||
|
||||
SP7. Created during ``reconcile.run()`` after the claim↔remit match.
|
||||
At least one of ``claim_service_line_id`` / ``service_line_payment_id``
|
||||
must be non-null; the application enforces this.
|
||||
|
||||
See spec §3.2.
|
||||
"""
|
||||
__tablename__ = "line_reconciliations"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
claim_id: Mapped[str] = mapped_column(
|
||||
String(64), ForeignKey("claims.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
claim_service_line_id: Mapped[Optional[int]] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey("service_lines.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
service_line_payment_id: Mapped[Optional[int]] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey("service_line_payments.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
status: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
match_score: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
reconciled_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_line_reconciliations_claim_id", "claim_id"),
|
||||
Index(
|
||||
"ix_line_reconciliations_claim_service_line_id", "claim_service_line_id"
|
||||
),
|
||||
Index(
|
||||
"ix_line_reconciliations_service_line_payment_id",
|
||||
"service_line_payment_id",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class Match(Base):
|
||||
__tablename__ = "matches"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user