Docs are not available for mobile use. Please use a desktop computer to view the documentation.
Signal Boundaries
Detected boundaries between distinct periods within individual signals
Purpose
The signal_boundaries
table stores detected boundaries within individual signals that mark transitions between distinct periods or states. These boundaries help identify when a signal changes significantly, indicating shifts in behavior, context, or conditions.
Schema Definition
Field | Type | Description | Constraints |
---|---|---|---|
id | uuid | Unique boundary identifier | Primary key, auto-generated |
userId | uuid | Boundary owner | Foreign key to users.id |
sourceName | varchar(255) | Source of the signal | Not null |
signalName | varchar(255) | Name of the signal | Not null |
startTime | timestamptz | Boundary period start | Not null |
endTime | timestamptz | Boundary period end | Not null |
confidence | real | Detection confidence (0-1) | Not null |
detectionMethod | varchar(100) | Method used for detection | Not null |
boundaryMetadata | jsonb | Additional boundary information | Optional |
createdAt | timestamptz | Record creation timestamp | Auto-generated |
Relationships
References:
users.id
viauserId
- Boundary owner
Indexes
idx_signal_boundary_user_time
- B-tree index on (userId, startTime, endTime) for temporal queriesidx_signal_boundary_source
- B-tree index on (sourceName, signalName) for signal filtering
Detection Methods
Common detection methods include:
episodic_rule
- Rule-based episodic event detectionambient_change
- Statistical change point detection in ambient datamerged
- Combination of multiple detection methodsspeed_threshold
- Speed or rate-of-change based detectiongap_fill
- Filling gaps in data continuity
Usage Examples
Get boundaries for a specific signal
SELECT startTime, endTime, confidence, detectionMethod
FROM signal_boundaries
WHERE userId = 'user-uuid'
AND sourceName = 'fitbit'
AND signalName = 'heart_rate'
ORDER BY startTime;
Find recent high-confidence boundaries
SELECT sourceName, signalName, startTime, endTime, confidence
FROM signal_boundaries
WHERE userId = 'user-uuid'
AND confidence >= 0.8
AND startTime >= NOW() - INTERVAL '24 hours'
ORDER BY confidence DESC, startTime DESC;
Analyze boundary detection patterns
SELECT
sourceName,
signalName,
detectionMethod,
COUNT(*) as boundary_count,
AVG(confidence) as avg_confidence
FROM signal_boundaries
WHERE userId = 'user-uuid'
AND startTime >= NOW() - INTERVAL '30 days'
GROUP BY sourceName, signalName, detectionMethod
ORDER BY boundary_count DESC;
Get boundaries by duration
SELECT
sourceName,
signalName,
startTime,
endTime,
EXTRACT(EPOCH FROM (endTime - startTime))/60 as duration_minutes,
confidence
FROM signal_boundaries
WHERE userId = 'user-uuid'
AND (endTime - startTime) > INTERVAL '1 hour'
ORDER BY duration_minutes DESC;
Find overlapping boundaries
SELECT
a.sourceName as source_a,
a.signalName as signal_a,
b.sourceName as source_b,
b.signalName as signal_b,
GREATEST(a.startTime, b.startTime) as overlap_start,
LEAST(a.endTime, b.endTime) as overlap_end
FROM signal_boundaries a
JOIN signal_boundaries b ON a.userId = b.userId
WHERE a.id != b.id
AND a.userId = 'user-uuid'
AND a.startTime < b.endTime
AND a.endTime > b.startTime
ORDER BY overlap_start;
Get boundary metadata details
SELECT
sourceName,
signalName,
startTime,
detectionMethod,
boundaryMetadata
FROM signal_boundaries
WHERE userId = 'user-uuid'
AND boundaryMetadata IS NOT NULL
ORDER BY startTime DESC;