The function works with procotol- and results- related information.
It converts lists and other values that are in a data frame returned
by dbGetFieldsIntoDf into individual rows of a long data frame.
From the resulting long data frame, values of interest can be selected
using dfName2Value.
The function is particularly useful for fields with complex content,
such as node field "clinical_results
" from EUCTR, for which
dbGetFieldsIntoDf returns as a multiply nested list and for
which this function then converts every observation of every (leaf)
field into a row of its own.
Arguments
- df
Data frame (or tibble) with columns including the trial identifier (
_id
) and one or more variables as obtained from dbGetFieldsIntoDf
Value
A data frame (or tibble, if tibble
is loaded)
with the four columns: `_id`, `identifier`, `name`, `value`
Examples
dbc <- nodbi::src_sqlite(
dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
collection = "my_trials")
#> RSQLite version has enabled accelerating docdb_create() and docdb_update() functions when used with value = <NDJSON file name>.
dfwide <- dbGetFieldsIntoDf(
fields = "clinical_results.participant_flow",
con = dbc)
dfTrials2Long(df = dfwide)
#> clinical_results.participant_flow.recruitment_details
#> clinical_results.participant_flow.pre_assignment_details
#> clinical_results.participant_flow.group_list.group
#> clinical_results.participant_flow.period_list.period.title
#> clinical_results.participant_flow.period_list.period.milestone_list.milestone
#> clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.title
#> clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.group_id
#> clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.count
#>
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#> .
#>
#> Total 43 rows, 12 unique names of variables
#> _id identifier
#> 1 NCT03325439 0
#> 2 NCT03325439 0
#> 3 NCT02620761 1
#> 4 NCT02620761 2
#> 5 NCT02620761 1
#> 6 NCT02620761 2
#> 7 NCT02620761 1
#> 8 NCT02620761 2
#> 9 NCT03325439 1
#> 10 NCT03325439 2
#> 11 NCT03325439 3
#> 12 NCT02620761 0
#> 13 NCT03325439 0
#> 14 NCT02620761 1
#> 15 NCT02620761 2
#> 16 NCT02620761 3
#> 17 NCT02620761 1.1
#> 18 NCT02620761 1.2
#> 19 NCT02620761 1.1
#> 20 NCT02620761 1.2
#> 21 NCT02620761 2.1
#> 22 NCT02620761 2.2
#> 23 NCT02620761 2.1
#> 24 NCT02620761 2.2
#> 25 NCT02620761 3.1
#> 26 NCT02620761 3.2
#> 27 NCT02620761 3.1
#> 28 NCT02620761 3.2
#> 29 NCT03325439 1
#> 30 NCT03325439 2
#> 31 NCT03325439 3
#> 32 NCT03325439 4
#> 33 NCT03325439 1
#> 34 NCT03325439 2
#> 35 NCT03325439 3
#> 36 NCT03325439 4
#> 37 NCT03325439 1
#> 38 NCT03325439 2
#> 39 NCT03325439 3
#> 40 NCT03325439 4
#> 41 NCT03325439 0
#> 42 NCT03325439 0
#> 43 NCT03325439 0
#> name
#> 1 clinical_results.participant_flow.recruitment_details
#> 2 clinical_results.participant_flow.pre_assignment_details
#> 3 clinical_results.participant_flow.group_list.group.group_id
#> 4 clinical_results.participant_flow.group_list.group.group_id
#> 5 clinical_results.participant_flow.group_list.group.title
#> 6 clinical_results.participant_flow.group_list.group.title
#> 7 clinical_results.participant_flow.group_list.group.description
#> 8 clinical_results.participant_flow.group_list.group.description
#> 9 clinical_results.participant_flow.group_list.group.group_id
#> 10 clinical_results.participant_flow.group_list.group.title
#> 11 clinical_results.participant_flow.group_list.group.description
#> 12 clinical_results.participant_flow.period_list.period.title
#> 13 clinical_results.participant_flow.period_list.period.title
#> 14 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 15 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 16 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 17 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 18 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 19 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 20 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 21 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 22 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 23 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 24 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 25 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 26 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 27 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 28 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 29 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 30 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 31 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 32 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 33 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 34 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 35 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 36 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 37 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 38 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 39 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 40 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 41 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.title
#> 42 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.group_id
#> 43 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.count
#> value
#> 1 The study started to enroll participants in May 2019 and concluded in May 2021.
#> 2 No eligible study participants were enrolled in the Confirmatory Cohorts. The study stopped prematurely due to enrolment challenges, the termination was not linked to any safety issues. The Participant Flow refers to the All Subjects Screened.
#> 3 P1
#> 4 P2
#> 5 Control
#> 6 Fenoldopam
#> 7 Infants in the Placebo arm will receive 0.9% sodium chloride (0.1 ml/hr). If, after 6 hrs there is not a clinically concerning decrease in blood pressure, as determined by attending physician, the rate of infusion (in this arm the placebo) will be increased to 0.2 ml/kg/hr. This rate will be continued throughout the remainder of the study.\r0.9%NS: Randomized to receive Fenoldopam or 0.9%NS
#> 8 Infants in the experimental arm will receive fenoldopam (60 ug/ml; 0.1 ml/hr to provide 0.1ug/kg/min). If, after 6 hrs there is not a clinically concerning decrease in blood pressure, as determined by attending physician, the rate of infusion will be increased to 0.2 ml/kg/hr (0.2 ug/kg/min for infants receiving fenoldopam). This rate will be continued throughout the remainder of the study.\rFenoldopam: Randomized to receive Fenoldopam or 0.9%NS
#> 9 P1
#> 10 Exploratory Cohort
#> 11 Participants in this arm received brivaracetam (BRV) 0.5 milligram per kilogram (mg/kg) administered as an intravenous (iv) solution for injection twice daily (bid) during the 48-hour Evaluation Period. An additional 3 doses of BRV (0.5 mg/kg) could have been administered every 12 hours for 48 hours (at the discretion of the Investigator). Treatment with antiepileptic drugs (AEDs) per standard of care (SToC) (first-line, second-line, or subsequent treatment) were continued in parallel with BRV treatment.
#> 12 Overall Study
#> 13 Overall Study
#> 14 STARTED
#> 15 COMPLETED
#> 16 NOT COMPLETED
#> 17 P1
#> 18 P2
#> 19 1
#> 20 0
#> 21 P1
#> 22 P2
#> 23 1
#> 24 0
#> 25 P1
#> 26 P2
#> 27 0
#> 28 0
#> 29 STARTED
#> 30 Treated
#> 31 COMPLETED
#> 32 NOT COMPLETED
#> 33 P1
#> 34 P1
#> 35 P1
#> 36 P1
#> 37 9
#> 38 6
#> 39 6
#> 40 3
#> 41 Ineligibility
#> 42 P1
#> 43 3