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>
173 lines
9.6 KiB
Go
173 lines
9.6 KiB
Go
package models
|
|
|
|
import "encoding/json"
|
|
|
|
type Segment struct {
|
|
ID0 int `gorm:"column:id_0;primaryKey" json:"id_0"`
|
|
MapID int `gorm:"column:mapid" json:"mapid"`
|
|
SegmentType string `gorm:"column:segment_type" json:"segment_type"`
|
|
SegmentStatus string `gorm:"column:segment_status" json:"segment_status"`
|
|
ID int `gorm:"column:id" json:"id"`
|
|
ProtectionStatus string `gorm:"column:protection_status" json:"protection_status"`
|
|
QCFlag string `gorm:"column:qc_flag" json:"qc_flag"`
|
|
Geometry json.RawMessage `gorm:"column:geometry" json:"geometry"`
|
|
}
|
|
|
|
func (Segment) TableName() string {
|
|
return "eli_test.segment2"
|
|
}
|
|
|
|
// New struct for GeoJSON response with Geometry as raw JSON
|
|
type SegmentGeoJSON struct {
|
|
ID0 int `gorm:"column:id_0" json:"id_0"`
|
|
MapID int `gorm:"column:mapid" json:"mapid"`
|
|
SegmentType string `gorm:"column:segment_type" json:"segment_type"`
|
|
SegmentStatus string `gorm:"column:segment_status" json:"segment_status"`
|
|
ID int `gorm:"column:id" json:"id"`
|
|
ProtectionStatus string `gorm:"column:protection_status" json:"protection_status"`
|
|
QCFlag string `gorm:"column:qc_flag" json:"qc_flag"`
|
|
Geometry json.RawMessage `gorm:"column:geometry" json:"geometry"` // Added missing geometry field
|
|
}
|
|
|
|
// Sites struct (exported, with tags and GORM column names)
|
|
type Sites struct {
|
|
GID int `json:"gid" gorm:"primaryKey;column:gid"`
|
|
ID *int `json:"id" gorm:"column:id"`
|
|
MapProjectID *int `json:"mapprojectid" gorm:"column:mapprojectid"`
|
|
Longitude *string `json:"longitude" gorm:"column:longitude"`
|
|
Latitude *string `json:"latitude" gorm:"column:latitude"`
|
|
Exclude *int `json:"exclude" gorm:"column:exclude"`
|
|
Custom *int `json:"custom" gorm:"column:custom"`
|
|
Color *string `json:"color" gorm:"column:color"`
|
|
Opacity *string `json:"opacity" gorm:"column:opacity"`
|
|
ShapeID *string `json:"shapeid" gorm:"column:shapeid"`
|
|
StyleSize *string `json:"stylesize" gorm:"column:stylesize"`
|
|
CreatedBy *int `json:"createdby" gorm:"column:createdby"`
|
|
CreatedDate *int `json:"createddate" gorm:"column:createddate"`
|
|
ModifiedBy *int `json:"modifiedby" gorm:"column:modifiedby"`
|
|
ModifiedDate *int `json:"modifieddate" gorm:"column:modifieddate"`
|
|
HistoryID *int `json:"historyid" gorm:"column:historyid"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
StatusID *int `json:"statusid" gorm:"column:statusid"`
|
|
Group1 *string `json:"group1" gorm:"column:group1"`
|
|
Group2 *string `json:"group2" gorm:"column:group2"`
|
|
IconTypeID *int `json:"icontypeid" gorm:"column:icontypeid"`
|
|
SchoolID *string `json:"schoolid" gorm:"column:schoolid"`
|
|
SiteDemarc *string `json:"sitedemarc" gorm:"column:sitedemarc"`
|
|
Address1 *string `json:"address1" gorm:"column:address1"`
|
|
Address2 *string `json:"address2" gorm:"column:address2"`
|
|
City *string `json:"city" gorm:"column:city"`
|
|
State *string `json:"state" gorm:"column:state"`
|
|
Zip *string `json:"zip" gorm:"column:zip"`
|
|
ConnectivityStatus *string `json:"connectivity_status" gorm:"column:connectivity_status"`
|
|
ConnectivityDistance *float64 `json:"connectivity_distance" gorm:"column:connectivity_distance"`
|
|
}
|
|
|
|
// SitesGeoJSON struct (for your geojson API response)
|
|
type SitesGeoJSON struct {
|
|
GID int `json:"gid" gorm:"column:gid"`
|
|
ID *int `json:"id" gorm:"column:id"`
|
|
MapProjectID *int `json:"mapprojectid" gorm:"column:mapprojectid"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
Address1 *string `json:"address1" gorm:"column:address1"`
|
|
City *string `json:"city" gorm:"column:city"`
|
|
State *string `json:"state" gorm:"column:state"`
|
|
Zip *string `json:"zip" gorm:"column:zip"`
|
|
Geometry json.RawMessage `json:"geometry" gorm:"column:geometry"`
|
|
}
|
|
|
|
// Poles struct (exported, full DB mapping)
|
|
type Poles struct {
|
|
GID int `json:"gid" gorm:"primaryKey;column:gid"`
|
|
ID *int `json:"id" gorm:"column:id"`
|
|
MapProjectID *int `json:"mapprojectid" gorm:"column:mapprojectid"`
|
|
Latitude *string `json:"latitude" gorm:"column:latitude"`
|
|
Longitude *string `json:"longitude" gorm:"column:longitude"`
|
|
Custom *int `json:"custom" gorm:"column:custom"`
|
|
Color *string `json:"color" gorm:"column:color"`
|
|
ShapeID *string `json:"shapeid" gorm:"column:shapeid"`
|
|
StyleSize *string `json:"stylesize" gorm:"column:stylesize"`
|
|
Opacity *string `json:"opacity" gorm:"column:opacity"`
|
|
CreatedBy *int `json:"createdby" gorm:"column:createdby"`
|
|
CreatedDate *int `json:"createddate" gorm:"column:createddate"`
|
|
ModifiedBy *int `json:"modifiedby" gorm:"column:modifiedby"`
|
|
ModifiedDate *int `json:"modifieddate" gorm:"column:modifieddate"`
|
|
HistoryID *int `json:"historyid" gorm:"column:historyid"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
Tags *string `json:"tags" gorm:"column:tags"`
|
|
Group1 *string `json:"group1" gorm:"column:group1"`
|
|
Group2 *string `json:"group2" gorm:"column:group2"`
|
|
MRStateID *int `json:"mrstateid" gorm:"column:mrstateid"`
|
|
CommsMRChoiceID *int `json:"commsmrchoiceid" gorm:"column:commsmrchoiceid"`
|
|
PowerMRChoiceID *string `json:"powermrchoiceid" gorm:"column:powermrchoiceid"`
|
|
PoleHeight *string `json:"poleheight" gorm:"column:poleheight"`
|
|
AttachmentHeight *string `json:"attachmentheight" gorm:"column:attachmentheight"`
|
|
MRNotes *string `json:"mrnotes" gorm:"column:mrnotes"`
|
|
Owner *string `json:"owner" gorm:"column:owner"`
|
|
Geom []byte `json:"geom" gorm:"column:geom"`
|
|
}
|
|
|
|
// PolesGeoJSON struct (for geojson response)
|
|
type PolesGeoJSON struct {
|
|
GID int `json:"gid" gorm:"column:gid"`
|
|
ID *int `json:"id" gorm:"column:id"`
|
|
MapProjectID *int `json:"mapprojectid" gorm:"column:mapprojectid"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
Tags *string `json:"tags" gorm:"column:tags"`
|
|
Group1 *string `json:"group1" gorm:"column:group1"`
|
|
Group2 *string `json:"group2" gorm:"column:group2"`
|
|
Owner *string `json:"owner" gorm:"column:owner"`
|
|
PoleHeight *string `json:"poleheight" gorm:"column:poleheight"`
|
|
AttachmentHeight *string `json:"attachmentheight" gorm:"column:attachmentheight"`
|
|
Geometry json.RawMessage `json:"geometry" gorm:"column:geometry"`
|
|
}
|
|
|
|
type AccessPointGeoJSON struct {
|
|
GID int `json:"gid" gorm:"column:gid"`
|
|
ID *int `json:"id" gorm:"column:id"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
MapProjectID *int `json:"mapprojectid" gorm:"column:mapprojectid"`
|
|
Latitude *string `json:"latitude" gorm:"column:latitude"`
|
|
Longitude *string `json:"longitude" gorm:"column:longitude"`
|
|
Manufacturer *string `json:"manufacturer" gorm:"column:manufacturer"`
|
|
Size *string `json:"size" gorm:"column:size"`
|
|
Locked *int `json:"locked" gorm:"column:locked"`
|
|
Description *string `json:"description" gorm:"column:description"`
|
|
AKA *string `json:"aka" gorm:"column:aka"`
|
|
CreatedBy *int `json:"createdby" gorm:"column:createdby"`
|
|
CreatedDate *int `json:"createddate" gorm:"column:createddate"`
|
|
ModifiedBy *string `json:"modifiedby" gorm:"column:modifiedby"`
|
|
ModifiedDate *string `json:"modifieddate" gorm:"column:modifieddate"`
|
|
HistoryID *int `json:"historyid" gorm:"column:historyid"`
|
|
Group1 *string `json:"group1" gorm:"column:group1"`
|
|
Group2 *string `json:"group2" gorm:"column:group2"`
|
|
TypeID *int `json:"typeid" gorm:"column:typeid"`
|
|
StatusID *int `json:"statusid" gorm:"column:statusid"`
|
|
CRMVendorID *string `json:"crmvendorid" gorm:"column:crmvendorid"`
|
|
BillDate *string `json:"billdate" gorm:"column:billdate"`
|
|
Geometry json.RawMessage `json:"geometry" gorm:"column:geometry"` // Changed to json.RawMessage
|
|
}
|
|
|
|
func (AccessPointGeoJSON) TableName() string {
|
|
return "verofy.access_points"
|
|
}
|
|
|
|
type InfoGeoJSON struct {
|
|
ID int `json:"id" gorm:"primaryKey;column:id"`
|
|
Name *string `json:"name" gorm:"column:name"`
|
|
Tags *string `json:"tags" gorm:"column:tags"`
|
|
Description *string `json:"description" gorm:"column:description"`
|
|
Group1 *string `json:"group_1" gorm:"column:group_1"`
|
|
Group2 *string `json:"group_2" gorm:"column:group_2"`
|
|
Geometry json.RawMessage `json:"geometry" gorm:"column:geometry"` // Fixed column name
|
|
}
|
|
|
|
func (InfoGeoJSON) TableName() string {
|
|
return "verofy.Info"
|
|
}
|
|
|
|
type MarketOption struct {
|
|
MapID int `json:"mapid" gorm:"column:mapid"`
|
|
Project string `json:"project" gorm:"column:project"`
|
|
}
|