field_inspection_service

Handles field inspection workflow — PSoW retrieval, ABSoW updates, scope verification, EOD closeout, and production day calculation.

Connections

ABSoW Bridge (session 39)

update_absow() and eod_closeout() write to BOTH:

  1. Supabase SOW_AS_BUILT_QTY field
  2. SOW Gate SQLite (/data/portal-auth/sow_gate.db, table absow_confirmations)

Eliminates separate portal SOW gate confirmation step. Both cert_data_service and invoice_service read SQLite first, Supabase as fallback.

Production Days Auto-Calculation (session 39)

calculate_production_days(sow_lines) — 8 division rules:

  • UND: ceil(piers / 6.5)
  • ANC: ceil(anchors / 10)
  • BRC: ceil(braces / 12)
  • SUP: ceil(columns / 15) + 0.5 per beam/joist
  • FND: 1 per component type
  • WTR: 1 base + 0.5 per 50 LF
  • ENC: 1 base + 0.5 per 500 SF
  • RTW: 1 per 20 LF wall

Uses ABSoW quantities first, PSoW as fallback. Manual overrides always win. Written to project-level FIELD_PRODUCTION_DAYS via auto_calculate_and_write_production_days().

Notes

  • SOW_MODIFIED flag auto-set when ABSoW ≠ PSoW
  • Check 10 in cert_validate.py enforces scope resolution
  • confirmed_by distinguishes “field_inspector” (per-line) vs “field_inspector_eod” (batch)