Skip to content

Commit

Permalink
Update ExtractConceptSetsInCohortDefinition.R
Browse files Browse the repository at this point in the history
  • Loading branch information
gowthamrao committed Sep 17, 2024
1 parent ed403a7 commit ae4d053
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions R/ExtractConceptSetsInCohortDefinition.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,21 @@ extractConceptSetsInCohortDefinition <-
)

} else {
if (names(codesets) == "CodesetId") {
codeSetsIdsInPrimaryCriteria <- c(
codeSetsIdsInPrimaryCriteria,
as.double(codesets)
) |>
if (any(
names(codesets) == "CodesetId",
stringr::str_detect(string = names(codesets), pattern = 'SourceConcept')
)) {
#is substring of name 'SourceConcept'
codeSetsIdsInPrimaryCriteria <- c(codeSetsIdsInPrimaryCriteria, as.double(codesets)) |>
unique() |>
sort()

if (!names(codesets) == 'CodesetId') {
codeSetsIdsUsedToQuerySourceConceptsInPrimaryCriteria <- c(
codeSetsIdsUsedToQuerySourceConceptsInPrimaryCriteria,
codeSetsIdsInPrimaryCriteria
)
}
}
}
}
Expand Down

0 comments on commit ae4d053

Please sign in to comment.