Skip to contents

Given part of the name of a field of interest to the user, this function returns the full field names used in records that were previously loaded into a collection (using ctrLoadQueryIntoDb). The field names can be fed into function dbGetFieldsIntoDf to extract the data from the collection into a data frame. In addition to the full names of leaf fields (e.g., clinical_results.outcome_list.outcome.measure.class_list.class.title) this function also returns names of node fields (e.g., clinical_results). Data in node fields is typically complex (multiply nested) and can be converted into individual data elements by function dfTrials2Long, possibly followed by function dfName2Value.

Usage

dbFindFields(namepart = "", con, verbose = FALSE)

Arguments

namepart

A plain string (can include a regular expression, including Perl-style) to be searched for among all field names (keys) in the collection. Use `".*` to find all fields.

con

A connection object, see section `Databases` in ctrdata-package

verbose

If TRUE, prints additional information (default FALSE).

Value

Vector of strings with full names of field(s) found, in alphabetical order by register. This is a named vector where the names of the vector are the register names for the respective fields.

Details

For fields in EUCTR (protocol- and results-related information), https://eudract.ema.europa.eu/result.html.

For fields in CTGOV (protocol-related information), see https://prsinfo.clinicaltrials.gov/definitions.html.

For fields in ISRCTN (protocol-related information), see https://www.isrctn.com/page/definitions.

Note: Only when `dbFindFields` is first called after ctrLoadQueryIntoDb, it will take a moment.

Examples


dbc <- nodbi::src_sqlite(
   dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
   collection = "my_trials")

dbFindFields(namepart = "date", con = dbc)
#> Finding fields in database collection (may take some time)
#> Field names cached for this session.
#>                                                                    EUCTR 
#>                                 "n_date_of_competent_authority_decision" 
#>                                                                    EUCTR 
#>                                     "n_date_of_ethics_committee_opinion" 
#>                                                                    EUCTR 
#>                                  "p_date_of_the_global_end_of_the_trial" 
#>                                                                    EUCTR 
#>                     "trialChanges.globalAmendments.globalAmendment.date" 
#>                                                                    EUCTR 
#>                                     "trialInformation.analysisStageDate" 
#>                                                                    EUCTR 
#>                                  "trialInformation.globalEndOfTrialDate" 
#>                                                                    EUCTR 
#>                                 "trialInformation.primaryCompletionDate" 
#>                                                                    EUCTR 
#>                                  "trialInformation.recruitmentStartDate" 
#>                                                                    EUCTR 
#> "x6_date_on_which_this_record_was_first_entered_in_the_eudract_database" 
#>                                                                    CTGOV 
#>                                                        "completion_date" 
#>                                                                    CTGOV 
#>                                                     "last_update_posted" 
#>                                                                    CTGOV 
#>                                                  "last_update_submitted" 
#>                                                                    CTGOV 
#>                                               "last_update_submitted_qc" 
#>                                                                    CTGOV 
#>                                                "primary_completion_date" 
#>                                                                    CTGOV 
#>                                          "required_header.download_date" 
#>                                                                    CTGOV 
#>                                                             "start_date" 
#>                                                                    CTGOV 
#>                                                      "verification_date" 
#>                                                                   ISRCTN 
#>                                             "trialDesign.overallEndDate" 
#>                                                                   ISRCTN 
#>                                           "trialDesign.overallStartDate"