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:
justin 2026-05-29 14:01:18 -05:00
parent 3b2ae6b050
commit 4aff121c0b
2 changed files with 6 additions and 3 deletions

View file

@ -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) {