Skip to content

Commit

Permalink
Freemabd/dt 941 (#1111)
Browse files Browse the repository at this point in the history
* DT-941 adding config for fitbit device

* DT-941 fixing config for CT
  • Loading branch information
freemabd authored Dec 20, 2024
1 parent c717c5f commit 20f73ed
Show file tree
Hide file tree
Showing 37 changed files with 188 additions and 168 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit",
"displayName": "Fitbit data",
"displayName": "Has Any Fitbit Data",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-activity-summary",
"displayName": "Fitbit Activity Summary",
"displayName": "Has Fitbit Activity Summary",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"attribute": "has_fitbit_device"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "tanagra-fitbit-device",
"displayName": "Has Fitbit Device",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
"plugin": "attribute",
"pluginConfig": null,
"pluginConfigFile": "fitbitDevice.json",
"modifiers": null
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-heart-rate-level",
"displayName": "Fitbit Heart Rate Minute Level",
"displayName": "Has Fitbit Heart Rate Minute Level",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-heart-rate-summary",
"displayName": "Fitbit Heart Rate Summary",
"displayName": "Has Fitbit Heart Rate Summary",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"attribute": "has_fitbit_plus_device"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "tanagra-fitbit-plus-device",
"displayName": "Has Any Fitbit Data Plus Device",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
"plugin": "attribute",
"pluginConfig": null,
"pluginConfigFile": "fitbitPlusDevice.json",
"modifiers": null
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-sleep-daily-summary",
"displayName": "Fitbit Sleep Daily Summary",
"displayName": "Has Fitbit Sleep Daily Summary",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-sleep-level",
"displayName": "Fitbit Sleep Level",
"displayName": "Has Fitbit Sleep Level",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tanagra-fitbit-steps-intraday",
"displayName": "Fitbit Steps Intraday",
"displayName": "Has Fitbit Steps Intraday",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"entity": "pregnant",
"valueConfigs": [
{
"attribute": "pregnant_at_enrollment"
}
]
"attribute": "has_pregnant_at_enrollment"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"category": "Physical Measurements",
"tags": null
},
"filterBuilder": "core.MultiAttributeFilterBuilder",
"plugin": "multiAttribute",
"filterBuilder": "core.PrimaryEntityFilterBuilder",
"plugin": "attribute",
"pluginConfig": null,
"pluginConfigFile": "pregnant.json",
"modifiers": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Fitbit",
"category": "Wearables",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"category": "Physical Measurements",
"tags": null
},
"filterBuilder": "core.MultiAttributeFilterBuilder",
"plugin": "multiAttribute",
"filterBuilder": "core.PrimaryEntityFilterBuilder",
"plugin": "attribute",
"pluginConfig": null,
"pluginConfigFile": "wheelchair.json",
"modifiers": null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"entity": "wheelchair",
"valueConfigs": [
{
"attribute": "wheelchair_at_enrollment"
}
]
"attribute": "has_wheelchair_at_enrollment"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "_fitbit_actvity_summary_id",
"name": "_fitbit_activity_summary_id",
"displayName": "Fitbit Activity Summary",
"criteriaSelector": "outputUnfiltered",
"pluginDataFile": "fitbitActvitySummaryId.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"entities": [
"wearableDevice"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "_fitbit_device_id",
"displayName": "Fitbit Device",
"criteriaSelector": "outputUnfiltered",
"pluginDataFile": "fitbitDeviceId.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ SELECT p.person_id,
WHEN sds.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_sleep_daily_summary,
CASE
WHEN sl.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_sleep_level,
CASE
WHEN dev.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_device,
CASE
WHEN asum.person_id IS NULL AND hrml.person_id IS NULL AND hrs.person_id IS NULL
AND si.person_id IS NULL AND sds.person_id IS NULL AND sl.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit,
CASE
WHEN asum.person_id IS NULL AND hrml.person_id IS NULL AND hrs.person_id IS NULL
AND si.person_id IS NULL AND sds.person_id IS NULL AND sl.person_id IS NULL AND dev.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_plus_device,
CASE
WHEN wgv.sample_name IS NULL THEN FALSE ELSE TRUE END has_whole_genome_variant,
CASE
Expand All @@ -71,6 +76,10 @@ SELECT p.person_id,
WHEN ehr.person_id IS NULL THEN FALSE ELSE TRUE END has_ehr_data,
CASE
WHEN pm.person_id IS NULL THEN FALSE ELSE TRUE END has_pm_data,
CASE
WHEN pregnant.person_id IS NULL THEN FALSE ELSE TRUE END has_pregnant_at_enrollment,
CASE
WHEN wheelchair.person_id IS NULL THEN FALSE ELSE TRUE END has_wheelchair_at_enrollment,
CASE
WHEN d.death_date is null THEN FALSE ELSE TRUE END is_deceased
FROM `${omopDataset}.person` p
Expand All @@ -85,6 +94,7 @@ LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_summary`) h
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.steps_intraday`) si ON (p.person_id = si.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.sleep_daily_summary`) sds ON (p.person_id = sds.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.sleep_level`) sl ON (p.person_id = sl.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.device`) dev ON (p.person_id = dev.person_id)
LEFT JOIN (SELECT DISTINCT sample_name FROM `${omopDataset}.prep_wgs_metadata`) wgv ON (CAST(p.person_id AS STRING) = wgv.sample_name)
LEFT JOIN (SELECT DISTINCT sample_name FROM `${omopDataset}.prep_microarray_metadata`) mad ON (CAST(p.person_id AS STRING) = mad.sample_name)
LEFT JOIN (SELECT DISTINCT sample_name FROM `${omopDataset}.prep_longreads_metadata`) lrwgv ON (CAST(p.person_id AS STRING) = lrwgv.sample_name)
Expand Down Expand Up @@ -126,5 +136,13 @@ LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.measurement`
AND domain_id = 'Measurement'
)
) pm ON (p.person_id = pm.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.observation`
WHERE observation_source_concept_id = 903120
AND value_as_concept_id = 45877994
) pregnant ON (p.person_id = pregnant.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.measurement`
WHERE measurement_source_concept_id = 903111
AND value_as_concept_id = 4023190
) wheelchair ON (p.person_id = wheelchair.person_id)
LEFT JOIN (SELECT person_id, max(death_date) as death_date FROM `${omopDataset}.death` GROUP BY person_id) d
ON (p.person_id = d.person_id)
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@
{ "name": "has_fitbit_sleep_daily_summary", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_sleep_level", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_device", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_plus_device", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_array_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_whole_genome_variant", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_lr_whole_genome_variant", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_structural_variant_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_wear_consent", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_ehr_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_pm_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_pregnant_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_wheelchair_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "is_deceased", "dataType": "BOOLEAN", "isSuppressedForExport": true }
],
"idAttribute": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,24 @@ SELECT p.person_id,
WHEN sds.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_sleep_daily_summary,
CASE
WHEN sl.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_sleep_level,
CASE
WHEN dev.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_device,
CASE
WHEN asum.person_id IS NULL AND hrml.person_id IS NULL AND hrs.person_id IS NULL
AND si.person_id IS NULL AND sds.person_id IS NULL AND sl.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit,
CASE
WHEN asum.person_id IS NULL AND hrml.person_id IS NULL AND hrs.person_id IS NULL
AND si.person_id IS NULL AND sds.person_id IS NULL AND sl.person_id IS NULL AND dev.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_plus_device,
CASE
WHEN ws.person_id IS NULL THEN FALSE ELSE TRUE END has_wear_consent,
CASE
WHEN ehr.person_id IS NULL THEN FALSE ELSE TRUE END has_ehr_data,
CASE
WHEN pm.person_id IS NULL THEN FALSE ELSE TRUE END has_pm_data,
CASE
WHEN pregnant.person_id IS NULL THEN FALSE ELSE TRUE END has_pregnant_at_enrollment,
CASE
WHEN wheelchair.person_id IS NULL THEN FALSE ELSE TRUE END has_wheelchair_at_enrollment,
CASE
WHEN d.death_date is null THEN FALSE ELSE TRUE END is_deceased
FROM `${omopDataset}.person` p
Expand All @@ -73,6 +82,7 @@ LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_summary`) h
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.steps_intraday`) si ON (p.person_id = si.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.sleep_daily_summary`) sds ON (p.person_id = sds.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.sleep_level`) sl ON (p.person_id = sl.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.device`) dev ON (p.person_id = dev.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.wear_study`) ws ON (p.person_id = ws.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM`${omopDataset}.measurement` as a
LEFT JOIN`${omopDataset}.measurement_ext` as b on a.measurement_id = b.measurement_id
Expand Down Expand Up @@ -110,5 +120,13 @@ LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.measurement`
AND domain_id = 'Measurement'
)
) pm ON (p.person_id = pm.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.observation`
WHERE observation_source_concept_id = 903120
AND value_as_concept_id = 45877994
) pregnant ON (p.person_id = pregnant.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.measurement`
WHERE measurement_source_concept_id = 903111
AND value_as_concept_id = 4023190
) wheelchair ON (p.person_id = wheelchair.person_id)
LEFT JOIN (SELECT person_id, max(death_date) as death_date FROM `${omopDataset}.death` GROUP BY person_id) d
ON (p.person_id = d.person_id)
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@
{ "name": "has_fitbit_sleep_daily_summary", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_sleep_level", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_device", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_fitbit_plus_device", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_wear_consent", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_ehr_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_pm_data", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_pregnant_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "has_wheelchair_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true },
{ "name": "is_deceased", "dataType": "BOOLEAN", "isSuppressedForExport": true }
],
"idAttribute": "id",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SELECT
row_id,
person_id,
device_id,
device_date,
battery,
battery_level,
device_version,
device_type,
TIMESTAMP(last_sync_time) AS last_sync_time,
src_id
FROM `${omopDataset}.device`
Loading

0 comments on commit 20f73ed

Please sign in to comment.