HealthMetricAggregations table

The HealthMetricAggregations table in the FitStack - V2 schema has 25 columns, with 1 foreign key to Users.

Rollups over DeviceHealthData. Composite PK `(Id, IntervalStart)`. **Prefer serving coaches from here, not from DeviceHealthData.** An aggregate is what a coach actually needs, and it leaks far less than raw per-sample data — a good default for the `activity.summary` scope.

Columns (25)

Columns of the HealthMetricAggregations table
ColumnTypeConstraintsDescription
Iduuidnot null
IntervalStarttimestamp with time zonenot null
IntervalEndtimestamp with time zonenot null
UserIdtextnot null, references Users.Id
MetricTypeintegernot null
Unitintegernot null
Intervalintegernot null`TimeInterval`.
MinValuenumeric
MaxValuenumeric
AvgValuenumeric
SumValuenumeric
FirstValuenumeric
LastValuenumeric
TrendValuenumeric
MedianValuenumeric
StandardDeviationnumeric
DataPointCountintegernot null
FirstDataPointTimetimestamp with time zone
LastDataPointTimetimestamp with time zone
IsCompletebooleannot null
LastComputedAttimestamp with time zonenot null
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp with time zone

Indexes (1)

  • (UserId, MetricType, IntervalStart) (IX_HealthMetricAggregations_User_Metric_Start)

Relationships

  • HealthMetricAggregations.UserId references Users.Id