field_inspection_service
Handles field inspection workflow — PSoW retrieval, ABSoW updates, scope verification, EOD closeout, and production day calculation.
Connections
- depends on: supabase-write-service, supabase-read-service
- feeds into: auto-validation-service (field complete trigger)
- feeds into: cert-data-service (ABSoW quantities)
- feeds into: invoice-service (ABSoW + production days)
- called by: Rob via WhatsApp endpoints
ABSoW Bridge (session 39)
update_absow() and eod_closeout() write to BOTH:
- Supabase
SOW_AS_BUILT_QTYfield - SOW Gate SQLite (
/data/portal-auth/sow_gate.db, tableabsow_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)