Files
ai-tax-agent/apps/svc_coverage/models.py
harkon b324ff09ef
Some checks failed
CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
CI/CD Pipeline / Policy Validation (push) Has been cancelled
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-firm-connectors) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-forms) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-hmrc) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ingestion) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-normalize-map) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ocr) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-indexer) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-reason) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rpa) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (ui-review) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (ui-review) (push) Has been cancelled
CI/CD Pipeline / Generate SBOM (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Notifications (push) Has been cancelled
Initial commit
2025-10-11 08:41:36 +01:00

47 lines
1.6 KiB
Python

"""Database models for coverage service."""
# FILE: apps/svc-coverage/models.py
from datetime import datetime
from sqlalchemy import JSON, Column, DateTime, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class CoverageVersion(Base):
"""Policy version tracking table"""
__tablename__ = "coverage_versions"
id = Column(Integer, primary_key=True, autoincrement=True)
version = Column(String(50), nullable=False)
jurisdiction = Column(String(10), nullable=False)
tax_year = Column(String(10), nullable=False)
tenant_id = Column(String(100), nullable=True)
source_files = Column(JSON, nullable=False, default=list)
compiled_at = Column(DateTime, nullable=False, default=datetime.utcnow)
hash = Column(String(64), nullable=False)
def __repr__(self) -> str:
return f"<CoverageVersion(id={self.id}, version='{self.version}', hash='{self.hash[:8]}...')>"
class CoverageAudit(Base):
"""Coverage evaluation audit trail"""
__tablename__ = "coverage_audit"
id = Column(Integer, primary_key=True, autoincrement=True)
taxpayer_id = Column(String(100), nullable=False)
tax_year = Column(String(10), nullable=False)
policy_version = Column(String(50), nullable=False)
overall_status = Column(String(20), nullable=False)
blocking_items = Column(JSON, nullable=False, default=list)
created_at = Column(DateTime, nullable=False, default=datetime.utcnow)
trace_id = Column(String(100), nullable=True)
def __repr__(self) -> str:
return f"<CoverageAudit(id={self.id}, taxpayer_id='{self.taxpayer_id}', status='{self.overall_status}')>"