Documentation
¶
Index ¶
- Variables
- func LoggingMiddleware(next http.Handler) http.Handler
- func ValidateQualityLabel(label string) bool
- func ValidateUserLabel(label string) bool
- type Capabilities
- type CapabilitiesProvider
- type DetectionLabel
- type LidarCapability
- type LidarLabel
- type LidarLabelAPI
- type QualityFlag
- type ReportRequest
- type Server
- type TransitController
Constants ¶
This section is empty.
Variables ¶
var AllDetectionLabels = []DetectionLabel{ LabelCar, LabelBus, LabelPedestrian, LabelCyclist, LabelBird, LabelNoise, LabelDynamic, }
AllDetectionLabels is the canonical list of valid detection labels. Validation maps and doc-generation scripts should derive from this slice.
var AllQualityFlags = []QualityFlag{ QualityGood, QualityNoisy, QualityJitterVelocity, QualityJitterHeading, QualityMerge, QualitySplit, QualityTruncated, QualityDisconnected, }
AllQualityFlags is the canonical list of valid quality flags.
Functions ¶
func LoggingMiddleware ¶
LoggingMiddleware logs method, path, query, status, and duration to debug log
func ValidateQualityLabel ¶ added in v0.5.0
ValidateQualityLabel checks if a quality label string is valid. Supports both single labels and comma-separated multi-select flags. Returns false for empty strings.
func ValidateUserLabel ¶ added in v0.5.0
ValidateUserLabel checks if a user label is valid according to the enum. Returns false for empty strings (not in the valid map). Note: Empty strings may still be acceptable as optional values in the database, but they are not considered valid enum values.
Types ¶
type Capabilities ¶ added in v0.5.0
type Capabilities struct {
Radar bool `json:"radar"`
Lidar LidarCapability `json:"lidar"`
LidarSweep bool `json:"lidar_sweep"`
}
Capabilities is the JSON shape returned by /api/capabilities.
type CapabilitiesProvider ¶ added in v0.5.0
type CapabilitiesProvider interface {
Capabilities() Capabilities
}
CapabilitiesProvider reports sensor availability at runtime. Implementations live outside the api package so the server carries no direct dependency on LiDAR internals.
type DetectionLabel ¶ added in v0.5.0
type DetectionLabel string
DetectionLabel is a human-assigned classification label (what is the object?). Must stay in sync with l6objects.ObjectClass constants, Svelte DetectionLabel, and Swift classificationLabels.
const ( LabelCar DetectionLabel = "car" LabelBus DetectionLabel = "bus" LabelPedestrian DetectionLabel = "pedestrian" LabelCyclist DetectionLabel = "cyclist" LabelBird DetectionLabel = "bird" LabelNoise DetectionLabel = "noise" LabelDynamic DetectionLabel = "dynamic" )
v0.5.0 ships 7 active detection labels. Truck and motorcyclist are reserved for future use (v0.6+).
type LidarCapability ¶ added in v0.5.0
type LidarCapability struct {
Enabled bool `json:"enabled"`
State string `json:"state"` // "disabled", "starting", "ready", "error"
}
LidarCapability describes the runtime state of the LiDAR subsystem.
type LidarLabel ¶ added in v0.5.0
type LidarLabel struct {
LabelID string `json:"label_id"`
ReplayCaseID *string `json:"replay_case_id,omitempty"`
RunID *string `json:"run_id,omitempty"`
TrackID string `json:"track_id"`
ClassLabel string `json:"class_label"`
StartTimestampNs int64 `json:"start_timestamp_ns"`
EndTimestampNs *int64 `json:"end_timestamp_ns,omitempty"`
Confidence *float32 `json:"confidence,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
CreatedAtNs int64 `json:"created_at_ns"`
UpdatedAtNs *int64 `json:"updated_at_ns,omitempty"`
Notes *string `json:"notes,omitempty"`
SourceFile *string `json:"source_file,omitempty"`
}
LidarLabel is a replay-owned free-form annotation. The public API keeps the legacy route and label_id naming, but persistence now lives on lidar_replay_annotations.
type LidarLabelAPI ¶ added in v0.5.0
type LidarLabelAPI struct {
// contains filtered or unexported fields
}
LidarLabelAPI provides HTTP handlers for label management.
func NewLidarLabelAPI ¶ added in v0.5.0
func NewLidarLabelAPI(db sqlite.DBClient) *LidarLabelAPI
NewLidarLabelAPI creates a new label API instance.
func (*LidarLabelAPI) RegisterRoutes ¶ added in v0.5.0
func (api *LidarLabelAPI) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers label API routes on the provided mux.
type QualityFlag ¶ added in v0.5.0
type QualityFlag string
QualityFlag is a track quality attribute (multi-select, comma-separated). Describes properties of the track rather than what the object is.
const ( QualityGood QualityFlag = "good" QualityNoisy QualityFlag = "noisy" QualityJitterVelocity QualityFlag = "jitter_velocity" QualityJitterHeading QualityFlag = "jitter_heading" QualityMerge QualityFlag = "merge" QualitySplit QualityFlag = "split" QualityTruncated QualityFlag = "truncated" QualityDisconnected QualityFlag = "disconnected" )
type ReportRequest ¶
type ReportRequest struct {
SiteID *int `json:"site_id"` // Optional: use site configuration
StartDate string `json:"start_date"` // YYYY-MM-DD format
EndDate string `json:"end_date"` // YYYY-MM-DD format
CompareStart string `json:"compare_start_date"` // Optional: comparison start date (YYYY-MM-DD)
CompareEnd string `json:"compare_end_date"` // Optional: comparison end date (YYYY-MM-DD)
Timezone string `json:"timezone"` // e.g., "US/Pacific"
Units string `json:"units"` // "mph" or "kph"
Group string `json:"group"` // e.g., "1h", "4h"
Source string `json:"source"` // "radar_objects" or "radar_data_transits"
CompareSource string `json:"compare_source"` // Optional: source for comparison period (defaults to Source)
MinSpeed float64 `json:"min_speed"` // minimum speed filter
BoundaryThreshold int `json:"boundary_threshold"` // filter boundary hours with < N samples (default: 5)
Histogram bool `json:"histogram"` // whether to generate histogram
HistBucketSize float64 `json:"hist_bucket_size"` // histogram bucket size
HistMax float64 `json:"hist_max"` // histogram max value
// These can be overridden if site_id is not provided
Location string `json:"location"` // site location
Surveyor string `json:"surveyor"` // surveyor name
Contact string `json:"contact"` // contact info
SpeedLimit int `json:"speed_limit"` // posted speed limit
SiteDescription string `json:"site_description"` // site description
}
ReportRequest represents the JSON payload for report generation
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SetCapabilitiesProvider ¶ added in v0.5.0
func (s *Server) SetCapabilitiesProvider(cp CapabilitiesProvider)
SetCapabilitiesProvider sets the provider that reports which sensors are active at runtime. When nil, the capabilities endpoint returns a radar-only default.
func (*Server) SetTransitController ¶
func (s *Server) SetTransitController(tc TransitController)
SetTransitController sets the transit controller for the server. This allows the API to provide UI controls for the transit worker.
func (*Server) Start ¶
Note: Start retrieves the mux by calling s.ServeMux(). ServeMux() returns the Server's stored *http.ServeMux (creating and storing it on first call). Callers are therefore free to call s.ServeMux() and register additional admin/diagnostic routes before invoking Start — those routes will be preserved and served. This avoids losing preconfigured routes when starting the server.
type TransitController ¶
type TransitController interface {
IsEnabled() bool
SetEnabled(enabled bool)
TriggerManualRun()
TriggerFullHistoryRun()
GetStatus() db.TransitStatus
}
TransitController is an interface for controlling the transit worker. This allows the API server to toggle the worker without direct coupling.