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::SQLITE_RO)
#> 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 NCT02620761 1
#> 2 NCT02620761 2
#> 3 NCT02620761 1
#> 4 NCT02620761 2
#> 5 NCT02620761 1
#> 6 NCT02620761 2
#> 7 NCT02620761 1.1
#> 8 NCT02620761 1.2
#> 9 NCT02620761 2.1
#> 10 NCT02620761 2.2
#> 11 NCT02620761 3.1
#> 12 NCT02620761 3.2
#> 13 NCT02620761 1.1
#> 14 NCT02620761 1.2
#> 15 NCT02620761 2.1
#> 16 NCT02620761 2.2
#> 17 NCT02620761 3.1
#> 18 NCT02620761 3.2
#> 19 NCT02620761 1
#> 20 NCT02620761 2
#> 21 NCT02620761 3
#> 22 NCT02620761 0
#> 23 NCT03325439 0
#> 24 NCT03325439 0
#> 25 NCT03325439 0
#> 26 NCT03325439 0
#> 27 NCT03325439 0
#> 28 NCT03325439 0
#> 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.group_list.group.description
#> 2 clinical_results.participant_flow.group_list.group.description
#> 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.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 8 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 9 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 10 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 11 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 12 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 13 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 14 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 15 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 16 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.group_id
#> 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.title
#> 20 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 21 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 22 clinical_results.participant_flow.period_list.period.title
#> 23 clinical_results.participant_flow.group_list.group.description
#> 24 clinical_results.participant_flow.group_list.group.group_id
#> 25 clinical_results.participant_flow.group_list.group.title
#> 26 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.count
#> 27 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.participants_list.participants.group_id
#> 28 clinical_results.participant_flow.period_list.period.drop_withdraw_reason_list.drop_withdraw_reason.title
#> 29 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 30 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 31 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 32 clinical_results.participant_flow.period_list.period.milestone_list.milestone.participants_list.participants.count
#> 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.title
#> 38 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 39 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 40 clinical_results.participant_flow.period_list.period.milestone_list.milestone.title
#> 41 clinical_results.participant_flow.period_list.period.title
#> 42 clinical_results.participant_flow.pre_assignment_details
#> 43 clinical_results.participant_flow.recruitment_details
#> value
#> 1 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
#> 2 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
#> 3 P1
#> 4 P2
#> 5 Control
#> 6 Fenoldopam
#> 7 1
#> 8 0
#> 9 1
#> 10 0
#> 11 0
#> 12 0
#> 13 P1
#> 14 P2
#> 15 P1
#> 16 P2
#> 17 P1
#> 18 P2
#> 19 STARTED
#> 20 COMPLETED
#> 21 NOT COMPLETED
#> 22 Overall Study
#> 23 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.
#> 24 P1
#> 25 Exploratory Cohort
#> 26 3
#> 27 P1
#> 28 Ineligibility
#> 29 9
#> 30 6
#> 31 6
#> 32 3
#> 33 P1
#> 34 P1
#> 35 P1
#> 36 P1
#> 37 STARTED
#> 38 Treated
#> 39 COMPLETED
#> 40 NOT COMPLETED
#> 41 Overall Study
#> 42 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.
#> 43 The study started to enroll participants in May 2019 and concluded in May 2021.