This function performs the same style of filtering as filter_strip over multiple columns.

filter_at_all_strip(data, strip_cols, ...)

Arguments

data

Dataframe

...

Filter arguments passed to the dplyr filter function using the base Concept Table fields.

merge_cols

Character vector of column names to filter

all

Equivalent to the `all_vars()` variable predicate in the Tidyverse system. If TRUE, all `merge_cols` are filtered for. If FALSE, the equivalent to `any_vars()` is performed. Default: TRUE

Value

A tibble.

See also

Examples

#> [2021-05-26 16:00:36] Connected to 'athena'
test_data <- queryAthena("SELECT * FROM omop_vocabulary.concept ORDER BY RANDOM() LIMIT 20;", conn = conn)
#> [2021-05-26 16:00:36] Loading Cache... #> [2021-05-26 16:00:36] Cached SQL: SELECT * FROM omop_vocabulary.concept ORDER BY RANDOM() LIMIT 20; #> [2021-05-26 16:00:36] Cached resultset found...
# Merge merge_strip(data = test_data, into = "concept")
#> # A tibble: 20 x 2 #> concept_id concept #> <int> <chr> #> 1 37083718 [V] [N] 37083718 Disorders of autonomic nervous system [ICD10GM G… #> 2 3414550 [V] [N] 3414550 Traumatic brachial plexus lesion [Nebraska Lexico… #> 3 45110479 [V] [N] 45110479 GNP CHLD IBUPROFEN 100 MG/5 ML [NDC 87701030771]… #> 4 45071768 [V] [N] 45071768 metoprolol tartrate 50 MG Oral Tablet [NDC 55289… #> 5 44104843 [V] [S] 44104843 ECHINACEA ANGUSTIFOLIA Extract 1 X [RxNorm Exten… #> 6 44799086 [U] [N] 44799086 [X]Victim of avalanche, landslide and other eart… #> 7 3051772 [V] [S] 3051772 MR Lower extremity joint - right WO and W contras… #> 8 19123243 [U] [N] 19123243 Levobupivacaine 0.625 MG/ML Injectable Solution … #> 9 3652026 [D] [N] 3652026 MIDODRINE HYDROCHLORIDE 2.5mg tablets [SNOMED 126… #> 10 42743213 [V] [N] 42743213 Operations on other bone: bone grafting and -tra… #> 11 4326268 [V] [S] 4326268 Infection by Oesophagostomum apiostomum [SNOMED 7… #> 12 36240133 [V] [C] 36240133 Noctesed Oral Product [RxNorm 1184488] [Drug] [B… #> 13 3234609 [V] [N] 3234609 Finding of movement of uvula [Nebraska Lexicon 36… #> 14 42061633 [V] [S] 42061633 Bogalusa [OSM 132196] [Geography] [8th level] #> 15 37513931 [V] [N] 37513931 oxcarbazepine 150 MG Oral Tablet [NDC 7051808940… #> 16 43569515 [V] [N] 43569515 Ginkgo Sandoz [RxNorm Extension OMOP888148] [Dru… #> 17 46290886 [V] [C] 46290886 LEG CRAMPS PM - oyster shell calcium carbonate, … #> 18 46289483 [V] [C] 46289483 TORK FOAM ANTIBACTERIAL - chloroxylenol soap [SP… #> 19 19118814 [D] [N] 19118814 Mitomycin 0.5 MG/ML [Mutamycin] [RxNorm 569802] … #> 20 21136931 [V] [S] 21136931 5 ML Regular Insulin, Human 100 UNT/ML Prefilled…
# Merge while sparing some original columns such as vocabulary_id and # concept_class_id merge_strip(data = test_data, into = "concept", vocabulary_id, concept_class_id)
#> # A tibble: 20 x 4 #> concept_id concept vocabulary_id concept_class_id #> <int> <chr> <chr> <chr> #> 1 37083718 [V] [N] 37083718 Disorders of au… ICD10GM ICD10 Hierarchy #> 2 3414550 [V] [N] 3414550 Traumatic brachi… Nebraska Lexi… Clinical Finding #> 3 45110479 [V] [N] 45110479 GNP CHLD IBUPRO… NDC 11-digit NDC #> 4 45071768 [V] [N] 45071768 metoprolol tart… NDC 11-digit NDC #> 5 44104843 [V] [S] 44104843 ECHINACEA ANGUS… RxNorm Extens… Clinical Drug Co… #> 6 44799086 [U] [N] 44799086 [X]Victim of av… SNOMED Clinical Finding #> 7 3051772 [V] [S] 3051772 MR Lower extremi… LOINC Clinical Observa… #> 8 19123243 [U] [N] 19123243 Levobupivacaine… RxNorm Clinical Drug #> 9 3652026 [D] [N] 3652026 MIDODRINE HYDROC… SNOMED Context-dependent #> 10 42743213 [V] [N] 42743213 Operations on o… OPS Procedure #> 11 4326268 [V] [S] 4326268 Infection by Oes… SNOMED Clinical Finding #> 12 36240133 [V] [C] 36240133 Noctesed Oral P… RxNorm Branded Dose Gro… #> 13 3234609 [V] [N] 3234609 Finding of movem… Nebraska Lexi… Clinical Finding #> 14 42061633 [V] [S] 42061633 Bogalusa [OSM 1… OSM 8th level #> 15 37513931 [V] [N] 37513931 oxcarbazepine 1… NDC 11-digit NDC #> 16 43569515 [V] [N] 43569515 Ginkgo Sandoz [… RxNorm Extens… Brand Name #> 17 46290886 [V] [C] 46290886 LEG CRAMPS PM -… SPL OTC Drug #> 18 46289483 [V] [C] 46289483 TORK FOAM ANTIB… SPL OTC Drug #> 19 19118814 [D] [N] 19118814 Mitomycin 0.5 M… RxNorm Branded Drug Comp #> 20 21136931 [V] [S] 21136931 5 ML Regular In… RxNorm Extens… Marketed Product
# Test filtering of strip columns test_output <- merge_strip(data = test_data, into = "concept") %>% dplyr::select(-concept_id) # Filter at a Strip Column filter_strip(test_output, strip_col = concept, vocabulary_id %in% c("SNOMED"))
#> # A tibble: 3 x 1 #> concept #> <chr> #> 1 [U] [N] 44799086 [X]Victim of avalanche, landslide and other earth movements … #> 2 [D] [N] 3652026 MIDODRINE HYDROCHLORIDE 2.5mg tablets [SNOMED 126558010000011… #> 3 [V] [S] 4326268 Infection by Oesophagostomum apiostomum [SNOMED 75169006] [Co…
# Filter at more than 1 Strip Column test_data <- dplyr::bind_cols(test_output %>% rubix::randomize() %>% dplyr::select(concept_a = concept), test_output %>% rubix::randomize() %>% dplyr::select(concept_b = concept)) filter_at_all_strip(data = test_data, strip_cols = c("concept_a", "concept_b"), vocabulary_id %in% c("RxNorm"))
#> # A tibble: 1 x 2 #> concept_a concept_b #> <chr> <chr> #> 1 [U] [N] 19123243 Levobupivacaine 0.625… [U] [N] 19123243 Levobupivacaine 0.62…
filter_at_any_strip(data = test_data, strip_cols = c("concept_a", "concept_b"), vocabulary_id %in% c("RxNorm"))
#> # A tibble: 7 x 2 #> concept_a concept_b #> <chr> <chr> #> 1 [V] [C] 36240133 Noctesed Oral Product… [V] [S] 4326268 Infection by Oesophag… #> 2 [V] [N] 43569515 Ginkgo Sandoz [RxNorm… [V] [C] 46289483 TORK FOAM ANTIBACTER… #> 3 [U] [N] 19123243 Levobupivacaine 0.625… [U] [N] 19123243 Levobupivacaine 0.62… #> 4 [V] [S] 44104843 ECHINACEA ANGUSTIFOLI… [V] [N] 37513931 oxcarbazepine 150 MG… #> 5 [V] [C] 46290886 LEG CRAMPS PM - oyste… [V] [C] 36240133 Noctesed Oral Produc… #> 6 [V] [S] 4326268 Infection by Oesophago… [V] [S] 44104843 ECHINACEA ANGUSTIFOL… #> 7 [V] [S] 42061633 Bogalusa [OSM 132196]… [V] [N] 43569515 Ginkgo Sandoz [RxNor…
dcAthena(conn = conn)
#> [2021-05-26 16:00:37] Postgres connection to 'athena' closed