From f3de0583ea3c45b662af05d9b7453e4bec953b93 Mon Sep 17 00:00:00 2001 From: Gowtham Rao Date: Thu, 9 May 2024 06:55:54 -0400 Subject: [PATCH] Add parameters to limit concept count --- DESCRIPTION | 2 +- R/GetConceptRecordCount.R | 36 ++++++++++++++++++++++++++++++++++++ man/getConceptRecordCount.Rd | 6 ++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 49387a6..aac5144 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,6 +33,6 @@ Remotes: ohdsi/CirceR, ohdsi/SqlRender License: Apache License (>= 2) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Encoding: UTF-8 Language: en-US diff --git a/R/GetConceptRecordCount.R b/R/GetConceptRecordCount.R index 8e9efa5..9d801ea 100644 --- a/R/GetConceptRecordCount.R +++ b/R/GetConceptRecordCount.R @@ -57,6 +57,12 @@ getConceptRecordCount <- function(conceptIds = NULL, cohortDatabaseSchema = NULL, cohortTableName = NULL, cohortDefinitionId = NULL, + stratifyByGender = FALSE, + stratifyByYear = FALSE, + stratifyByYearQuarter = FALSE, + stratifyByYearMonth = FALSE, + stratifyByAgeGroup = FALSE, + stratifyByIncidence = FALSE, domainTableName = c( "drug_exposure", "condition_occurrence", @@ -238,6 +244,36 @@ getConceptRecordCount <- function(conceptIds = NULL, dplyr::arrange() |> dplyr::mutate(combination = dplyr::row_number()) + if (!stratifyByGender) { + iterations <- iterations |> + dplyr::filter(!genderConceptId %in% c(8507, 8532)) + } + + if (!stratifyByYear) { + iterations <- iterations |> + dplyr::filter(calendarType != 'Y') + } + + if (!stratifyByYearQuarter) { + iterations <- iterations |> + dplyr::filter(calendarType != 'Q') + } + + if (!stratifyByYearMonth) { + iterations <- iterations |> + dplyr::filter(calendarType != 'M') + } + + if (!stratifyByAgeGroup) { + iterations <- iterations |> + dplyr::filter(useAgeGroup != 'Y') + } + + if (!stratifyByIncidence) { + iterations <- iterations |> + dplyr::filter(incidence != 'Y') + } + existingOutput <- c() for (i in (1:nrow(iterations))) { diff --git a/man/getConceptRecordCount.Rd b/man/getConceptRecordCount.Rd index 25a6372..ee59fe9 100644 --- a/man/getConceptRecordCount.Rd +++ b/man/getConceptRecordCount.Rd @@ -15,6 +15,12 @@ getConceptRecordCount( cohortDatabaseSchema = NULL, cohortTableName = NULL, cohortDefinitionId = NULL, + stratifyByGender = FALSE, + stratifyByYear = FALSE, + stratifyByYearQuarter = FALSE, + stratifyByYearMonth = FALSE, + stratifyByAgeGroup = FALSE, + stratifyByIncidence = FALSE, domainTableName = c("drug_exposure", "condition_occurrence", "procedure_occurrence", "mesaurement", "observation") )