Includes: API (Express/TypeScript), Astro site, Python workers, document generators, FCC compliance tools, Canada CRTC formation, Ansible infrastructure, and deployment scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
2 KiB
Python
60 lines
2 KiB
Python
"""Inter-Carrier Compensation (ICC) revenue adapters.
|
|
|
|
Each adapter parses one carrier-specific interconnection or settlement
|
|
artifact format into a normalized ``IccRevenueLine`` stream consumed by
|
|
``scripts.workers.icc_ingester``.
|
|
|
|
Dispatch is driven by ``icc_ingestion_uploads.source_format`` (the CHECK
|
|
constraint on that column enumerates the supported slugs; this module's
|
|
``ADAPTERS`` dict keys must stay in sync).
|
|
|
|
Contract — see ``common.py``:
|
|
BaseICCAdapter.iter_rows(local_path) -> Iterator[IccRevenueLine]
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict, Optional, Type
|
|
|
|
from .common import BaseICCAdapter, IccRevenueLine, ValidationError
|
|
from .cabs_bos_adapter import CABSBOSAdapter
|
|
from .edi_810_adapter import EDI810Adapter
|
|
from .iconectiv_8yy_adapter import IconectivQRYAdapter
|
|
from .international_settlement import InternationalSettlementAdapter
|
|
from .wholesale_sip_csv import WholesaleSIPCSVAdapter
|
|
from .carrier_invoice_pdf import CarrierInvoicePDFAdapter
|
|
|
|
|
|
ADAPTERS: Dict[str, Type[BaseICCAdapter]] = {
|
|
"cabs_bos": CABSBOSAdapter,
|
|
"edi_810": EDI810Adapter,
|
|
"8yy_qry": IconectivQRYAdapter,
|
|
"itu_tas": InternationalSettlementAdapter,
|
|
"icss": InternationalSettlementAdapter,
|
|
"wholesale_sip_csv": WholesaleSIPCSVAdapter,
|
|
"carrier_invoice_pdf": CarrierInvoicePDFAdapter,
|
|
}
|
|
|
|
|
|
def get_adapter(source_format: str) -> Optional[Type[BaseICCAdapter]]:
|
|
"""Resolve an ``icc_ingestion_uploads.source_format`` slug into its adapter class.
|
|
|
|
Returns ``None`` when the slug is unknown; callers should mark the
|
|
upload ``failed`` with an explanatory error in that case.
|
|
"""
|
|
return ADAPTERS.get(source_format)
|
|
|
|
|
|
__all__ = [
|
|
"ADAPTERS",
|
|
"get_adapter",
|
|
"BaseICCAdapter",
|
|
"IccRevenueLine",
|
|
"ValidationError",
|
|
"CABSBOSAdapter",
|
|
"EDI810Adapter",
|
|
"IconectivQRYAdapter",
|
|
"InternationalSettlementAdapter",
|
|
"WholesaleSIPCSVAdapter",
|
|
"CarrierInvoicePDFAdapter",
|
|
]
|