Skip to content

Commit

Permalink
Workaround for changed column names in DQD 2.1
Browse files Browse the repository at this point in the history
See issue OHDSI#30.  The fix is borrowed from
OHDSI#35.
  • Loading branch information
xitology committed Apr 26, 2023
1 parent 8882e02 commit 68bf19b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/AugmentConceptFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ augmentConceptFiles <- function(releaseFolder) {
results <- dataQualityResults$CheckResults

# augment achilles concept files with data quality failure count for relevant concept checks
conceptAggregates <- results %>% filter(!is.na(results$CONCEPT_ID) && results$FAILED==1) %>% count(CONCEPT_ID,tolower(CDM_TABLE_NAME))
conceptAggregates <- results %>% filter(!is.na(results$conceptId) && results$failed==1) %>% count(conceptId,tolower(cdmTableName))
names(conceptAggregates) <- c("concept_id","cdm_table_name", "count_failed")
writeLines(paste0(nrow(conceptAggregates), " concept level data quality issues found."))
if (nrow(conceptAggregates) > 0) {
Expand Down
12 changes: 6 additions & 6 deletions R/BuildDataQualityHistoryIndex.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ buildDataQualityHistoryIndex <-
stratified_index <- data.table::data.table()

addResultsToIndex <- function(json) {
cdm_source_name <- json$Metadata[1,"CDM_SOURCE_NAME"]
cdm_source_abbreviation <- json$Metadata[1,"CDM_SOURCE_ABBREVIATION"]
vocabulary_version <- json$Metadata[1,"VOCABULARY_VERSION"]
cdm_release_date <- format(lubridate::ymd(json$Metadata[1,"CDM_RELEASE_DATE"]),"%Y-%m-%d")
cdm_source_name <- json$Metadata[1,"cdmSourceName"]
cdm_source_abbreviation <- json$Metadata[1,"cdmSourceAbbreviation"]
vocabulary_version <- json$Metadata[1,"vocabularyVersion"]
cdm_release_date <- format(lubridate::ymd(json$Metadata[1,"cdmReleaseDate"]),"%Y-%m-%d")
count_passed <- as.numeric(json$Overview$countPassed)
count_failed <- as.numeric(json$Overview$countOverallFailed)
count_total <- count_passed + count_failed
dqd_execution_date <- format(lubridate::ymd_hms(json$endTimestamp),"%Y-%m-%d")

stratifiedAggregates <- json$CheckResults %>%
filter(FAILED==1) %>%
group_by(CATEGORY, toupper(CDM_TABLE_NAME)) %>%
filter(failed==1) %>%
group_by(category, toupper(cdmTableName)) %>%
summarise(count_value=n())
names(stratifiedAggregates) <- c("category", "cdm_table_name", "count_value")
stratifiedAggregates$dqd_execution_date <- dqd_execution_date
Expand Down
4 changes: 2 additions & 2 deletions R/BuildNetworkPerformanceIndex.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ buildNetworkPerformanceIndex <-

performanceTable <- merge(x=performanceTable,y=analysisDetails,by="TASK",all.x=TRUE)

dqdTable <- dplyr::select(dqdData, c("CheckResults.checkId", "CheckResults.EXECUTION_TIME", "CheckResults.CATEGORY")) %>%
rename(TASK = CheckResults.checkId, TIMING = CheckResults.EXECUTION_TIME, CATEGORY = CheckResults.CATEGORY) %>% mutate(PACKAGE = "DQD") %>%
dqdTable <- dplyr::select(dqdData, c("CheckResults.checkId", "CheckResults.executionTime", "CheckResults.category")) %>%
rename(TASK = CheckResults.checkId, TIMING = CheckResults.executionTime, CATEGORY = CheckResults.category) %>% mutate(PACKAGE = "DQD") %>%
mutate_at("TIMING", str_replace, " secs", "")

mergedTable <- rbind(performanceTable, dqdTable)
Expand Down

0 comments on commit 68bf19b

Please sign in to comment.