Skip to contents

Trial concept calculated: Applies function dbFindIdsUniqueTrials() with its defaults.

Usage

f.isUniqueTrial(df = NULL)

Arguments

df

data frame such as from dbGetFieldsIntoDf. If `NULL`, prints fields needed in `df` for calculating this trial concept, which can be used with dbGetFieldsIntoDf.

Value

data frame with columns `_id` and `.isUniqueTrial`, a logical.

Examples

# fields needed
f.isUniqueTrial()
#> [1] "ctrname"

# apply trial concept when creating data frame
dbc <- nodbi::src_sqlite(
  dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
  collection = "my_trials", flags = RSQLite::SQLITE_RO)
trialsDf <- dbGetFieldsIntoDf(
  calculate = "f.isUniqueTrial",
  con = dbc)
#> Querying database (1 fields)...
#> Searching for duplicate trials... 
#> - Getting all trial identifiers...
#> , 31 found in collection
#> - Finding duplicates among registers' and sponsor ids...
#> - 2 EUCTR _id were not preferred EU Member State record for 11 trials
#> - Keeping 5 / 3 / 8 / 8 / 5 records from CTGOV2 / EUCTR / CTGOV / ISRCTN / CTIS
#> = Returning keys (_id) of 29 records in collection "my_trials"
trialsDf
#> # A tibble: 31 × 2
#>    `_id`             .isUniqueTrial
#>    <chr>             <lgl>         
#>  1 12949496          TRUE          
#>  2 13281214          TRUE          
#>  3 17473621          TRUE          
#>  4 2012-003632-23-CZ FALSE         
#>  5 2012-003632-23-SE TRUE          
#>  6 2014-002606-20-PT TRUE          
#>  7 2014-003556-31-GB FALSE         
#>  8 2014-003556-31-SE TRUE          
#>  9 2022-500244-37-00 TRUE          
#> 10 2022-501142-30-00 TRUE          
#> # ℹ 21 more rows