new-site/scripts/workers/services/__init__.py
justin 06e59965cc DOT D&A: instant PDF compliance-program binder (49)
Turn the DOT Drug & Alcohol Compliance Program into an automated
instant-delivery deliverable: when a carrier orders, we generate a
complete, print-ready PDF binder and email it (no admin step).

The binder (dot_da_binder_generator.py) bundles everything a small
carrier needs under 49 CFR Part 382 + Part 40:
  - How to manage the program (DER setup + annual operations)
  - Written drug & alcohol testing policy for employees
  - The six DOT test scenarios + triggers
  - Random testing / consortium (C-TPA) instructions
  - Supervisor reasonable-suspicion training + live/online access
  - Violations, SAP access, return-to-duty / follow-up
  - EAP / rehab / treatment resources (SAMHSA, 988, locator, ODAPC)
  - Recordkeeping retention schedule
  - Ready-to-use forms (acknowledgment, reasonable-suspicion,
    post-accident decision worksheet)
  - Regulation citations
  - Optional state Drug-Free Workplace addendum

Policy-variant selection: FMCSA (Part 382) is the trucking default;
honors an explicit dot_da_mode override for FRA/PHMSA/FTA/FAA/USCG.

New DrugAlcoholProgramHandler returns the binder PDF; slug added to
INSTANT_DELIVERY_SLUGS so job_server emails it automatically. Slug
rerouted from MCS150UpdateHandler (was admin-assisted enrollment) and
re-priced as a discountable own-deliverable (no passthrough cost).

Tests: scripts/tests/test_dot_da_binder.py (FMCSA sections, PHMSA+state
addendum, all-modes render) — passing.
2026-06-02 19:28:58 -05:00

184 lines
9.3 KiB
Python

