Skip to contents

[Experimental]

Usage

summariseCohortCodelist(cohort, cohortId = NULL)

Arguments

cohort

A cohort_table object.

cohortId

A cohort definition id to restrict by. If NULL, all cohorts will be included.

Value

A summarised_result object with the exported cohort codelist information.

Examples

# \donttest{
library(CohortCharacteristics)
library(CDMConnector)
library(duckdb)
#> Loading required package: DBI
library(dplyr, warn.conflicts = FALSE)

dbName <- "GiBleed"
requireEunomia(datasetName = dbName)
#>  `EUNOMIA_DATA_FOLDER` set to: /tmp/Rtmp6xV1mf.
#> 
#> Download completed!
con <- dbConnect(drv = duckdb(dbdir = eunomiaDir(datasetName = dbName)))
#> Creating CDM database /tmp/Rtmp6xV1mf/GiBleed_5.3.zip
cdm <- cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")

cdm <- generateConceptCohortSet(cdm = cdm,
                                conceptSet = list(pharyngitis = 4112343L),
                                name = "my_cohort")

result <- summariseCohortCodelist(cdm$my_cohort)

glimpse(result)
#> Rows: 1
#> Columns: 13
#> $ result_id        <int> 1
#> $ cdm_name         <chr> "Synthea"
#> $ group_name       <chr> "cohort_name"
#> $ group_level      <chr> "pharyngitis"
#> $ strata_name      <chr> "codelist_name &&& codelist_type"
#> $ strata_level     <chr> "pharyngitis &&& index event"
#> $ variable_name    <chr> "overall"
#> $ variable_level   <chr> "overall"
#> $ estimate_name    <chr> "concept_id"
#> $ estimate_type    <chr> "integer"
#> $ estimate_value   <chr> "4112343"
#> $ additional_name  <chr> "concept_name"
#> $ additional_level <chr> "Acute viral pharyngitis"

tidy(result)
#> # A tibble: 1 × 8
#>   cdm_name cohort_name codelist_name codelist_type variable_name variable_level
#>   <chr>    <chr>       <chr>         <chr>         <chr>         <chr>         
#> 1 Synthea  pharyngitis pharyngitis   index event   overall       overall       
#> # ℹ 2 more variables: concept_name <chr>, concept_id <int>
# }