Skip to content

Commit

Permalink
Merge pull request #524 from OHDSI/gender_grp_meas_unit_test
Browse files Browse the repository at this point in the history
Gender checks that use descendant concepts added + measurement unit pairs cleaned up
  • Loading branch information
dimshitc authored Feb 15, 2024
2 parents 1c48fcb + 967c3a7 commit f5563e8
Show file tree
Hide file tree
Showing 10 changed files with 1,680 additions and 7,039 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ Suggests:
R.utils
Remotes:
ohdsi/Eunomia
RoxygenNote: 7.2.2
RoxygenNote: 7.2.3
Encoding: UTF-8
27 changes: 25 additions & 2 deletions R/evaluateThresholds.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,29 @@
checkResults[i, ]$cdmFieldName
)
} else if (checkResults[i, ]$checkLevel == "CONCEPT") {
if (is.na(checkResults[i, ]$unitConceptId)) {
if (is.na(checkResults[i, ]$unitConceptId) &&
grepl(",", checkResults[i, ]$conceptId)) {
thresholdFilter <- sprintf(
"conceptChecks$%s[conceptChecks$cdmTableName == '%s' &
conceptChecks$cdmFieldName == '%s' &
conceptChecks$conceptId == '%s']",
thresholdField,
checkResults[i, ]$cdmTableName,
checkResults[i, ]$cdmFieldName,
checkResults[i, ]$conceptId
)
notesFilter <- sprintf(
"conceptChecks$%s[conceptChecks$cdmTableName == '%s' &
conceptChecks$cdmFieldName == '%s' &
conceptChecks$conceptId == '%s']",
notesField,
checkResults[i, ]$cdmTableName,
checkResults[i, ]$cdmFieldName,
checkResults[i, ]$conceptId
)
}
else if (is.na(checkResults[i, ]$unitConceptId) &&
!grepl(",", checkResults[i, ]$conceptId)) {
thresholdFilter <- sprintf(
"conceptChecks$%s[conceptChecks$cdmTableName == '%s' &
conceptChecks$cdmFieldName == '%s' &
Expand All @@ -97,7 +119,8 @@
checkResults[i, ]$cdmFieldName,
checkResults[i, ]$conceptId
)
} else {
}
else {
thresholdFilter <- sprintf(
"conceptChecks$%s[conceptChecks$cdmTableName == '%s' &
conceptChecks$cdmFieldName == '%s' &
Expand Down
9 changes: 5 additions & 4 deletions inst/csv/OMOP_CDMv5.2_Check_Descriptions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ FIELD,plausibleValueHigh,The number and percent of records with a value in the @
FIELD,plausibleTemporalAfter,The number and percent of records with a value in the @cdmFieldName field of the @cdmTableName that occurs prior to the date in the @plausibleTemporalAfterFieldName field of the @plausibleTemporalAfterTableName table.,Verification,Plausibility,Temporal,field_plausible_temporal_after.sql,plausibleTemporalAfter=='Yes'
FIELD,plausibleDuringLife,"If yes, the number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs after death.",Verification,Plausibility,Temporal,field_plausible_during_life.sql,plausibleDuringLife=='Yes'
FIELD,withinVisitDates,The number and percent of records not within one week on either side of the corresponding visit occurrence start and end date,Verification,Conformance,,field_within_visit_dates.sql,withinVisitDates=='Yes'
FIELD,plausibleAfterBirth,"The number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs prior to birth.",Verification,Plausibility,Temporal,field_plausible_after_birth.sql,plausibleAfterBirth=='Yes'
FIELD,plausibleBeforeDeath,"The number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs after death.",Verification,Plausibility,Temporal,field_plausible_before_death.sql,plausibleBeforeDeath=='Yes'
FIELD,plausibleStartBeforeEnd,"The number and percent of records with a value in the @cdmFieldName field of the @cdmTableName that occurs after the date in the @plausibleStartBeforeEndFieldName.",Verification,Plausibility,Temporal,field_plausible_start_before_end.sql,plausibleStartBeforeEnd=='Yes'
FIELD,plausibleAfterBirth,The number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs prior to birth.,Verification,Plausibility,Temporal,field_plausible_after_birth.sql,plausibleAfterBirth=='Yes'
FIELD,plausibleBeforeDeath,The number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs after death.,Verification,Plausibility,Temporal,field_plausible_before_death.sql,plausibleBeforeDeath=='Yes'
FIELD,plausibleStartBeforeEnd,The number and percent of records with a value in the @cdmFieldName field of the @cdmTableName that occurs after the date in the @plausibleStartBeforeEndFieldName.,Verification,Plausibility,Temporal,field_plausible_start_before_end.sql,plausibleStartBeforeEnd=='Yes'
CONCEPT,plausibleGender,"For a CONCEPT_ID @conceptId (@conceptName), the number and percent of records associated with patients with an implausible gender (correct gender = @plausibleGender).",Validation,Plausibility,Atemporal,concept_plausible_gender.sql,plausibleGender!=''
CONCEPT,plausibleUnitConceptIds,"The number and percent of records for a given CONCEPT_ID @conceptId (@conceptName) with implausible units (i.e., UNIT_CONCEPT_ID NOT IN (@plausibleUnitConceptIds)).",Verification,Plausibility,Atemporal,concept_plausible_unit_concept_ids.sql,plausibleUnitConceptIdsThreshold!=''
CONCEPT,plausibleGenderUseDescendants,"For descendants of CONCEPT_ID @conceptId (@conceptName), the number and percent of records associated with patients with an implausible gender (correct gender = @plausibleGenderUseDescendants).",Validation,Plausibility,Atemporal,concept_plausible_gender_use_descendants.sql,plausibleGenderUseDescendants!=''
CONCEPT,plausibleUnitConceptIds,"The number and percent of records for a given CONCEPT_ID @conceptId (@conceptName) with implausible units (i.e., UNIT_CONCEPT_ID NOT IN (@plausibleUnitConceptIds), '-1' means unit_concept_id can be null).",Verification,Plausibility,Atemporal,concept_plausible_unit_concept_ids.sql,plausibleUnitConceptIdsThreshold!=''
Loading

0 comments on commit f5563e8

Please sign in to comment.