"""Service handler registry.
Maps service slugs (matching ERPNext item codes) to their handler classes.
"""
from .flsa_audit import FLSAAuditHandler
from .contractor_review import ContractorReviewHandler
from .handbook_review import HandbookReviewHandler
from .ccpa_audit import CCPAAuditHandler
from .privacy_policy import PrivacyPolicyHandler
from .breach_response import BreachResponseHandler
from .consent_audit import ConsentAuditHandler
from .dnc_review import DNCReviewHandler
from .campaign_review import CampaignReviewHandler
from .fcc_compliance_checkup import FCCComplianceCheckupHandler
# FCC remediation filings (automated Playwright submission to FCC / USAC / BDC)
from .rmd_filing import RMDFilingHandler
from .cpni_certification import CPNIFilingHandler
from .form_499a import Form499AHandler, Form499ABundleHandler
from .form_499q import Form499QHandler
from .form_499a_discontinuance import Form499ADiscontinuanceHandler
from .stir_shaken import StirShakenHandler
from .bdc_filing import BDCFilingHandler
from .fcc_full_compliance import FullComplianceHandler
from .dc_agent import DCAgentHandler
# NECA OCN / Company Code registration (admin-driven, no Playwright flow)
from .ocn_registration import OCNRegistrationHandler
# CDR Traffic Study analysis (rolls ingested CDRs into a 499-A study)
from .cdr_analysis import CDRAnalysisHandler
# New FCC onboarding + compliance filings
from .cores_frn_registration import CORESFRNRegistrationHandler
from .form_499_initial import Form499InitialHandler
from .calea_ssi import CALEASSIHandler
from .foreign_carrier_affiliation import ForeignCarrierAffiliationHandler
from .cdr_storage_tier import (
CDRStorageTier1Handler,
CDRStorageTier2Handler,
CDRStorageTier3Handler,
)
from .new_carrier_bundle import NewCarrierBundleHandler
# Foreign qualification (Certificate of Authority) across US states
from .foreign_qualification import ForeignQualificationHandler
# State PUC/PSC registration across US states
from .state_puc_filing import StatePucFilingHandler
# FCC Carrier / ISP Registration pipeline
from .fcc_carrier_registration import FCCCarrierRegistrationHandler
# DOT / FMCSA Motor Carrier Services
from .mcs150_update import MCS150UpdateHandler
from .dot_drug_alcohol import DrugAlcoholProgramHandler
from .boc3_filing import BOC3FilingHandler
# State-level trucking compliance (IRP, IFTA, weight taxes, MCP, etc.)
from .state_trucking import StateTruckingHandler
# EIN application + virtual mailbox
from .ein_application import EINApplicationHandler
from .mailbox_setup import MailboxSetupHandler
# Carrier close-out / trucking wrap-up (shutdown) + entity dissolution
from .carrier_closeout import CarrierCloseoutHandler
# PHMSA hazmat registration (admin-assisted, 49 CFR Part 107)
from .hazmat_phmsa import HazmatPHMSAHandler
SERVICE_HANDLERS: dict[str, type] = {
"flsa-audit": FLSAAuditHandler,
"contractor-classification": ContractorReviewHandler,
"handbook-review": HandbookReviewHandler,
"policy-development": HandbookReviewHandler, # same handler, different template
"ccpa-audit": CCPAAuditHandler,
"privacy-policy": PrivacyPolicyHandler,
"data-mapping": CCPAAuditHandler, # similar handler
"breach-response": BreachResponseHandler,
"consent-audit": ConsentAuditHandler,
"dnc-compliance": DNCReviewHandler,
"campaign-review": CampaignReviewHandler,
# ── FCC Compliance (diagnostic + remediation) ──────────────────────
"fcc-compliance-checkup": FCCComplianceCheckupHandler,
"rmd-filing": RMDFilingHandler,
"cpni-certification": CPNIFilingHandler,
"fcc-499a": Form499AHandler,
"fcc-499a-zero": Form499AHandler, # same handler, zero_revenue flag set from slug
"fcc-499a-499q": Form499ABundleHandler,
"fcc-499q": Form499QHandler,
"fcc-499a-discontinuance": Form499ADiscontinuanceHandler,
"stir-shaken": StirShakenHandler,
# BDC triple — same handler, mode auto-resolved from slug
"bdc-filing": BDCFilingHandler, # legacy alias (both)
"bdc-broadband": BDCFilingHandler,
"bdc-voice": BDCFilingHandler,
"fcc-full-compliance": FullComplianceHandler,
"dc-agent": DCAgentHandler,
"ocn-registration": OCNRegistrationHandler,
"cdr-analysis": CDRAnalysisHandler,
# ── New FCC onboarding + compliance filings ────────────────────────
"cores-frn-registration": CORESFRNRegistrationHandler,
"fcc-499-initial": Form499InitialHandler,
"calea-ssi": CALEASSIHandler,
"fcc-63-11-notification": ForeignCarrierAffiliationHandler,
"new-carrier-bundle": NewCarrierBundleHandler,
# ── Foreign qualification (Certificate of Authority) ─────────────────
"foreign-qualification-single": ForeignQualificationHandler,
"foreign-qualification-multi": ForeignQualificationHandler, # same handler, fans out per-state
# ── State PUC/PSC registration ────────────────────────────────────
"state-puc": StatePucFilingHandler,
# ── CDR storage tier add-ons (quota bumps, not filings) ────────────
"cdr-storage-tier1": CDRStorageTier1Handler,
"cdr-storage-tier2": CDRStorageTier2Handler,
"cdr-storage-tier3": CDRStorageTier3Handler,
# ── DOT / FMCSA Motor Carrier Services ────────────────────────────
"mcs150-update": MCS150UpdateHandler,
"boc3-filing": BOC3FilingHandler,
"ucr-registration": MCS150UpdateHandler, # admin-assisted, same pattern
"dot-registration": MCS150UpdateHandler, # admin-assisted
"mc-authority": MCS150UpdateHandler, # admin-assisted
"dot-drug-alcohol": DrugAlcoholProgramHandler, # instant PDF binder ($149)
"dot-audit-prep": MCS150UpdateHandler, # admin-assisted (document prep)
"dot-full-compliance": MCS150UpdateHandler, # fans out to individual services
"usdot-reactivation": MCS150UpdateHandler, # same FMCSA submission flow
"emergency-temporary-authority": MCS150UpdateHandler, # ask.fmcsa.dot.gov type 308
"ein-application": EINApplicationHandler,
"virtual-mailbox": MailboxSetupHandler,
"carrier-closeout": CarrierCloseoutHandler, # trucking wrap-up / USDOT shutdown
"entity-dissolution": CarrierCloseoutHandler, # add-on, same handler (dissolution branch)
"annual-report-filing": MCS150UpdateHandler, # admin-assisted
"registered-agent": MCS150UpdateHandler, # admin-assisted (NWRA/CorpTools)
"entity-reinstatement": MCS150UpdateHandler, # admin-assisted
"entity-upgrade-bundle": MCS150UpdateHandler, # pipeline orchestrator manages sequence
# ── State-Level Trucking Compliance ───────────────────────────────
"irp-registration": StateTruckingHandler,
"ifta-application": StateTruckingHandler,
"ifta-quarterly": StateTruckingHandler,
"or-weight-mile-tax": StateTruckingHandler,
"ny-hut-registration": StateTruckingHandler,
"ky-kyu-registration": StateTruckingHandler,
"nm-weight-distance": StateTruckingHandler,
"ct-highway-use-fee": StateTruckingHandler,
"ca-mcp-carb": StateTruckingHandler,
"state-dot-registration": StateTruckingHandler,
"intrastate-authority": StateTruckingHandler,
"osow-permit": StateTruckingHandler,
"state-trucking-bundle": StateTruckingHandler,
# ── Hazmat / PHMSA Registration ───────────────────────────────────
"hazmat-phmsa": HazmatPHMSAHandler,
# ── State emissions / clean-truck (admin-assisted) ────────────────
"state-emissions": StateTruckingHandler,
}
# Service slugs that operate on a telecom entity — used by job_server.py
# to decide whether to hydrate the entity row from PostgreSQL before
# dispatching to the handler.
FCC_SERVICE_SLUGS: frozenset[str] = frozenset({
"fcc-compliance-checkup",
"rmd-filing",
"cpni-certification",
"fcc-499a",
"fcc-499a-zero",
"fcc-499a-499q",
"fcc-499q",
"fcc-499a-discontinuance",
"stir-shaken",
"bdc-filing",
"fcc-full-compliance",
"dc-agent",
"ocn-registration",
"cdr-analysis",
# BDC triple (already covered by bdc-filing above; add explicit aliases)
"bdc-broadband",
"bdc-voice",
# New FCC filings
"cores-frn-registration",
"fcc-499-initial",
"calea-ssi",
"fcc-63-11-notification",
"new-carrier-bundle",
# CDR storage tiers — operate on a telecom entity's cdr_ingestion_profiles
"cdr-storage-tier1",
"cdr-storage-tier2",
"cdr-storage-tier3",
# Foreign qualification — may reference a telecom entity
"foreign-qualification-single",
"foreign-qualification-multi",
# State PUC/PSC — may reference a telecom entity
"state-puc",
})
__all__ = ["SERVICE_HANDLERS", "FCC_SERVICE_SLUGS"]