Table Column expression

Your Query Instruction can pull data from Junction summary and timeseries resources through Table Column expressions.

Each Table Column expression can select one column (a field) of the table (the Vital resource). You can use multiple Table Column expressions to select multiple columns in the same query.

Cross-table query instruction is not supported — you cannot mix Table Column expressions from different tables in the same query instruction.

Column expressions for Electrocardiogram, Sleep Cycle, Menstrual Cycle and lab testing biomarkers are planned to be introduced in the future.

Summaries

TablePython DSLJSON DSL
Activity daily summary
activity
Activity.col("$1"){ "activity": "$1" }
Body summary
body
Body.col("$1"){ "body": "$1" }
Sleep summary
sleep
Sleep.col("$1"){ "sleep": "$1" }
Workout summary
workout
Workout.col("$1"){ "workout": "$1" }
Meal summary
meal
Meal.col("$1"){ "meal": "$1" }

Timeseries

TablePython DSLJSON DSL
Timeseries Resource fieldsTimeseries.col("$1").field("$2"){ "timeseries": "$1", "field": "$2"}

Source Column expression

You can use a Source Column expression to refer to Data Source fields common to Junction resources.

Note that some Source Column expression may not be valid in the implicit query context. For example, source_sport is not a valid Source Column expression in a query that is selecting from the Sleep resource.

If both the Provider and Source Type Source Columns are present in the Group By clause, the implicit Data Prioritization behaviour would be disabled.

ColumnPython DSLJSON DSLAvailable in
ProviderSource.col("source_provider"){ "source": "source_provider" }All Tables
Source TypeSource.col("source_type"){ "source": "source_type" }All Tables
Source App IDSource.col("source_app_id"){ "source": "source_app_id" }All summary tables
Workout IDSource.col("source_workout_id"){ "source": "source_workout_id"}Workout Stream timeseries only
SportSource.col("source_sport"){ "source": "source_sport" }Workout Stream timeseries only

Index Column expression

Each Vital resource has a primary datetime index. Your Query Instruction can reference this datetime index using the special Index Column expression:

TableIndexPython DSLJSON DSL
Activity daily summary
activity
Calendar dateActivity.index(){ "index": "activity" }
Body summary
body
Measurement datetimeBody.index(){ "index": "body" }
Sleep summary
sleep
Session end datetimeSleep.index(){ "index": "sleep" }
Workout summary
workout
Session start datetimeWorkout.index(){ "index": "workout" }

Group Key Column expression

When your Query Instruction uses the group_by clause, each expression in the group_by clause creates a temporary Group Key Column (group_key.$OFFSET). These temporary columns are then used to facilitate the data grouping and aggregation as specified by your Query Instruction.

You can refer to these columns using the special Group Key Column expression:

Group Key ColumnsPython DSLJSON DSL
Allgroup_key("*"){ "group_key": "*" }
The $N-th keygroup_key($N){ "group_key": $N }