Docs are not available for mobile use. Please use a desktop computer to view the documentation.
Boundary Detections
Cross-signal boundary detection results and multi-signal analysis
Purpose
The boundary_detections
table stores the results of cross-signal boundary detection analysis. Unlike signal-specific boundaries, these detections identify periods where multiple signals collectively indicate significant transitions or state changes in user behavior or context.
Schema Definition
Field | Type | Description | Constraints |
---|---|---|---|
id | uuid | Unique detection identifier | Primary key, auto-generated |
userId | uuid | Detection owner | Foreign key to users.id |
startTime | timestamptz | Detection period start | Not null |
endTime | timestamptz | Detection period end | Not null |
confidence | real | Detection confidence (0-1) | Not null |
contributingSources | text[] | Sources that contributed to detection | Not null |
detectionMethod | detection_method | Method used for detection | Not null |
boundaryScope | boundary_scope | Scope of boundary detection | Default: ‘all_signals’ |
sourceSignal | varchar(255) | Primary signal for single-signal scope | Optional |
createdAt | timestamptz | Record creation timestamp | Auto-generated |
Relationships
References:
users.id
viauserId
- Detection owner
Indexes
idx_boundary_user_time
- B-tree index on (userId, startTime, endTime) for temporal queriesidx_boundary_scope_signal
- B-tree index on (boundaryScope, sourceSignal) for scope filtering
Enumeration Values
Detection Method
episodic_rule
- Rule-based episodic event detectionambient_change
- Statistical change point detectionmerged
- Combination of multiple methodsspeed_threshold
- Rate-of-change based detectiongap_fill
- Data continuity gap filling
Boundary Scope
single_signal
- Detection within a single signal typemulti_signal
- Detection across multiple related signalsall_signals
- Detection across all available signals
Usage Examples
Get recent cross-signal detections
SELECT startTime, endTime, confidence, contributingSources, detectionMethod
FROM boundary_detections
WHERE userId = 'user-uuid'
AND startTime >= NOW() - INTERVAL '7 days'
ORDER BY confidence DESC, startTime DESC;
Find detections by scope
SELECT
boundaryScope,
sourceSignal,
startTime,
endTime,
confidence,
array_length(contributingSources, 1) as source_count
FROM boundary_detections
WHERE userId = 'user-uuid'
AND boundaryScope = 'multi_signal'
ORDER BY source_count DESC, confidence DESC;
Analyze detection methods effectiveness
SELECT
detectionMethod,
COUNT(*) as detection_count,
AVG(confidence) as avg_confidence,
AVG(EXTRACT(EPOCH FROM (endTime - startTime))/60) as avg_duration_minutes
FROM boundary_detections
WHERE userId = 'user-uuid'
AND startTime >= NOW() - INTERVAL '30 days'
GROUP BY detectionMethod
ORDER BY avg_confidence DESC;
Find high-confidence multi-source detections
SELECT
startTime,
endTime,
confidence,
contributingSources,
array_length(contributingSources, 1) as source_count
FROM boundary_detections
WHERE userId = 'user-uuid'
AND confidence >= 0.8
AND array_length(contributingSources, 1) >= 3
ORDER BY confidence DESC, source_count DESC;
Get detections with specific contributing sources
SELECT startTime, endTime, confidence, contributingSources
FROM boundary_detections
WHERE userId = 'user-uuid'
AND 'fitbit' = ANY(contributingSources)
AND 'location' = ANY(contributingSources)
ORDER BY startTime DESC;
Timeline analysis of detections
SELECT
DATE_TRUNC('day', startTime) as day,
COUNT(*) as detection_count,
AVG(confidence) as avg_confidence,
mode() WITHIN GROUP (ORDER BY detectionMethod) as most_common_method
FROM boundary_detections
WHERE userId = 'user-uuid'
AND startTime >= NOW() - INTERVAL '30 days'
GROUP BY day
ORDER BY day;
Find single-signal focused detections
SELECT
sourceSignal,
startTime,
endTime,
confidence,
detectionMethod
FROM boundary_detections
WHERE userId = 'user-uuid'
AND boundaryScope = 'single_signal'
AND sourceSignal IS NOT NULL
ORDER BY sourceSignal, startTime;