From f28196e66627a183376c166e3890026662c93017 Mon Sep 17 00:00:00 2001 From: edward-burn <9583964+edward-burn@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:45:16 +0000 Subject: [PATCH] fix for empty edge case --- DESCRIPTION | 2 +- R/summariseCodeUse.R | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index fc924cf..e701a11 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: CodelistGenerator Title: Generate Code Lists for the OMOP Common Data Model -Version: 2.1.0 +Version: 2.1.1 Authors@R: c( person("Edward", "Burn", email = "edward.burn@ndorms.ox.ac.uk", role = c("aut", "cre"), diff --git a/R/summariseCodeUse.R b/R/summariseCodeUse.R index 00ffc89..62be065 100644 --- a/R/summariseCodeUse.R +++ b/R/summariseCodeUse.R @@ -418,6 +418,8 @@ if(length(tableName)>0){ dplyr::select("concept_id", "domain_id"), by = c("standard_concept_id"="concept_id"), copy = TRUE) + + if(workingRecords %>% utils::head(1) %>% dplyr::tally() %>% dplyr::pull("n") >0){ codeRecords <- codeRecords %>% dplyr::union_all(workingRecords) %>% CDMConnector::computeQuery( @@ -426,6 +428,7 @@ if(length(tableName)>0){ schema = attr(cdm, "write_schema"), overwrite = TRUE ) + } } }