# Failed Layers Summary - All Errors ## Overview **Total Layers Tested:** 10 **Failed Layers:** 7 **Success Rate:** 30% --- ## 1. Access Points (access_points.shp) **Status:** ❌ FAILED (0/10 records) **Error Type:** API 500 Error - Field Name Mismatch **Error Message:** ``` PHP Warning: Undefined array key "isLocked" ``` **Problem:** - Sending field: `isLocked` - API expects: `locked` **Current Code (Line 407):** ```python ap_data = { "mapProjectId": int(map_id), "name": f"AP-{idx}", "latitude": str(lat), "longitude": str(lon), "typeId": type_id, "isLocked": 0 # ❌ WRONG FIELD NAME } ``` **Required Fix:** ```python ap_data = { "mapProjectId": int(map_id), "name": f"AP-{idx}", "latitude": str(lat), "longitude": str(lon), "typeId": type_id, "locked": 0 # ✅ CORRECT FIELD NAME } ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:407` --- ## 2. Network Elements (network_elements.shp) **Status:** ❌ FAILED (0/10 records) **Error Type:** API 500 Error - Silent Failure (no debug output) **Error Message:** ``` (No error message displayed - silent failure) ``` **Problem:** - Code was recently updated with typeId mapping - No debug output to see what data is being sent - Likely missing a required field or incorrect field format **Current Code (Lines 800-813):** ```python def _create_network_element(self, ne_data: Dict) -> bool: """Create a network element via Verofy API""" headers = { "Authorization": f"Bearer {self.access_token}", "Content-Type": "application/json" } response = requests.post( f"{API_URL}/map-network-element/create", headers=headers, json=ne_data ) return response.status_code == 201 ``` **Required Fix:** - Add debug output (like sites/access_points have) - Add error logging to see API response ```python def _create_network_element(self, ne_data: Dict) -> bool: """Create a network element via Verofy API""" headers = { "Authorization": f"Bearer {self.access_token}", "Content-Type": "application/json" } print(f"DEBUG: Sending network element data: {json.dumps(ne_data, indent=2)}") response = requests.post( f"{API_URL}/map-network-element/create", headers=headers, json=ne_data ) if response.status_code != 201: print(f"❌ Network Element API Error {response.status_code}: {response.text[:200]}") return False return True ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:800-813` **API Endpoint:** `POST /v1/map-network-element/create` --- ## 3. Splicing (splicing.shp) **Status:** ❌ FAILED (0/10 records) **Error Type:** API 500 Error - Silent Failure (no debug output) **Error Message:** ``` (No error message displayed - silent failure) ``` **Problem:** - Code was recently updated with typeId mapping - No debug output to see what data is being sent - Likely missing a required field or incorrect field format **Current Code (Lines 850-862):** ```python def _create_splicing(self, splicing_data: Dict) -> bool: """Create a splicing point via Verofy API""" headers = { "Authorization": f"Bearer {self.access_token}", "Content-Type": "application/json" } # Assuming splicing uses similar endpoint to network elements or sites response = requests.post( f"{API_URL}/map-splicing/create", headers=headers, json=splicing_data ) return response.status_code == 201 ``` **Required Fix:** - Add debug output - Add error logging ```python def _create_splicing(self, splicing_data: Dict) -> bool: """Create a splicing point via Verofy API""" headers = { "Authorization": f"Bearer {self.access_token}", "Content-Type": "application/json" } print(f"DEBUG: Sending splicing data: {json.dumps(splicing_data, indent=2)}") response = requests.post( f"{API_URL}/map-splice/create", # Note: endpoint is map-splice, not map-splicing headers=headers, json=splicing_data ) if response.status_code != 201: print(f"❌ Splicing API Error {response.status_code}: {response.text[:200]}") return False return True ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:850-862` **API Endpoint:** `POST /v1/map-splice/create` (not map-splicing!) **Note:** The endpoint might be incorrect - it should be `map-splice`, not `map-splicing` --- ## 4. Cabinet Boundaries (cabinet_boundaries.shp) **Status:** ❌ FAILED (0/3 records) **Error Type:** API 500 Error - Missing Required Field **Error Message:** ``` Database Exception: SQLSTATE[HY000]: General error: 1364 Field 'metric' doesn't have a default value ``` **Problem:** - Missing required field: `metric` - The `mapobject` table requires this field **Current Code (Lines 549-563):** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Cabinet-Boundary-{idx}')), "mapinfoobjecttypeId": 3, # 3 = Polygon "data": data, "color": "#ffffff", "alpha": "0.40" # ❌ MISSING: "metric" field } ``` **Required Fix:** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Cabinet-Boundary-{idx}')), "mapinfoobjecttypeId": 3, # 3 = Polygon "data": data, "color": "#ffffff", "alpha": "0.40", "metric": 0 # ✅ ADD THIS REQUIRED FIELD } ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:549-563` --- ## 5. Cables (cables.shp) **Status:** ❌ FAILED (0/3 records) **Error Type:** API 500 Error - Missing Required Field **Error Message:** ``` Database Exception: SQLSTATE[HY000]: General error: 1364 Field 'metric' doesn't have a default value ``` **Problem:** - Missing required field: `metric` - Same issue as cabinet_boundaries **Current Code (Lines 591-598):** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Cable-{idx}')), "mapinfoobjecttypeId": 2, # 2 = Line/Polyline "data": data, "color": "#ffffff", "alpha": "1.00" # ❌ MISSING: "metric" field } ``` **Required Fix:** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Cable-{idx}')), "mapinfoobjecttypeId": 2, # 2 = Line/Polyline "data": data, "color": "#ffffff", "alpha": "1.00", "metric": 0 # ✅ ADD THIS REQUIRED FIELD } ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:591-598` --- ## 6. Parcels (parcels.shp) **Status:** ❌ FAILED (0/3 records) **Error Type:** API 500 Error - Missing Required Field **Error Message:** ``` Database Exception: SQLSTATE[HY000]: General error: 1364 Field 'metric' doesn't have a default value ``` **Problem:** - Missing required field: `metric` - Same issue as cabinet_boundaries and cables **Current Code (Lines 634-641):** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Parcel-{idx}')), "mapinfoobjecttypeId": 3, # 3 = Polygon "data": data, "color": "#ffffff", "alpha": "0.40" # ❌ MISSING: "metric" field } # Add optional fields (Group 1/2 map to objectgroup/objectgroup2) if 'Group 1' in row and row['Group 1']: info_data['objectgroup'] = str(row['Group 1']) if 'Group 2' in row and row['Group 2']: info_data['objectgroup2'] = str(row['Group 2']) ``` **Required Fix:** ```python info_data = { "mapProjectId": int(map_id), "name": str(row.get('Name', f'Parcel-{idx}')), "mapinfoobjecttypeId": 3, # 3 = Polygon "data": data, "color": "#ffffff", "alpha": "0.40", "metric": 0 # ✅ ADD THIS REQUIRED FIELD } # Add optional fields (Group 1/2 map to objectgroup/objectgroup2) if 'Group 1' in row and row['Group 1']: info_data['objectgroup'] = str(row['Group 1']) if 'Group 2' in row and row['Group 2']: info_data['objectgroup2'] = str(row['Group 2']) ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:634-641` --- ## 7. Permits (permits.shp) **Status:** ❌ FAILED (0/10 records) **Error Type:** API 422 Validation Error - Missing Required Fields **Error Message:** ```json [ {"field":"mappermitstatusId","message":"Permit Status cannot be blank."}, {"field":"mappermitentitytypeId","message":"Permit Entity Type cannot be blank."}, {"field":"mappermitulrtypeId","message":"Permit ULR Type cannot be blank."} ] ``` **Problem:** - Missing 3 required fields: 1. `mappermitstatusId` - Status of the permit 2. `mappermitentitytypeId` - Entity type (e.g., company, individual) 3. `mappermitulrtypeId` - ULR (Utility Location Request?) type **Current Code (Lines 699-703):** ```python permit_data = { "mapProjectId": int(map_id), "name": str(name), "poly": poly, # ❌ MISSING: mappermitstatusId # ❌ MISSING: mappermitentitytypeId # ❌ MISSING: mappermitulrtypeId } ``` **Required Fix:** ```python permit_data = { "mapProjectId": int(map_id), "name": str(name), "poly": poly, "mappermitstatusId": 1, # ✅ ADD: Default status "mappermitentitytypeId": 1, # ✅ ADD: Default entity type "mappermitulrtypeId": 1 # ✅ ADD: Default ULR type } ``` **File Location:** `/home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py:699-703` **Note:** Need to fetch the reference data to determine correct default values: - MapPermitStatus references - MapPermitEntityType references - MapPermitULRType references --- ## Summary Table | # | Layer | Records Failed | Error Type | Primary Issue | Fix Complexity | |---|-------|----------------|------------|---------------|----------------| | 1 | access_points | 10 | Field Name | Wrong field name: `isLocked` → `locked` | ⭐ Easy | | 2 | network_elements | 10 | Unknown | Silent 500 error - needs debugging | ⭐⭐ Medium | | 3 | splicing | 10 | Unknown | Silent 500 error - needs debugging | ⭐⭐ Medium | | 4 | cabinet_boundaries | 3 | Missing Field | Add `metric: 0` | ⭐ Easy | | 5 | cables | 3 | Missing Field | Add `metric: 0` | ⭐ Easy | | 6 | parcels | 3 | Missing Field | Add `metric: 0` | ⭐ Easy | | 7 | permits | 10 | Missing Fields | Add 3 required fields with defaults | ⭐⭐ Medium | **Total Failed Records:** 49 out of 59 records (83% failure rate for failed layers) --- ## Priority Order for Fixes ### Priority 1 - Quick Wins (Should fix immediately) 1. **Access Points** - One-line fix (change field name) 2. **Cabinet Boundaries** - One-line fix (add metric field) 3. **Cables** - One-line fix (add metric field) 4. **Parcels** - One-line fix (add metric field) ### Priority 2 - Requires Research 5. **Permits** - Need to research correct reference IDs 6. **Network Elements** - Add debug output, test, fix based on error 7. **Splicing** - Add debug output, test, fix based on error (also check endpoint name) --- ## Action Plan 1. Fix Priority 1 items (4 layers) - should take 5 minutes 2. Re-run test to verify Priority 1 fixes work 3. Research permit references and add defaults 4. Add debug output to network_elements and splicing 5. Re-run test with debug to see exact errors 6. Fix remaining issues based on error output