Fix interstate detection: use carrier_operation code A, not text match
FMCSA census carrier_operation is single-letter: A=Interstate, B=Intrastate Hazmat, C=Intrastate Non-Hazmat. Previous code searched for "interstate" in text which never matched. Now 22,089 interstate carriers will be properly flagged for IRP/IFTA. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3b2ae6b050
commit
4aff121c0b
2 changed files with 6 additions and 3 deletions
|
|
@ -306,9 +306,11 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
|
|||
|
||||
// ── State-Level Compliance Checks ──────────────────────────────
|
||||
const phyState = (carrier?.phyState || census?.phy_state || "").toUpperCase();
|
||||
// carrier_operation: A = Interstate, B = Intrastate Hazmat, C = Intrastate Non-Hazmat
|
||||
const isInterstate = carrier
|
||||
? (carrier.censusTypeId?.censusTypeDesc || "").toLowerCase().includes("interstate")
|
||||
: (census?.carrier_operation || "").toLowerCase().includes("interstate");
|
||||
? (carrier.censusTypeId?.censusTypeDesc || "").toLowerCase().includes("interstate") ||
|
||||
(carrier.carrierOperation?.carrierOperationCode === "A")
|
||||
: (census?.carrier_operation || "").toUpperCase() === "A";
|
||||
const isForHireCarrier = census?.authorized_for_hire || false;
|
||||
|
||||
if (phyState && phyState.length === 2) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,8 @@ def flag_carriers(dry_run: bool = False) -> dict:
|
|||
stats["zero_fleet"] += 1
|
||||
|
||||
# State-level flags based on carrier's physical state
|
||||
is_interstate = carrier_op and "interstate" in (carrier_op or "").lower()
|
||||
# carrier_operation: A = Interstate, B = Intrastate Hazmat, C = Intrastate Non-Hazmat
|
||||
is_interstate = (carrier_op or "").upper() == "A"
|
||||
sr = state_reqs.get(state) if state else None
|
||||
if sr:
|
||||
# Interstate carriers need IRP and IFTA
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue