Title: | Creates Safety Results Summary in XML to Upload to EudraCT, or ClinicalTrials.gov |
---|---|
Description: | The remit of the European Clinical Trials Data Base (EudraCT <https://eudract.ema.europa.eu/> ), or ClinicalTrials.gov <https://clinicaltrials.gov/>, is to provide open access to summaries of all registered clinical trial results; thus aiming to prevent non-reporting of negative results and provide open-access to results to inform future research. The amount of information required and the format of the results, however, imposes a large extra workload at the end of studies on clinical trial units. In particular, the adverse-event-reporting component requires entering: each unique combination of treatment group and safety event; for every such event above, a further 4 pieces of information (body system, number of occurrences, number of subjects, number exposed) for non-serious events, plus an extra three pieces of data for serious adverse events (numbers of causally related events, deaths, causally related deaths). This package prepares the required statistics needed by EudraCT and formats them into the precise requirements to directly upload an XML file into the web portal, with no further data entry by hand. |
Authors: | Simon Bond [cre], Beatrice Pantaleo [aut] |
Maintainer: | Simon Bond <[email protected]> |
License: | GPL-2 |
Version: | 1.0.2 |
Built: | 2024-11-28 20:46:29 UTC |
Source: | CRAN |
applies a conversion using xslt from a simple xml file to a ClinicalTrials.gov compatible file, and checks against the schema
clintrials_gov_convert( input, original, output, xslt = system.file("extdata", "simpleToCtGov.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_results = system.file("extdata", "RRSUploadSchema.xsd", package = "eudract"), schema_output = system.file("extdata", "ProtocolRecordSchema.xsd", package = "eudract"), soc = system.file("extdata", "soc.xml", package = "eudract") )
clintrials_gov_convert( input, original, output, xslt = system.file("extdata", "simpleToCtGov.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_results = system.file("extdata", "RRSUploadSchema.xsd", package = "eudract"), schema_output = system.file("extdata", "ProtocolRecordSchema.xsd", package = "eudract"), soc = system.file("extdata", "soc.xml", package = "eudract") )
input |
a character string giving the file path to the simple xml file |
original |
a character string giving the file path to the study file downloaded from ClinicalTrials.gov |
output |
a character string naming the output file |
xslt |
a character string giving the file path to the xslt script. Defaults to the script provided in this package |
schema_input |
a character string giving the file path to the schema for the simple xml file. Defaults to the schema provided in this package |
schema_results |
a character string giving the file path to the schema for the results section of the output. A copy was downloaded and is provided in this package as the default. |
schema_output |
a character string giving the file path to the schema for the overall output. A copy was downloaded and is provided in this package as the default. |
soc |
a character string giving an xml file that contains the System Organ Class look-up table going from EudraCT numbers to ClinicalTrials words. |
the output from the validation against the schema. A new file is created as a side-effect, which is suitable to upload into ClinicalTrials.gov. This over-writes the file given in original
with the additional safety events.
safety_summary
simple_safety_xml
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
applies a conversion using xslt from a simple xml file to a ClinicalTrials.gov compatible file, merges into a study record from the portal, and uploads the result.
clintrials_gov_upload( input, orgname, username, password, studyid, url = "https://register.clinicaltrials.gov/", check = interactive(), output = "study_file.xml", backup = "bak_study_file.xml", xslt = system.file("extdata", "simpleToCtGov.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_results = system.file("extdata", "RRSUploadSchema.xsd", package = "eudract"), schema_output = system.file("extdata", "ProtocolRecordSchema.xsd", package = "eudract"), soc = system.file("extdata", "soc.xml", package = "eudract") )
clintrials_gov_upload( input, orgname, username, password, studyid, url = "https://register.clinicaltrials.gov/", check = interactive(), output = "study_file.xml", backup = "bak_study_file.xml", xslt = system.file("extdata", "simpleToCtGov.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_results = system.file("extdata", "RRSUploadSchema.xsd", package = "eudract"), schema_output = system.file("extdata", "ProtocolRecordSchema.xsd", package = "eudract"), soc = system.file("extdata", "soc.xml", package = "eudract") )
input |
a character string giving the file path to the simple xml file |
orgname |
a character string giving the organisation name used to log in |
username |
a character string giving the user-name used to log in |
password |
a character string giving the password used to log in |
studyid |
a character string given the unique study id within the portal |
url |
a character string giving the URL of the website to log in. Defaults to the live site, but the testing site is the alternative. |
check |
a logical that will check on the command line if you want to proceed as results will be overwritten. Defaults to TRUE. |
output |
a character string naming the output xml file |
backup |
a character string naming the copy of the original data that is created. |
xslt |
a character string giving the file path to the xslt script. Defaults to the script provided in this package |
schema_input |
a character string giving the file path to the schema for the simple xml file. Defaults to the schema provided in this package |
schema_results |
a character string giving the file path to the schema for the results section of the output. A copy was downloaded and is provided in this package as the default. |
schema_output |
a character string giving the file path to the schema for the overall output. A copy was downloaded and is provided in this package as the default. |
soc |
a character string giving an xml file that contains the System Organ Class look-up table going from EudraCT numbers to ClinicalTrials words. |
Invisibly returns the results from the two API with the portal response
, POST
. A new file is created as a side-effect, which is uploaded into ClinicalTrials.gov. This over-writes the original safety data online with the additional safety events. A backup copy of the original data is also saved.
safety_summary
simple_safety_xml
[ClinicalTrials.gov manual](https://prsinfo.clinicaltrials.gov/prs-users-guide.html#section10)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
function that creates a safety_summary object from individual data.frames
create.safety_summary(group, non_serious, serious)
create.safety_summary(group, non_serious, serious)
group |
a data frame that contains the group-level statistics |
non_serious |
a data frame that contains the non-serious term-group level statistics |
serious |
a data frame that contains the serious term-group level statistics |
a safety_summary object
creates a dot-plot of safety data showing the absolute and relative risks
dot_plot( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95, text_width = 10, base = 2, valid_estimates = TRUE )
dot_plot( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95, text_width = 10, base = 2, valid_estimates = TRUE )
safety |
an object created by |
type |
a choice of "non_serious" (default) or "serious" as to which type of AE to report on |
reference |
character vector naming the reference arm for the calculations. Defaults to the first row of the safety$GROUP. |
size |
a number between 0-100, giving the size of the confidence interval. Default is 95. |
text_width |
Integer giving a target width to which the labels are wrapped. Defaults to 10. |
base |
numeric value to which a log scale uses as tick marks. Suggest powers of 2, or 5. |
valid_estimates |
a logical, which determines if only terms with valid estimates of relative risk are included in the table. The alternative is to include terms with zeroes. |
This is essentially a list of two ggplot objects joined together in a list, named as "left.panel" and "right.panel". They can each be individually edited if needed
a graphical object that shows the estimates and CI of relative and absolute risk.
safety_summary
relative_risk
[relative_risks()]
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( relative_risk(safety_statistics, type="serious") ) fig <- dot_plot(safety_statistics, type="non_serious", base=4) fig fig$left.panel <- fig$left.panel + ggplot2::labs(title="Absolute Risk") fig temp <- tempfile(fileext=".png") png(filename = temp) print(fig) dev.off()
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( relative_risk(safety_statistics, type="serious") ) fig <- dot_plot(safety_statistics, type="non_serious", base=4) fig fig$left.panel <- fig$left.panel + ggplot2::labs(title="Absolute Risk") fig temp <- tempfile(fileext=".png") png(filename = temp) print(fig) dev.off()
applies a conversion using xslt from a simple xml file to a eudract compatible file, and checks against the schema
eudract_convert( input, output, xslt = system.file("extdata", "simpleToEudraCT.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_output = system.file("extdata", "adverseEvents.xsd", package = "eudract") )
eudract_convert( input, output, xslt = system.file("extdata", "simpleToEudraCT.xslt", package = "eudract"), schema_input = system.file("extdata", "simple.xsd", package = "eudract"), schema_output = system.file("extdata", "adverseEvents.xsd", package = "eudract") )
input |
a character string giving the file path to the simple xml file |
output |
a character string naming the output file |
xslt |
a character string giving the file path to the xslt script. Defaults to the script provided in this package |
schema_input |
a character string giving the file path to the schema for the simple xml file. Defaults to the schema provided in this package |
schema_output |
a character string giving the file path to the schema. A copy was downloaded and is provided in this package as the default. |
the output from the validation against the schema. A new file is created as a side-effect, which is suitable to upload into eudraCT.
safety_summary
simple_safety_xml
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
provide standard structured tables to report incidence rates of AEs by arm
incidence_table(safety, type = c("non_serious", "serious"), percent_round = 0)
incidence_table(safety, type = c("non_serious", "serious"), percent_round = 0)
safety |
an object created by |
type |
a choice of "non_serious" (default) or "serious" as to which type of AE to report on |
percent_round |
integer giving the number of decimal places to round the incidence percentage. Default of 0. Maybe you need more if there is a large sample size and a rare event of interest |
a data.frame that can be directly printed as a table to a report. Each arm has its own column and the text contains "p% (r, o)", where r is the number of participants with the term, o is the number of occurrences, and p a percentage of participants with the term.
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( incidence_table(safety_statistics, type="serious") )
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( incidence_table(safety_statistics, type="serious") )
plot methods for dot_plot object
## S3 method for class 'dot_plot' plot(x, ...)
## S3 method for class 'dot_plot' plot(x, ...)
x |
dot_plot object |
... |
other arguments for generic methods |
print methods for dot_plot object
## S3 method for class 'dot_plot' print(x, ...)
## S3 method for class 'dot_plot' print(x, ...)
x |
dot_plot object |
... |
other arguments for generic methods |
Calculate relative risks to be reported or plotted as dot plot
relative_risk( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95 ) relative_risk_table( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95, digits = 3, valid_estimates = TRUE ) order_filter(rel_risk, threshold = 10)
relative_risk( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95 ) relative_risk_table( safety, type = c("non_serious", "serious"), reference = safety$GROUP$title[1], size = 95, digits = 3, valid_estimates = TRUE ) order_filter(rel_risk, threshold = 10)
safety |
an object created by |
type |
a choice of "non_serious" (default) or "serious" as to which type of AE to report on |
reference |
character vector naming the reference arm for the calculations. Defaults to the first row of the safety$GROUP. |
size |
a number between 0-100, giving the size of the confidence interval. Default is 95. |
digits |
integer giving the number of significant figures to report to. Default of 3. |
valid_estimates |
a logical, which determines if only terms with valid estimates of relative risk are included in the table. The alternative is to include terms with zeroes. |
rel_risk |
a relative risk object |
threshold |
a threshold on the percent scale, the max percentage for a term the incidence rate needs to exceed |
relative_risk
returns of list of four items.
"relative_risk" a data.frame that has the relative risk estimate and confidence intervals.
"percentage" a data.frame with absolute percentages.
"GROUP" a copy from the original safety_summary
object.
"reference" naming the reference group used to calculate relative risks
No adjustment made to deal with zeroes. This is suitable input for the dot_plot
function, and in most cases will not be
used directly, but may potentially be modified with filtration, or editing of terms, see order_filter
.
relative_risk_table
returns a data frame that is suitable for printing to a report, giving relative risks
order_filter
returns a revised relative risk object, with the terms concatenated with SOC if there are any duplicates,
then ordered by relative risk, into a factor, and filtered to only those terms with an incidence rate above
the threshold.
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( relative_risk(safety_statistics, type="serious") ) relative_risk_table(safety_statistics, type="serious") rr <- relative_risk(safety_statistics) rr2 <- order_filter(rr, threshold=2) dot_plot(rr2)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) head( relative_risk(safety_statistics, type="serious") ) relative_risk_table(safety_statistics, type="serious") rr <- relative_risk(safety_statistics) rr2 <- order_filter(rr, threshold=2) dot_plot(rr2)
A dataset containing some example data of safety event in raw source format
safety
safety
a data frame with 8 columns and 16 rows
meddra preferred term code
a unique subject identifier
a logical indicating if the event is related to the treatment
the meddra code for the System Organ Class
a numerical 0/1 to indicate if the event was fatal
a numerical 0/1 to indicate if the event was serious
the treatment group for the subject
a text description of the event. Needs to be matching 1-1 with the pt code
The data contains one row per patient-event. So the numbers exposed in each arm cannot be inferred from these data, as patients with no events will not be included in these data.
The variable names and formats are those required by safety_summary
. The variable pt
is not strictly required.
An alternative to soc
would be the equivalent character string from soc_code
Calculate frequency tables from a rectangular data frame with one row per subject-event
safety_summary( data, exposed, excess_deaths = 0, freq_threshold = 0, soc_index = c("meddra", "soc_term"), na.action = na.fail )
safety_summary( data, exposed, excess_deaths = 0, freq_threshold = 0, soc_index = c("meddra", "soc_term"), na.action = na.fail )
data |
a data set containing the following columns: |
exposed |
a numeric vector giving the numbers of subjects exposed in each group.
This needs to be supplied directly by the user, and cannot be inferred from the input |
excess_deaths |
a numeric vector giving the number of extra deaths not reported within |
freq_threshold |
a value on a percentage scale at which to remove events if the incidence falls below. Defaults to 0 |
soc_index |
a character vector either "meddra" or "soc_term", which is used to identify if the soc variable in data gives the numerical meddra code or the description in English. |
na.action |
a function that indicates what should happen if the data contain missing values. The default is |
a list of three dataframes: GROUP, SERIOUS, NON_SERIOUS. Each contains the summary statistics required by EudraCT, and is suitable for export.
eudract_convert
simple_safety_xml
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
creates a simple xml file from the input of a safety_summary object
simple_safety_xml( x, file, schema = system.file("extdata", "simple.xsd", package = "eudract") )
simple_safety_xml( x, file, schema = system.file("extdata", "simple.xsd", package = "eudract") )
x |
an object of class |
file |
a character string name the file to be created |
schema |
a character string giving the file path to the schema for the outputxml file. Defaults to the schema provided in this package. |
no output is returned, but a file is created as a side-effect.
eudract_convert
safety_summary
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
safety_statistics <- safety_summary(safety, exposed=c("Experimental"=60,"Control"=67)) simple <- tempfile(fileext = ".xml") eudract <- tempfile(fileext = ".xml") ct <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract) clintrials_gov_convert(input=simple, original=system.file("extdata", "1234.xml", package ="eudract"), output=ct) ## Not run: # This needs a real user account to work clintrials_gov_upload( input=simple, orgname="CTU", username="Student", password="Guinness", studyid="1234" ) ## End(Not run)
A dataset containing text descriptions and medDRA and EudraCT codes for each system organ class
soc_code
soc_code
a data frame with 3 columns and 27 rows
a text description
the eudraCT coding
the meddra code
https://www.meddra.org/, https://spor.ema.europa.eu/rmswi/#/