Skip to content

Commit

Permalink
Merge branch 'main' into dexamundsen/snyk-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dexamundsen authored Dec 19, 2024
2 parents 4e1ef94 + 59ec9eb commit a2b6f45
Show file tree
Hide file tree
Showing 20 changed files with 269 additions and 54 deletions.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ gradle.ext {
}

// This line needs to match the VERSION_LINE_MATCH regex in the bump-tag-publish GHA.
gradle.ext.tanagraVersion = "0.0.700-SNAPSHOT"
gradle.ext.tanagraVersion = "0.0.701-SNAPSHOT"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"attribute": "has_pm_data"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "tanagra-has-pm-data",
"displayName": "Has Any Physical Measurements Data",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Physical Measurements",
"tags": null
},
"filterBuilder": "core.PrimaryEntityFilterBuilder",
"plugin": "attribute",
"pluginConfig": null,
"pluginConfigFile": "hasPMData.json",
"modifiers": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"entity": "pregnant",
"valueConfigs": [
{
"attribute": "pregnant_at_enrollment"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "tanagra-pregnant",
"displayName": "Pregnant at enrollment",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Physical Measurements",
"tags": null
},
"filterBuilder": "core.MultiAttributeFilterBuilder",
"plugin": "multiAttribute",
"pluginConfig": null,
"pluginConfigFile": "pregnant.json",
"modifiers": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "tanagra-wheelchair",
"displayName": "Wheelchair user at enrollment",
"isEnabledForCohorts": true,
"isEnabledForDataFeatureSets": false,
"display": {
"category": "Physical Measurements",
"tags": null
},
"filterBuilder": "core.MultiAttributeFilterBuilder",
"plugin": "multiAttribute",
"pluginConfig": null,
"pluginConfigFile": "wheelchair.json",
"modifiers": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"entity": "wheelchair",
"valueConfigs": [
{
"attribute": "wheelchair_at_enrollment"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ SELECT
DISTINCT c.concept_id,
c.concept_name,
c.vocabulary_id,
v.vocabulary_name,
c.concept_code,
'Standard' AS standard_concept
FROM `${omopDataset}.observation` AS o
JOIN `${omopDataset}.concept` AS c ON c.concept_id = o.observation_concept_id
WHERE c.domain_id = 'Observation'
AND o.observation_concept_id != 0
AND c.standard_concept = 'S'
AND c.vocabulary_id != 'PPI'
AND c.concept_class_id != 'Survey'
AND c.concept_class_id != 'Survey'
AND c.concept_id NOT IN (
SELECT DISTINCT observation_concept_id
FROM `${omopDataset}.observation`
WHERE observation_source_concept_id IN (
SELECT DISTINCT concept_id
FROM `${omopDataset}.prep_survey`
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ SELECT p.person_id,
ELSE rc.concept_name
END AS race_concept_name,
p.ethnicity_concept_id,
CASE
WHEN ec.concept_name = 'No matching concept' THEN 'Unknown'
ELSE ec.concept_name
END AS ethnicity_concept_name,
CASE
WHEN ec.concept_name = 'No matching concept' THEN 'Unknown'
ELSE ec.concept_name
END AS ethnicity_concept_name,
p.sex_at_birth_concept_id,
sc.concept_name AS sex_at_birth_concept_name,
p.self_reported_category_concept_id,
Expand All @@ -38,53 +38,63 @@ SELECT p.person_id,
WHEN sl.person_id IS NULL THEN FALSE ELSE TRUE END has_fitbit_sleep_level,
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,
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 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 d.death_date is null THEN FALSE ELSE TRUE END is_deceased
FROM `${omopDataset}.person` p
LEFT JOIN `${omopDataset}.concept` gc ON gc.concept_id = p.gender_concept_id
LEFT JOIN `${omopDataset}.concept` rc ON rc.concept_id = p.race_concept_id
LEFT JOIN `${omopDataset}.concept` ec ON ec.concept_id = p.ethnicity_concept_id
LEFT JOIN `${omopDataset}.concept` sc ON sc.concept_id = p.sex_at_birth_concept_id
LEFT JOIN `${omopDataset}.concept` sr ON sr.concept_id = p.self_reported_category_concept_id
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.activity_summary`) asum ON (p.person_id = asum.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_minute_level`) hrml ON (p.person_id = hrml.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_summary`) hrs ON (p.person_id = hrs.person_id)
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}.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
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.condition_occurrence` as a
LEFT JOIN`${omopDataset}.condition_occurrence_ext` as b on a.condition_occurrence_id = b.condition_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.device_exposure` as a
LEFT JOIN`${omopDataset}.device_exposure_ext` as b on a.device_exposure_id = b.device_exposure_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.drug_exposure` as a
LEFT JOIN`${omopDataset}.drug_exposure_ext` as b on a.drug_exposure_id = b.drug_exposure_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.observation` as a
LEFT JOIN`${omopDataset}.observation_ext` as b on a.observation_id = b.observation_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.procedure_occurrence` as a
LEFT JOIN`${omopDataset}.procedure_occurrence_ext` as b on a.procedure_occurrence_id = b.procedure_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.visit_occurrence` as a
LEFT JOIN`${omopDataset}.visit_occurrence_ext` as b on a.visit_occurrence_id = b.visit_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
) ehr ON (p.person_id = ehr.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)
LEFT JOIN `${omopDataset}.concept` gc ON gc.concept_id = p.gender_concept_id
LEFT JOIN `${omopDataset}.concept` rc ON rc.concept_id = p.race_concept_id
LEFT JOIN `${omopDataset}.concept` ec ON ec.concept_id = p.ethnicity_concept_id
LEFT JOIN `${omopDataset}.concept` sc ON sc.concept_id = p.sex_at_birth_concept_id
LEFT JOIN `${omopDataset}.concept` sr ON sr.concept_id = p.self_reported_category_concept_id
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.activity_summary`) asum ON (p.person_id = asum.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_minute_level`) hrml ON (p.person_id = hrml.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.heart_rate_summary`) hrs ON (p.person_id = hrs.person_id)
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}.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
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.condition_occurrence` as a
LEFT JOIN`${omopDataset}.condition_occurrence_ext` as b on a.condition_occurrence_id = b.condition_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.device_exposure` as a
LEFT JOIN`${omopDataset}.device_exposure_ext` as b on a.device_exposure_id = b.device_exposure_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.drug_exposure` as a
LEFT JOIN`${omopDataset}.drug_exposure_ext` as b on a.drug_exposure_id = b.drug_exposure_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.observation` as a
LEFT JOIN`${omopDataset}.observation_ext` as b on a.observation_id = b.observation_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.procedure_occurrence` as a
LEFT JOIN`${omopDataset}.procedure_occurrence_ext` as b on a.procedure_occurrence_id = b.procedure_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
UNION DISTINCT
SELECT DISTINCT person_id FROM`${omopDataset}.visit_occurrence` as a
LEFT JOIN`${omopDataset}.visit_occurrence_ext` as b on a.visit_occurrence_id = b.visit_occurrence_id
WHERE lower(b.src_id) like 'ehr site%'
) ehr ON (p.person_id = ehr.person_id)
LEFT JOIN (SELECT DISTINCT person_id FROM `${omopDataset}.measurement`
WHERE measurement_source_concept_id in (
SELECT concept_id FROM `${omopDataset}.concept`
WHERE vocabulary_id = 'PPI'
AND concept_class_id = 'Clinical Observation'
AND domain_id = 'Measurement'
)
) pm ON (p.person_id = pm.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 @@ -59,6 +59,7 @@
{ "name": "has_fitbit", "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": "is_deceased", "dataType": "BOOLEAN", "isSuppressedForExport": true }
],
"idAttribute": "id",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELECT
mo.measurement_id,
mo.person_id,
(CASE WHEN mo.measurement_concept_id IS NULL THEN 0 ELSE mo.measurement_concept_id END) AS measurement_concept_id,
mc.concept_name AS measurement_concept_name,
mo.measurement_datetime,
mo.value_as_number,
mo.value_as_concept_id,
evc.concept_name AS value_as_concept_name,
mo.unit_concept_id,
uc.concept_name AS unit_concept_name,
mo.measurement_source_value,
mo.measurement_source_concept_id,
CAST(FLOOR(TIMESTAMP_DIFF(mo.measurement_datetime, p.birth_datetime, DAY) / 365.25) AS INT64) AS age_at_occurrence,
mo.visit_occurrence_id,
vo.visit_concept_id,
vc.concept_name AS visit_concept_name,
true as pregnant_at_enrollment
FROM `${omopDataset}.measurement` AS mo
JOIN `${omopDataset}.person` AS p ON p.person_id = mo.person_id
LEFT JOIN `${omopDataset}.concept` AS mc ON mc.concept_id = mo.measurement_concept_id
LEFT JOIN `${omopDataset}.concept` AS evc ON evc.concept_id = mo.value_as_concept_id
LEFT JOIN `${omopDataset}.concept` AS uc ON uc.concept_id = mo.unit_concept_id
LEFT JOIN `${omopDataset}.visit_occurrence` AS vo ON vo.visit_occurrence_id = mo.visit_occurrence_id
LEFT JOIN `${omopDataset}.concept` AS vc ON vc.concept_id = vo.visit_concept_id
WHERE mo.measurement_source_concept_id = 903120
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "pregnant",
"allInstancesSqlFile": "all.sql",
"attributes": [
{ "name": "id", "dataType": "INT64", "valueFieldName": "measurement_id" },
{ "name": "person_id", "dataType": "INT64" },
{ "name": "measurement", "dataType": "INT64", "valueFieldName": "measurement_concept_id", "displayFieldName": "measurement_concept_name" },
{ "name": "date", "dataType": "TIMESTAMP", "valueFieldName": "measurement_datetime" },
{ "name": "value_numeric", "dataType": "DOUBLE", "valueFieldName": "value_as_number", "isComputeDisplayHint": true, "displayHintRangeMin": 0, "displayHintRangeMax": 100 },
{ "name": "value_enum", "dataType": "INT64", "valueFieldName": "value_as_concept_id", "displayFieldName": "value_as_concept_name" },
{ "name": "unit", "dataType": "INT64", "valueFieldName": "unit_concept_id", "displayFieldName": "unit_concept_name" },
{ "name": "source_value", "dataType": "STRING", "valueFieldName": "measurement_source_value" },
{ "name": "source_criteria_id", "dataType": "INT64", "valueFieldName": "measurement_source_concept_id" },
{ "name": "age_at_occurrence", "dataType": "INT64", "isComputeDisplayHint": true },
{ "name": "visit_occurrence_id", "dataType": "INT64" },
{ "name": "visit_type", "dataType": "INT64", "valueFieldName": "visit_concept_id", "displayFieldName": "visit_concept_name", "isComputeDisplayHint": true },
{ "name": "pregnant_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true }
],
"idAttribute": "id"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELECT
mo.measurement_id,
mo.person_id,
(CASE WHEN mo.measurement_concept_id IS NULL THEN 0 ELSE mo.measurement_concept_id END) AS measurement_concept_id,
mc.concept_name AS measurement_concept_name,
mo.measurement_datetime,
mo.value_as_number,
mo.value_as_concept_id,
evc.concept_name AS value_as_concept_name,
mo.unit_concept_id,
uc.concept_name AS unit_concept_name,
mo.measurement_source_value,
mo.measurement_source_concept_id,
CAST(FLOOR(TIMESTAMP_DIFF(mo.measurement_datetime, p.birth_datetime, DAY) / 365.25) AS INT64) AS age_at_occurrence,
mo.visit_occurrence_id,
vo.visit_concept_id,
vc.concept_name AS visit_concept_name,
true as wheelchair_at_enrollment
FROM `${omopDataset}.measurement` AS mo
JOIN `${omopDataset}.person` AS p ON p.person_id = mo.person_id
LEFT JOIN `${omopDataset}.concept` AS mc ON mc.concept_id = mo.measurement_concept_id
LEFT JOIN `${omopDataset}.concept` AS evc ON evc.concept_id = mo.value_as_concept_id
LEFT JOIN `${omopDataset}.concept` AS uc ON uc.concept_id = mo.unit_concept_id
LEFT JOIN `${omopDataset}.visit_occurrence` AS vo ON vo.visit_occurrence_id = mo.visit_occurrence_id
LEFT JOIN `${omopDataset}.concept` AS vc ON vc.concept_id = vo.visit_concept_id
WHERE mo.measurement_source_concept_id = 903111
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "wheelchair",
"allInstancesSqlFile": "all.sql",
"attributes": [
{ "name": "id", "dataType": "INT64", "valueFieldName": "measurement_id" },
{ "name": "person_id", "dataType": "INT64" },
{ "name": "measurement", "dataType": "INT64", "valueFieldName": "measurement_concept_id", "displayFieldName": "measurement_concept_name" },
{ "name": "date", "dataType": "TIMESTAMP", "valueFieldName": "measurement_datetime" },
{ "name": "value_numeric", "dataType": "DOUBLE", "valueFieldName": "value_as_number", "isComputeDisplayHint": true, "displayHintRangeMin": 0, "displayHintRangeMax": 100 },
{ "name": "value_enum", "dataType": "INT64", "valueFieldName": "value_as_concept_id", "displayFieldName": "value_as_concept_name" },
{ "name": "unit", "dataType": "INT64", "valueFieldName": "unit_concept_id", "displayFieldName": "unit_concept_name" },
{ "name": "source_value", "dataType": "STRING", "valueFieldName": "measurement_source_value" },
{ "name": "source_criteria_id", "dataType": "INT64", "valueFieldName": "measurement_source_concept_id" },
{ "name": "age_at_occurrence", "dataType": "INT64", "isComputeDisplayHint": true },
{ "name": "visit_occurrence_id", "dataType": "INT64" },
{ "name": "visit_type", "dataType": "INT64", "valueFieldName": "visit_concept_id", "displayFieldName": "visit_concept_name", "isComputeDisplayHint": true },
{ "name": "wheelchair_at_enrollment", "dataType": "BOOLEAN", "isSuppressedForExport": true }
],
"idAttribute": "id"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "pregnantPerson",
"groupEntity": "person",
"itemsEntity": "pregnant",
"foreignKeyAttributeItemsEntity": "person_id"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "wheelchairPerson",
"groupEntity": "person",
"itemsEntity": "wheelchair",
"foreignKeyAttributeItemsEntity": "person_id"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"aouRT/bmi",
"aouRT/waistCircumference",
"aouRT/hipCircumference",
"aouRT/wheelchair",
"aouRT/pregnant",

"aouRT/surveyBasics",
"aouRT/surveyLifestyle",
Expand Down Expand Up @@ -77,7 +79,9 @@
"aouRT/weightPerson",
"aouRT/bmiPerson",
"aouRT/waistCircumferencePerson",
"aouRT/hipCircumferencePerson"
"aouRT/hipCircumferencePerson",
"aouRT/wheelchairPerson",
"aouRT/pregnantPerson"
],
"criteriaOccurrenceEntityGroups": [
"aouRT/conditionPerson",
Expand Down Expand Up @@ -143,13 +147,16 @@
"aouCT/longReadWGS",
"aouCT/globalDiversityArray",
"aouCT/structuralVariants",
"aouRT/hasPMData",
"aouRT/bloodPressure",
"aouRT/heartRate",
"aouRT/height",
"aouRT/weight",
"aouRT/bmi",
"aouRT/waistCircumference",
"aouRT/hipCircumference",
"aouRT/wheelchair",
"aouRT/pregnant",
"aouRT/outputUnfiltered",
"aouRT/surveyBasics",
"aouRT/surveyLifestyle",
Expand Down
Loading

0 comments on commit a2b6f45

Please sign in to comment.