Eudract Safety XML


The European Clinical Trials Database Eudract is run by the European Medicines Agency. All studies that are officially registered clinical trials have to enter the results of the final analysis into the website to be made public. There is a large amount of documentation online that will not be repeated here.

The detailed entering of safety information is an onerous task if it is to be done by hand. However we do have the facility to upload an XML file to automate this step. This R package seeks to enable the production of an XML file from a standard structure of Safety data that is recorded on a patient-level.

The key functions are:

  • safety_summary
  • simple_safety_xml
  • eudract_convert

We provide a dummy safety data set that is one line per patient-event: ?safety. The format of the data, specifically the variable names is described in the help file printed below. This needs to be turned into several frequency tables: one given information at a group level; one given at the event level, broken down into serious and non-serious events. The term "group" here corresponds to treatment arms in a randomised control trial. You need to define a group within Eudract even if it is a one-armed study, in which case it can be a "dummy" label.

Some information is defined in a hard-coded fashion below, but it is understood that this will be generated by code if applied in real life. Each entry in the vectors below correspond to counts in each of the two groups.

subjectsExposed <- c("Control"=99,"Experimental"=101) #count of deaths not in the Safety data. Could be c(0,0) deathsExternal <- c("Control"=3,"Experimental"=5)

Coded adverse events are required to be helpful and avoid the task of reconciling minor spelling or text inconsistencies. This package and vignette assumes this is the case, and will not work in the absence of coding. We cannot provide the full MedDRA dictionary, due to copy right reasons. But normally this is available to sponsors. However, for upload into Eudract, as a minimal requirement, only the System Organ Class (SOC) needs to be fully coded into the Eudract internal version coding system. We have provided an internal data set, derived from the eutct site in the package to use this; see ?soc_code.

Safety data set

library(eudract) file <- utils:::.getHelpFile(help("safety")) tmp <- tempfile() tools:::Rd2HTML(file, out=tmp) out <- readLines(tmp) headfoot <- grep("body", out) cat(out[(headfoot[1] + 1):(headfoot[2] - 1)], sep = "\n")

Calculate Summary Statistics

We provide a function that derives the patient and event counts as required in a format internal to R.

safety_statistics <- safety_summary(safety, exposed=subjectsExposed, excess_deaths = deathsExternal, freq_threshold = 1 ) safety_statistics

Convert to XML

If you have produced these statistics through separate coding, then you can use the eudract:::create.summary_statistics() function to put them into the correct internal format and start the conversion to XML directly.

First we export the safety_statistics to a XML document that is human readable "simple.xml". Then we convert to the EudraCT format.

simple <- tempfile(fileext = ".xml") eudract_upload_file <- tempfile(fileext = ".xml") simple_safety_xml(safety_statistics, simple) eudract_convert(input=simple, output=eudract_upload_file)


The key output is safety_upload.xml.

We can validate the output against the XML schema provided by Eudract, although the call to eudract_convert() does also do this behind the scenes, returning the value TRUE if there are no errors against the schema validation. The schema, was downloaded to this package on 15NOV2016 - note this is a semi-readible file of code/data rather than a standard web page.

myschema <- xml2::read_xml(system.file("extdata","adverseEvents.xsd", package="eudract")) aes <- xml2::read_xml(eudract_upload_file) check <- xml2::xml_validate(aes,myschema) if(check){print("Validation against the schema has passed!")}


To use the resulting xml file navigate and log in online to the study specific area of the Eudract site. On the top banner is a link "Upload XML" which you follow. Choose the option "Adverse Events" rather than "Full data set", and select the file xml you have produced. The resulting information can be viewed in the browser interactively or with a static pdf file (note this is a fictitious study and fictitious data). This is not the only step in completing the Eudract report, as the description of the study, baseline characteristics and efficacy analysis will all need to be added. That is not the remit of this package though.