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>
2.6 KiB
2.6 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Auto-LLD QC is a web-based spatial quality control tool for fiber network designs. It connects to a PostGIS database to run automated QC checks on network segments through a map interface.
Commands
Backend Development
cd Backend
go run main.go # Start the server (default port 8080)
go mod tidy # Clean up dependencies
Frontend Development
- Frontend is static HTML/CSS/JavaScript served from
Frontend/directory - Open
Frontend/index.htmlin browser or use static file server - Backend serves frontend at root path when running
Architecture
Backend Structure (Go + Gin)
- main.go: Main server setup, database connection, API routes
- models/models.go: GORM database models for segments, sites, poles, access points
- qc/: Quality control modules (graph_connect.go, handholes.go, segment_single_span.go)
- db/connect.go: Database connection utilities
Frontend Structure
- index.html: Main UI with market/zone dropdowns and QC control buttons
- main.js: JavaScript handling map display (Leaflet), API calls, QC operations
- styles.css: UI styling
Database Integration
- Uses PostGIS spatial database with configurable schema/table names
- Environment variables in
.envcontrol database connection and table configuration - Key tables: segments (main data), sites, poles, access_points, map_projects
API Endpoints
/api/markets- Get available market/project options/api/zones- Get zones for selected market/api/segments- Get segment data as GeoJSON/api/sites,/api/poles,/api/access_points- Get spatial features/api/qc/*- QC check endpoints (connectivity, single-span, etc.)
QC Module Pattern
Each QC check follows this pattern:
- Separate Go file in
/qcdirectory - Route registration function called from main.go
- Returns GeoJSON FeatureCollection of affected segments
- Updates
qc_flagcolumn to mark issues
Environment Configuration
Backend uses environment variables for database connection and table/column names:
- DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME
- SCHEMA_NAME, SEGMENT_TABLE, ZONE_COLUMN, MAPID_COLUMN, etc.
- SERVER_PORT for web server port
Key Technologies
- Backend: Go 1.24+, Gin web framework, GORM ORM, PostGIS
- Frontend: Vanilla JavaScript, Leaflet.js for maps, Turf.js for spatial operations
- Database: PostgreSQL with PostGIS extension