Get random rows from the Concept table without any additional filters.

get_test_concepts(
  conn,
  conn_fun = "connectAthena()",
  schema = "omop_vocabulary",
  limit = 100,
  verbose = TRUE,
  render_sql = TRUE
)

See also

Examples

library(chariot) library(tidyverse) # Get Unfiltered Test Concepts (Invalid Concepts are included) get_test_concepts()
#> [2021-05-26 16:00:58] Connected to 'athena' #> [2021-05-26 16:00:58] Overriding cache... Querying Athena... #> [2021-05-26 16:00:58] ✓ Open connection #> [2021-05-26 16:00:58] ✓ JDBC connection #> [2021-05-26 16:00:58] SQL: SELECT * FROM omop_vocabulary.concept ORDER BY RANDOM() LIMIT 100 #> [2021-05-26 16:00:58] Querying... #> [2021-05-26 16:01:07] Querying...complete #> [2021-05-26 16:01:07] ✓ Returned data has more than 0 rows #> [2021-05-26 16:01:07] Caching resultset... #> [2021-05-26 16:01:07] Postgres connection to 'athena' closed
#> # A tibble: 100 x 10 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <int> <chr> <chr> <chr> <chr> #> 1 41037733 Acetaminophen 250 MG / … Drug RxNorm Exten… Branded Drug #> 2 45302523 Avobenzone, Homosalate,… Drug NDC 9-digit NDC #> 3 44837378 Other acquired deformit… Condition ICD9CM 5-dig billing c… #> 4 42759393 Operations on other bon… Procedure OPS Procedure #> 5 3411346 Amphibole asbestos Observati… Nebraska Lex… Substance #> 6 43327303 Curosurf 240 Mg/3 Ml In… Drug AMT Trade Product P… #> 7 2743182 Removal of Drainage Dev… Procedure ICD10PCS ICD10PCS #> 8 36712739 Recurrent primary malig… Condition SNOMED Clinical Finding #> 9 35821782 olbetam 250mg capsule Observati… UK Biobank Value #> 10 41037707 Achillea millefolium ex… Drug RxNorm Exten… Branded Drug Box #> # … with 90 more rows, and 5 more variables: standard_concept <chr>, #> # concept_code <chr>, valid_start_date <date>, valid_end_date <date>, #> # invalid_reason <chr>
# The size of the resultset can be altered get_test_concepts(limit = 25)
#> [2021-05-26 16:01:07] Connected to 'athena' #> [2021-05-26 16:01:07] Overriding cache... Querying Athena... #> [2021-05-26 16:01:07] ✓ Open connection #> [2021-05-26 16:01:07] ✓ JDBC connection #> [2021-05-26 16:01:07] SQL: SELECT * FROM omop_vocabulary.concept ORDER BY RANDOM() LIMIT 25 #> [2021-05-26 16:01:07] Querying... #> [2021-05-26 16:01:16] Querying...complete #> [2021-05-26 16:01:16] ✓ Returned data has more than 0 rows #> [2021-05-26 16:01:16] Caching resultset... #> [2021-05-26 16:01:16] Postgres connection to 'athena' closed
#> # A tibble: 25 x 10 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <int> <chr> <chr> <chr> <chr> #> 1 36097239 petrolatum 1 MG/MG Topi… Drug NDC 11-digit NDC #> 2 42950868 Amlodipine 5 MG / Chlor… Drug RxNorm Exten… Branded Drug Co… #> 3 42998925 PINE Injectable solution Drug KDC Drug Product #> 4 42249777 Operation for Congenita… Procedure EDI Procedure #> 5 45957176 Jamaica dogwood powder Observati… SNOMED Substance #> 6 4062687 Pre-existing malnutriti… Condition SNOMED Clinical Finding #> 7 35425993 TADENAN 50 mg, capsule … Drug BDPM Drug Product #> 8 42314852 Repair of Cardiac Wound… Procedure EDI Procedure #> 9 21226739 Carvedilol 3.125mg tabl… Drug dm+d VMPP #> 10 46358494 SHISEIDO ADVANCED HYDRO… Drug NDC 11-digit NDC #> # … with 15 more rows, and 5 more variables: standard_concept <chr>, #> # concept_code <chr>, valid_start_date <date>, valid_end_date <date>, #> # invalid_reason <chr>
# Concepts specific to the Drug domain can be sampled # RxNorm/RxNorm Extension Concepts get_test_drug_concepts(limit = 10)
#> [2021-05-26 16:01:16] Connected to 'athena' #> [2021-05-26 16:01:16] Overriding cache... Querying Athena... #> [2021-05-26 16:01:16] ✓ Open connection #> [2021-05-26 16:01:16] ✓ JDBC connection #> [2021-05-26 16:01:16] SQL: SELECT * FROM omop_vocabulary.concept c WHERE c.invalid_reason IS NULL AND c.vocabulary_id IN ('RxNorm', 'RxNorm Extension') AND c.standard_concept <> 'C' AND c.domain_id = 'Drug' ORDER BY RANDOM() LIMIT 10 #> [2021-05-26 16:01:16] Querying... #> [2021-05-26 16:01:19] Querying...complete #> [2021-05-26 16:01:19] ✓ Returned data has more than 0 rows #> [2021-05-26 16:01:19] Caching resultset... #> [2021-05-26 16:01:19] Postgres connection to 'athena' closed
#> # A tibble: 10 x 10 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <int> <chr> <chr> <chr> <chr> #> 1 41387522 30 ML Toxicodendron pub… Drug RxNorm Extens… Quant Clinical … #> 2 43683856 50 ML Epirubicin 2 MG/M… Drug RxNorm Extens… Quant Clinical … #> 3 2074474 Lactobacillus acidophil… Drug RxNorm Extens… Marketed Product #> 4 21087756 4 ML Sotalol 10 MG/ML P… Drug RxNorm Extens… Quant Clinical … #> 5 35786743 100 ML Epirubicin 2 MG/… Drug RxNorm Extens… Marketed Product #> 6 42710125 mercuric sulfate 14.4 X… Drug RxNorm Extens… Branded Drug Co… #> 7 41492368 30000 MG Copper Glucona… Drug RxNorm Extens… Quant Clinical … #> 8 43801437 Diclofenac 100 MG Oral … Drug RxNorm Extens… Marketed Product #> 9 43845233 40000 MG Camphor 0.025 … Drug RxNorm Extens… Quant Clinical … #> 10 21107919 24 HR rivastigmine 0.39… Drug RxNorm Extens… Quant Branded D… #> # … with 5 more variables: standard_concept <chr>, concept_code <chr>, #> # valid_start_date <date>, valid_end_date <date>, invalid_reason <chr>
# HemOnc/ATC Classes get_test_drug_classes(limit = 10)
#> [2021-05-26 16:01:19] Connected to 'athena' #> [2021-05-26 16:01:19] Overriding cache... Querying Athena... #> [2021-05-26 16:01:19] ✓ Open connection #> [2021-05-26 16:01:19] ✓ JDBC connection #> [2021-05-26 16:01:19] SQL: SELECT * FROM omop_vocabulary.concept c WHERE c.invalid_reason IS NULL AND c.vocabulary_id IN ('ATC', 'HemOnc') AND c.standard_concept = 'C' AND c.domain_id = 'Drug' ORDER BY RANDOM() LIMIT 10 #> [2021-05-26 16:01:19] Querying... #> [2021-05-26 16:01:19] Querying...complete #> [2021-05-26 16:01:19] ✓ Returned data has more than 0 rows #> [2021-05-26 16:01:19] Caching resultset... #> [2021-05-26 16:01:19] Postgres connection to 'athena' closed
#> # A tibble: 10 x 10 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <int> <chr> <chr> <chr> <chr> #> 1 21603210 pseudoephedrine; oral Drug ATC ATC 5th #> 2 21602263 Medicated dressings with… Drug ATC ATC 4th #> 3 21605318 Tests for gastric secret… Drug ATC ATC 4th #> 4 21603311 Selective beta-2-adrenor… Drug ATC ATC 4th #> 5 21600855 Vitamins with minerals Drug ATC ATC 4th #> 6 21604451 dexetimide; systemic Drug ATC ATC 5th #> 7 21603512 astemizole; oral Drug ATC ATC 5th #> 8 21602936 sulfamethizole; oral Drug ATC ATC 5th #> 9 21603918 rilonacept; parenteral Drug ATC ATC 5th #> 10 21601594 suloctidil Drug ATC ATC 5th #> # … with 5 more variables: standard_concept <chr>, concept_code <chr>, #> # valid_start_date <date>, valid_end_date <date>, invalid_reason <chr>
# Test data can also be taken from tables other than Concept get_test_data(table = "concept_relationship")
#> [2021-05-26 16:01:19] Connected to 'athena' #> [2021-05-26 16:01:19] Overriding cache... Querying Athena... #> [2021-05-26 16:01:19] ✓ Open connection #> [2021-05-26 16:01:19] ✓ JDBC connection #> [2021-05-26 16:01:19] SQL: SELECT * FROM omop_vocabulary.concept_relationship ORDER BY RANDOM() LIMIT 100 #> [2021-05-26 16:01:19] Querying... #> [2021-05-26 16:01:53] Querying...complete #> [2021-05-26 16:01:53] ✓ Returned data has more than 0 rows #> [2021-05-26 16:01:53] Caching resultset... #> [2021-05-26 16:01:53] Postgres connection to 'athena' closed
#> # A tibble: 100 x 6 #> concept_id_1 concept_id_2 relationship_id valid_start_date valid_end_date #> <int> <int> <chr> <date> <date> #> 1 41115719 40001838 RxNorm is a 2017-07-18 2099-12-31 #> 2 36274597 19082228 RxNorm has dose fo… 2017-10-01 2099-12-31 #> 3 21141639 43132858 Has supplier 2017-06-24 2099-12-31 #> 4 1424597 4170448 Maps to 2016-01-01 2099-12-31 #> 5 43598430 43598430 Mapped from 2016-12-18 2099-12-31 #> 6 4266648 44498461 Mapped from 1970-01-01 2099-12-31 #> 7 36779988 36782434 Quantified form of 2018-09-01 2099-12-31 #> 8 4027919 4028406 Subsumes 2011-07-31 2099-12-31 #> 9 44342975 19078106 SPL - RxNorm 1970-01-01 2099-12-31 #> 10 4066563 40315457 Concept poss_eq fr… 2017-07-31 2099-12-31 #> # … with 90 more rows, and 1 more variable: invalid_reason <chr>
get_test_data(table = "concept_ancestor", limit = 10)
#> [2021-05-26 16:01:53] Connected to 'athena' #> [2021-05-26 16:01:53] Overriding cache... Querying Athena... #> [2021-05-26 16:01:53] ✓ Open connection #> [2021-05-26 16:01:53] ✓ JDBC connection #> [2021-05-26 16:01:53] SQL: SELECT * FROM omop_vocabulary.concept_ancestor ORDER BY RANDOM() LIMIT 10 #> [2021-05-26 16:01:53] Querying... #> [2021-05-26 16:02:28] Querying...complete #> [2021-05-26 16:02:28] ✓ Returned data has more than 0 rows #> [2021-05-26 16:02:28] Caching resultset... #> [2021-05-26 16:02:28] Postgres connection to 'athena' closed
#> # A tibble: 10 x 4 #> ancestor_concept_… descendant_concep… min_levels_of_sepa… max_levels_of_sepa… #> <int> <int> <int> <int> #> 1 19110756 40915995 2 3 #> 2 45703978 41030911 1 1 #> 3 46241764 41195477 2 3 #> 4 45705648 43294907 2 2 #> 5 36217216 21045315 3 5 #> 6 4185115 2729102 5 8 #> 7 45676106 41252639 2 2 #> 8 41884487 41910544 4 4 #> 9 42902553 41408339 1 2 #> 10 21602977 35859995 1 1