Docs are not available for mobile use. Please use a desktop computer to view the documentation.
Database Enums
Enumerated types used throughout the database schema
Purpose
This page documents the PostgreSQL enum types defined in the database schema. These enums provide controlled vocabularies and ensure data consistency across related tables.
Enum Definitions
boundary_scope
Defines the scope of boundary detection operations.
Values:
single_signal
- Boundary detection within a single signal typemulti_signal
- Boundary detection across multiple related signalsall_signals
- Boundary detection across all available signals
Used in:
boundary_detections.boundaryScope
detection_method
Specifies the algorithmic method used for boundary detection.
Values:
episodic_rule
- Rule-based detection for episodic eventsambient_change
- Statistical change point detection in ambient datamerged
- Combination of multiple detection methodsspeed_threshold
- Detection based on rate-of-change thresholdsgap_fill
- Detection and filling of data continuity gaps
Used in:
boundary_detections.detectionMethod
detection_status
Tracks the execution status of detection processes.
Values:
pending
- Detection is scheduled but not yet startedcompleted
- Detection finished successfullyfailed
- Detection encountered errors and failed
Used in:
boundary_detection_runs.status
ingestion_status
Tracks the execution status of data ingestion processes.
Values:
pending
- Ingestion is scheduled but not yet startedrunning
- Ingestion is currently in progresscompleted
- Ingestion finished successfullyfailed
- Ingestion encountered errors and failedcancelled
- Ingestion was cancelled before completion
Used in:
ingestion_runs.status
Usage Examples
Query by enum values
-- Find all multi-signal boundary detections
SELECT * FROM boundary_detections
WHERE boundaryScope = 'multi_signal';
-- Get failed ingestion runs
SELECT * FROM ingestion_runs
WHERE status = 'failed';
Count by enum distribution
-- Analyze detection method usage
SELECT detectionMethod, COUNT(*)
FROM boundary_detections
GROUP BY detectionMethod;
-- Check ingestion status distribution
SELECT status, COUNT(*)
FROM ingestion_runs
GROUP BY status;
Filter by multiple enum values
-- Find completed or running ingestions
SELECT * FROM ingestion_runs
WHERE status IN ('completed', 'running');
-- Get ambient change and merged detections
SELECT * FROM boundary_detections
WHERE detectionMethod IN ('ambient_change', 'merged');
Best Practices
- Always use enum values directly - Don’t store enum values as strings in application code
- Handle enum expansion - When adding new enum values, ensure backward compatibility
- Validate in application layer - Check enum values before database operations
- Use meaningful names - Enum values should be self-documenting and consistent
- Consider ordering - Enum values are ordered by definition order, which affects sorting