Skip to content

Commit

Permalink
Closes #11 in stata, plus warning added about length of group names
Browse files Browse the repository at this point in the history
R error created if group names are too short. V0.9.3 released.

SAS bug with merging soc_codes resolved.

guidance provided in FAQ on systematic & non-systematci
  • Loading branch information
shug0131 committed Feb 24, 2021
1 parent 83b2521 commit b1280e2
Show file tree
Hide file tree
Showing 23 changed files with 119 additions and 61 deletions.
6 changes: 3 additions & 3 deletions R/eudract/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: eudract
Type: Package
Title: Creates Safety Results Summary in XML to Upload to EudraCT
Date: 2020-04-03
Version: 0.9.2.9000
Date: 2021-02-24
Version: 0.9.3
Authors@R: c(
person("Simon", "Bond", email="simon.bond@addenbrookes.nhs.uk", role="cre"),
person("Beatrice","Pantaleo", email="bp403@medschl.cam.ac.uk", role="aut"))
Expand All @@ -15,7 +15,7 @@ Encoding: UTF-8
LazyData: true
Imports: tidyr, xslt, dplyr, xml2, utils, magrittr
Depends: R (>= 3.5.0)
RoxygenNote: 7.0.1
RoxygenNote: 7.1.0
Suggests:
testthat,
knitr,
Expand Down
2 changes: 1 addition & 1 deletion R/eudract/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2: do not edit by hand
# Generated by roxygen2: do not edit by hand

S3method(print,safety_summary)
export(create.safety_summary)
Expand Down
2 changes: 1 addition & 1 deletion R/eudract/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# eudract v0.9.3

Placeholder for the next version
Error is caused if any of the group names are less than 4 characters in length, as EudraCT will reject this.


# eudract v 0.9.2
Expand Down
2 changes: 2 additions & 0 deletions R/eudract/R/safety_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ safety_summary <- function(data, exposed, excess_deaths=0, freq_threshold=0, soc

data$group <- factor(as.character(data$group), levels=group_names)

#Check length of group name text
if( min(nchar(group_names))<4){stop("Group names must be at least 4 characters in length.")}

# check length, value and names of excess_deaths
if( length(excess_deaths)==1 && length(group_names)>1 && excess_deaths==0){
Expand Down
6 changes: 3 additions & 3 deletions R/eudract/build_dashboard.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ devtools::document(roclets = c('rd', 'collate', 'namespace'))
devtools::build()

#Check you've got the right version number
install.packages("../eudract_0.9.2.tar.gz",
install.packages("../eudract_0.9.3.tar.gz",
repos = NULL, type = "source")
devtools::build("../eudract_0.9.2.tar.gz", binary=TRUE)
devtools::build("../eudract_0.9.3.tar.gz", binary=TRUE)

install.packages("V:/STATISTICS/NON STUDY FOLDER/Software/R/R Code Library/cctu_0.9.2.zip",
install.packages("V:/STATISTICS/NON STUDY FOLDER/Software/R/R Code Library/eudract_0.9.3.zip",
repos = NULL, type="win.binary")

#devtools::build( binary=TRUE)
Expand Down
5 changes: 5 additions & 0 deletions R/eudract/cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Windows Server 2012 R2 x64 (build 9600) on (appveyor), R3.6.1
* check_win_release

## Change 24FEB2021

an error is created if input fails the check of group names being at least 4 characters in length.


## Change 03APR2020

Minor corrections to test code, setting a resetting options(StringsAsFactors).
Expand Down
22 changes: 11 additions & 11 deletions R/eudract/man/append_xml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R/eudract/man/create.safety_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions R/eudract/man/df_to_char.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R/eudract/man/eudract_convert.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions R/eudract/man/print.safety_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions R/eudract/man/safety.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R/eudract/man/safety_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R/eudract/man/simple_safety_xml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions R/eudract/man/soc_code.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions R/eudract/tests/testthat/test_errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ test_that("missing variable",{
expect_error(safety_summary(aes[,-2], exposed=c(700,750,730), soc_index = "soc_term"),"your input data are missing the following variables:")
})


test_that("Too short group names",{

aes <- read.csv(file.path(path,"data/events.csv"), stringsAsFactors = FALSE)
aes$group <- ifelse(aes$group=="Group A", "A", aes$group)
expect_error(safety_summary(aes, exposed=c(700,750,730), soc_index = "soc_term"),
"Group names must be at least 4 characters in length.")

})


test_that("exposed has too few elements",{
aes <- read.csv(file.path(path,"data/events.csv"), stringsAsFactors = FALSE)
expect_is(safety_summary(aes, exposed=c(700,750,730), soc_index = "soc_term"),"safety_summary")
Expand Down
2 changes: 1 addition & 1 deletion R/eudract/vignettes/eudract.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: "Simon Bond"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{eudract}
%\VignetteIndexEntry{Eudract Safety XML}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
Binary file added R/eudract_0.9.3.tar.gz
Binary file not shown.
Binary file added R/eudract_0.9.3.zip
Binary file not shown.
Binary file modified Stata/Stata Eudract Tools.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Stata/safety_scriptv0.2.do
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ save soc_code, replace

import delimited using ${datafile} , varnames(1) clear
save raw, replace

* The length of the group names must be 4 characters or longer


gen nonserious=1-serious
Expand Down
18 changes: 18 additions & 0 deletions docs/_posts/2021-02-24-stata-bug-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
layout: post
title: Stata bug fix and minor improvements.
date: 2021-02-24
---

A bug was identified in the stata code where the serious events were being used to
create the output for the non-serious events.

SAS code was in error if the SOC code linked to the soc_code data set using soc_term
rather than meddra code.

Comments added to SAS and Stata to warn that the group names need to be 4 characters
in length. An error is created in the R package for this scenario; new version
released on CRAN.

Advice provide in the FAQ on how to default to systematic, rather than non-systematic,
as the method of data collection.
18 changes: 18 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ to clean the data.
Yes, please do review and ammend by hand using the Eudract portal manually. You may want to confirm if study-wide default values
(AE dictionary, version number, incidence threshold,...) are accurate.

## Systematic vs Non-Systematic reporting

The majority of studies use non-systematic reporting, whereby a patient is asked what AEs happened to them.
The alternative is where a specific list of AEs is provided and the incidence of each AE is explicitly determined.

The default in the tool is to assume that non-systematic reporting was used.
To change this manually inside the EudraCT portal would require it to be done for each AE in the list,
which may be too many changes to be practical.

An automated alternative, _at the user's risk_, is to edit the final xslt file
[simpleToEudraCT.xlst]( {{ site.ghpath }}/xml%20tools/simpleToEudraCT.xslt)
in lines 15 and 71.

In the R package, this new xslt file would need to be saved locally and the filepath
used as an argument to the `xslt=` argument within `eudract_convert()` .
In SAS, line 297 in the script would need to be edited to use the revised xslt file.
In Stata, line 226 would need to be edited to use the revised xslt file.

## I want to use my own code to calculate the summary statistics

As described in the [Specification]( {{ site.ghpath }}/Specification/Eudract%20Tool%20Specification%20V0.3.docx?raw=true ) this is
Expand Down

0 comments on commit b1280e2

Please sign in to comment.