Saving current working state before proceeding to Stage 2. Includes: - Backend: Python-based QC validator with shapefile processing - Frontend: Drag-and-drop file upload interface - Sample files for testing - Documentation and revision history 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
55 lines
3.6 KiB
SQL
55 lines
3.6 KiB
SQL
-- Fixed sites data matching actual eli_test.sites table structure
|
|
-- Adds "Group 1" column for zone assignment
|
|
-- Uses SRID 4326
|
|
|
|
-- Add Group 1 column if it doesn't exist
|
|
ALTER TABLE eli_test.sites ADD COLUMN IF NOT EXISTS "Group 1" varchar(255);
|
|
|
|
-- Insert sites with proper zone assignments
|
|
INSERT INTO eli_test.sites (id, "MapProjectID", "Latitude", "Longitude", "Address1", "Group 1", geometry)
|
|
VALUES
|
|
-- Sites in Zone_A (correctly within the zone)
|
|
(1001, 1, 37.7755, -122.4190, '123 Market St', 'Zone_A', ST_GeomFromText('POINT(-122.4190 37.7755)', 4326)),
|
|
(1002, 1, 37.7765, -122.4175, '456 Mission St', 'Zone_A', ST_GeomFromText('POINT(-122.4175 37.7765)', 4326)),
|
|
(1003, 1, 37.7775, -122.4160, '789 Howard St', 'Zone_A', ST_GeomFromText('POINT(-122.4160 37.7775)', 4326)),
|
|
(1004, 1, 37.7785, -122.4150, '321 Folsom St', 'Zone_A', ST_GeomFromText('POINT(-122.4150 37.7785)', 4326)),
|
|
(1005, 1, 37.7710, -122.4200, '555 Bryant St', 'Zone_A', ST_GeomFromText('POINT(-122.4200 37.7710)', 4326)),
|
|
(1006, 1, 37.7805, -122.4205, '888 Harrison St', 'Zone_A', ST_GeomFromText('POINT(-122.4205 37.7805)', 4326)),
|
|
(1007, 1, 37.7735, -122.4135, '999 7th St', 'Zone_A', ST_GeomFromText('POINT(-122.4135 37.7735)', 4326)),
|
|
(1008, 1, 37.7745, -122.4125, '111 8th St', 'Zone_A', ST_GeomFromText('POINT(-122.4125 37.7745)', 4326)),
|
|
(1009, 1, 37.7685, -122.4330, '222 9th St', 'Zone_A', ST_GeomFromText('POINT(-122.4330 37.7685)', 4326)),
|
|
(1010, 1, 37.7695, -122.4325, '333 10th St', 'Zone_A', ST_GeomFromText('POINT(-122.4325 37.7695)', 4326)),
|
|
(1011, 1, 37.7750, -122.4105, '444 11th St', 'Zone_A', ST_GeomFromText('POINT(-122.4105 37.7750)', 4326)),
|
|
(1012, 1, 37.7720, -122.4340, '666 Townsend St', 'Zone_A', ST_GeomFromText('POINT(-122.4340 37.7720)', 4326)),
|
|
|
|
-- Sites in Zone_B (correctly within the zone)
|
|
(2001, 1, 37.7855, -122.4090, '100 Oak St', 'Zone_B', ST_GeomFromText('POINT(-122.4090 37.7855)', 4326)),
|
|
(2002, 1, 37.7865, -122.4078, '200 Fell St', 'Zone_B', ST_GeomFromText('POINT(-122.4078 37.7865)', 4326)),
|
|
(2003, 1, 37.7875, -122.4070, '300 Hayes St', 'Zone_B', ST_GeomFromText('POINT(-122.4070 37.7875)', 4326)),
|
|
|
|
-- Sites in Zone_C (correctly within the zone)
|
|
(3001, 1, 37.7955, -122.3990, '400 Grove St', 'Zone_C', ST_GeomFromText('POINT(-122.3990 37.7955)', 4326)),
|
|
(3002, 1, 37.7965, -122.3980, '500 Fulton St', 'Zone_C', ST_GeomFromText('POINT(-122.3980 37.7965)', 4326)),
|
|
|
|
-- INVALID: Site labeled Zone_A but physically located in Zone_B
|
|
(1013, 1, 37.7860, -122.4080, '777 Invalid Location', 'Zone_A', ST_GeomFromText('POINT(-122.4080 37.7860)', 4326)),
|
|
|
|
-- INVALID: Site labeled Zone_B but physically located in Zone_A
|
|
(2004, 1, 37.7750, -122.4200, '888 Wrong Zone', 'Zone_B', ST_GeomFromText('POINT(-122.4200 37.7750)', 4326)),
|
|
|
|
-- INVALID: Site labeled Zone_C but physically outside all zones
|
|
(3003, 1, 37.7500, -122.3800, '999 Outside All Zones', 'Zone_C', ST_GeomFromText('POINT(-122.3800 37.7500)', 4326)),
|
|
|
|
-- INVALID: Site labeled Zone_A but physically outside all zones
|
|
(1014, 1, 37.7400, -122.3700, '1111 Far Away', 'Zone_A', ST_GeomFromText('POINT(-122.3700 37.7400)', 4326)),
|
|
|
|
-- INVALID: Site with NULL Group 1 (unassigned) but inside Zone_A
|
|
(1015, 1, 37.7800, -122.4250, '1212 Unassigned St', NULL, ST_GeomFromText('POINT(-122.4250 37.7800)', 4326)),
|
|
|
|
-- Site in Zone_D (correctly in Zone_D)
|
|
(4001, 1, 37.7625, -122.3875, '1313 Empty Zone', 'Zone_D', ST_GeomFromText('POINT(-122.3875 37.7625)', 4326));
|
|
|
|
-- Verify sites were inserted
|
|
SELECT COUNT(*) as total_sites FROM eli_test.sites WHERE id >= 1001;
|
|
SELECT id, "Address1", "Group 1", ST_AsText(geometry) as location FROM eli_test.sites WHERE id >= 1001 ORDER BY id LIMIT 5;
|