Title: | Automated Completion of the SwissEthics Annual Safety Report |
---|---|
Description: | Completing the SwissEthics Annual Safety Report can be tiresome. This package eases the pain by providing an automated method to fill it out. |
Authors: | Alan G. Haynes [aut, cre] , Mattia Branca [aut] |
Maintainer: | Alan G. Haynes <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.2 |
Built: | 2024-11-27 03:24:15 UTC |
Source: | https://github.com/CTU-Bern/SwissASR |
This function fills out the SwissEthics annual safety report template with a much as possible. Minor (formatting) changes will still be required after generation of the report.
asr( data, target = "tmp.docx", trial_title = "TRIAL NAME", protocol_number = "default", basec_number = "default", snctp_number = "default", swissmedic_number = "default", ec_name = "default", tr_number = "default", product_name = "default", sponsor_contact = "default name, default number, default email", inst_name_address = "default name, default address", n_centers_t = "default", n_centers_p = "default", n_centers_c = "default", n_centers_o = "default", n_pat_t = 500, n_pat_e = 300, n_pat_c = 100, n_pat_p = 15, n_centers_t_ch = "default", n_centers_p_ch = "default", n_centers_c_ch = "default", n_centers_o_ch = "default", n_pat_t_ch = 500, n_pat_e_ch = 300, n_pat_c_ch = 100, n_pat_p_ch = 15, n_per_arm = c(grp1 = 150, grp2 = 150), report_date = format(Sys.Date(), format = "%d/%m/%Y"), period_from = as.Date("2020-11-02"), period_to = as.Date("2020-11-17"), template = system.file("extdata/clino_annual_safety_report_fm.docx", package = "SwissASR"), international = FALSE, trial_type = "imp", var_class = "class", var_sae_n = "sae_n", var_part_id = "record_id", var_age = "age", var_sex = "sex", var_country = "country", var_site = "site", var_sae = "sae", var_date_onset = "sae_date", var_trt = "trt", var_date_trt_start = "sae_trtstart", var_date_trt_stop = "sae_trtstop", var_outcome = "outcome", var_comment = "comment", var_relation = "related", var_expected = "expected", var_devdef = "devdef", var_devattr = "devattr", var_devint = "devint", var_safetymeasure = "safetymeasure", var_tx = NULL )
asr( data, target = "tmp.docx", trial_title = "TRIAL NAME", protocol_number = "default", basec_number = "default", snctp_number = "default", swissmedic_number = "default", ec_name = "default", tr_number = "default", product_name = "default", sponsor_contact = "default name, default number, default email", inst_name_address = "default name, default address", n_centers_t = "default", n_centers_p = "default", n_centers_c = "default", n_centers_o = "default", n_pat_t = 500, n_pat_e = 300, n_pat_c = 100, n_pat_p = 15, n_centers_t_ch = "default", n_centers_p_ch = "default", n_centers_c_ch = "default", n_centers_o_ch = "default", n_pat_t_ch = 500, n_pat_e_ch = 300, n_pat_c_ch = 100, n_pat_p_ch = 15, n_per_arm = c(grp1 = 150, grp2 = 150), report_date = format(Sys.Date(), format = "%d/%m/%Y"), period_from = as.Date("2020-11-02"), period_to = as.Date("2020-11-17"), template = system.file("extdata/clino_annual_safety_report_fm.docx", package = "SwissASR"), international = FALSE, trial_type = "imp", var_class = "class", var_sae_n = "sae_n", var_part_id = "record_id", var_age = "age", var_sex = "sex", var_country = "country", var_site = "site", var_sae = "sae", var_date_onset = "sae_date", var_trt = "trt", var_date_trt_start = "sae_trtstart", var_date_trt_stop = "sae_trtstop", var_outcome = "outcome", var_comment = "comment", var_relation = "related", var_expected = "expected", var_devdef = "devdef", var_devattr = "devattr", var_devint = "devint", var_safetymeasure = "safetymeasure", var_tx = NULL )
data |
dataframe containing safety data |
target |
filename to save the report to |
trial_title |
name of the trial |
protocol_number |
trial code/protocol number |
basec_number |
BASEC number |
snctp_number |
SNCTP number |
swissmedic_number |
Swissmedic number |
ec_name |
EC name (Lead EC and/concerned EC) |
tr_number |
Number for Transplantation Clinical Trials (FOPH number) |
product_name |
product name or intervention |
sponsor_contact |
contact details of sponsor(-investigator) |
inst_name_address |
name and address of institute |
n_centers_t |
total number of participating centres |
n_centers_p |
planned number of participating centres |
n_centers_c |
number of closed centres |
n_centers_o |
number of open centres |
n_pat_t |
target number of participants |
n_pat_e |
number of enrolled participants |
n_pat_c |
number of completed participants |
n_pat_p |
number of prematurely terminated participants |
n_centers_t_ch |
total number of participating centres in CH |
n_centers_p_ch |
planned number of participating centres in CH |
n_centers_c_ch |
number of closed centres in CH |
n_centers_o_ch |
number of open centres in CH |
n_pat_t_ch |
target number of participants in CH |
n_pat_e_ch |
number of enrolled participants in CH |
n_pat_c_ch |
number of completed participants in CH |
n_pat_p_ch |
number of prematurely terminated participants in CH |
n_per_arm |
number of enrolled participants per arm, list with group 1 and 2, define here the names of your groups as in the data |
report_date |
report date |
period_from |
start of reporting period |
period_to |
end of reporting period |
template |
path to template file |
international |
internation or national trial (logical) |
trial_type |
one of |
var_class |
variable containing SAE class. Options allowed are "SAE", "SADR", "SUSAR" |
var_sae_n |
variable containing SAE ID |
var_part_id |
variable containing participant ID |
var_age |
variable containing participant age |
var_sex |
variable containing participant sex |
var_country |
variable containing participants country |
var_site |
variable containing participants site |
var_sae |
variable containing SAE type (description) |
var_date_onset |
variable containing the date the SAE occured |
var_trt |
variable containing the treatment used to alleviate the SAE |
var_date_trt_start |
variable containing the date that the treatment started |
var_date_trt_stop |
variable containing the date that the treatment ended |
var_outcome |
variable containing the outcome of the SAE |
var_comment |
variable containing any comment |
var_relation |
variable containing the relationship to randomized intervention |
var_expected |
variable saying whether the SAE was expected |
var_devdef |
variable containing whether the SAE is a device deficiency |
var_devattr |
variable containing whether the SAE is attributable to the device |
var_devint |
variable containing whether the SAE is attributable to an intervention in the trial |
var_safetymeasure |
variable containing whether the SAE required safety related measures |
var_tx |
variable indicating the intervention group. If provided, this variable will be included in the line listing |
Use of the var_tx
argument results in the indicated variable being included in the line listing.
nothing in R, creates a docx file in the target
location
data(asr_sae) file <- tempfile("asr", fileext = ".docx") asr(asr_sae, file) # # more usual use will require passing more information: # asr(asr_sae, file, # # trial info # trial_title = "Example Trial Name", # protocol_number = "20221002130", # basec_number = "", # snctp_number = "202200458", # swissmedic_number = "....", # ec_name = "Kantonale Ethikskommision Bern", # tr_number = "", # product_name = "Drug name", # international = FALSE, # trial_type = "imp", # # Sponsor info # sponsor_contact = "Sponsor name, Sponsor phone number, Sponsor email", # inst_name_address = "Institute name, Institute address", # # site info # n_centers_t = 20, # total number # n_centers_p = "default", # planned # n_centers_c = "default", # closed # n_centers_o = "default", # open # # participant info # n_pat_t = 1000, # target # n_pat_e = 300, # enrolled # n_pat_c = 0, # complete # n_pat_p = 0, # prematurely terminated # # report info # report_date = format(Sys.Date(), format = "%d/%m/%Y"), # period_from = as.Date("2020-11-02"), # period_to = as.Date("2020-11-17"), # # variable mapping # var_class = "class", # var_sae_n = "sae_n", #sae ID # var_part_id = "record_id", #participant ID # var_age = "age", # var_sex ="sex", # var_country = "country", # var_site = "site", # var_sae = "sae", # var_date_onset = "sae_date", # var_trt = "trt", # var_date_trt_start = "sae_trtstart", # var_date_trt_stop = "sae_trtstop", # var_outcome = "outcome", # var_comment = "comment", # var_relation = "related", # var_expected = "expected", # var_safetymeasure = "safetymeasure" # )
data(asr_sae) file <- tempfile("asr", fileext = ".docx") asr(asr_sae, file) # # more usual use will require passing more information: # asr(asr_sae, file, # # trial info # trial_title = "Example Trial Name", # protocol_number = "20221002130", # basec_number = "", # snctp_number = "202200458", # swissmedic_number = "....", # ec_name = "Kantonale Ethikskommision Bern", # tr_number = "", # product_name = "Drug name", # international = FALSE, # trial_type = "imp", # # Sponsor info # sponsor_contact = "Sponsor name, Sponsor phone number, Sponsor email", # inst_name_address = "Institute name, Institute address", # # site info # n_centers_t = 20, # total number # n_centers_p = "default", # planned # n_centers_c = "default", # closed # n_centers_o = "default", # open # # participant info # n_pat_t = 1000, # target # n_pat_e = 300, # enrolled # n_pat_c = 0, # complete # n_pat_p = 0, # prematurely terminated # # report info # report_date = format(Sys.Date(), format = "%d/%m/%Y"), # period_from = as.Date("2020-11-02"), # period_to = as.Date("2020-11-17"), # # variable mapping # var_class = "class", # var_sae_n = "sae_n", #sae ID # var_part_id = "record_id", #participant ID # var_age = "age", # var_sex ="sex", # var_country = "country", # var_site = "site", # var_sae = "sae", # var_date_onset = "sae_date", # var_trt = "trt", # var_date_trt_start = "sae_trtstart", # var_date_trt_stop = "sae_trtstop", # var_outcome = "outcome", # var_comment = "comment", # var_relation = "related", # var_expected = "expected", # var_safetymeasure = "safetymeasure" # )
asr
functionThis function allows the use of the asr_safety_summary
function outside
of the normal asr
function, which might be desirable to get an overview
of the information in a different format to MS Word.
asr_dataprep( data, trial_type = "imp", international = FALSE, period_from = NA, period_to = NA, var_class = "class", var_sae_n = "sae_n", var_part_id = "record_id", var_age = "age", var_sex = "sex", var_country = "country", var_site = "site", var_sae = "sae", var_date_onset = "sae_date", var_trt = "trt", var_date_trt_start = "sae_trtstart", var_date_trt_stop = "sae_trtstop", var_outcome = "outcome", var_comment = "comment", var_relation = "related", var_expected = "expected", var_devdef = "devdef", var_devattr = "devattr", var_devint = "devint", var_safetymeasure = "safetymeasure", var_tx = NULL )
asr_dataprep( data, trial_type = "imp", international = FALSE, period_from = NA, period_to = NA, var_class = "class", var_sae_n = "sae_n", var_part_id = "record_id", var_age = "age", var_sex = "sex", var_country = "country", var_site = "site", var_sae = "sae", var_date_onset = "sae_date", var_trt = "trt", var_date_trt_start = "sae_trtstart", var_date_trt_stop = "sae_trtstop", var_outcome = "outcome", var_comment = "comment", var_relation = "related", var_expected = "expected", var_devdef = "devdef", var_devattr = "devattr", var_devint = "devint", var_safetymeasure = "safetymeasure", var_tx = NULL )
data |
dataframe containing safety data |
trial_type |
one of |
international |
internation or national trial (logical) |
period_from |
start of reporting period |
period_to |
end of reporting period |
var_class |
variable containing SAE class. Options allowed are "SAE", "SADR", "SUSAR" |
var_sae_n |
variable containing SAE ID |
var_part_id |
variable containing participant ID |
var_age |
variable containing participant age |
var_sex |
variable containing participant sex |
var_country |
variable containing participants country |
var_site |
variable containing participants site |
var_sae |
variable containing SAE type (description) |
var_date_onset |
variable containing the date the SAE occured |
var_trt |
variable containing the treatment used to alleviate the SAE |
var_date_trt_start |
variable containing the date that the treatment started |
var_date_trt_stop |
variable containing the date that the treatment ended |
var_outcome |
variable containing the outcome of the SAE |
var_comment |
variable containing any comment |
var_relation |
variable containing the relationship to randomized intervention |
var_expected |
variable saying whether the SAE was expected |
var_devdef |
variable containing whether the SAE is a device deficiency |
var_devattr |
variable containing whether the SAE is attributable to the device |
var_devint |
variable containing whether the SAE is attributable to an intervention in the trial |
var_safetymeasure |
variable containing whether the SAE required safety related measures |
var_tx |
variable indicating the intervention group. If provided, this variable will be included in the line listing |
a list of 2 dataframes (data
containing all data submitted to
the function and period_data
which contains only the data for the relevant
period) with variables renamed to those expected by asr_safety_summary
data(asr_sae) # IMP asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10")) asr_dataprep(asr_sae, period_from = min(asr_sae$sae_date), period_to = Sys.Date())
data(asr_sae) # IMP asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10")) asr_dataprep(asr_sae, period_from = min(asr_sae$sae_date), period_to = Sys.Date())
Simulated recruitment data from three sites. Each row represents an SAE. Sites one and two started on 2020-07-01, site three on 2020-09-01.
asr_sae
asr_sae
A data frame with the following variables:
The date that the SAE occured
Participant ID
Participant age
Participant sex
Participant's country
Which site the participant was recruited into
Description of the SAE
Intervention arm
SAE outcome (e.g. fatal, sequel, improved, resolved)
A comment about the SAE
How was the participant treated?
SAE classification (SUSAR, SADR, ...)
Was the SAE expected
(For device trials) was the SAE a device deficiency?
(For device trials) was the SAE attributable to the device?
(For device trials) was the SAE attributable to the intervention?
(For device trials) was the SAE a health hazards that required safety-related measures?
SAE number/identifier
SAE treatment stop
SAE treatment start
Was the SAE related to the intervention
This function creates the text and summary table for the report.
asr_safety_summary(data, period_data, trial_type, n_pat_e, n_per_arm)
asr_safety_summary(data, period_data, trial_type, n_pat_e, n_per_arm)
data |
SAE data |
period_data |
SAE data restricted to a specific period |
trial_type |
trial type ( |
n_pat_e |
Number of enrolled participants |
n_per_arm |
Number of participants enrolled per arm |
The sentences required for the report
The summary table required for the report
Mapping between the variable name in tab
and a nicer label
data(asr_sae) # IMP prepped <- asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10") ) asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "imp", 60, n_per_arm = list(grp1 = 150, grp2 = 150)) # medical devices prepped <- asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10"), trial_type = "m") asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "m", 60, n_per_arm = list(grp1 = NA, grp2 = NA)) # other trial asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "o", 60, n_per_arm = list(grp1 = 150, grp2 = 150)) # tpr trial asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "t", 60, n_per_arm = list(grp1 = 150, grp2 = 150))
data(asr_sae) # IMP prepped <- asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10") ) asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "imp", 60, n_per_arm = list(grp1 = 150, grp2 = 150)) # medical devices prepped <- asr_dataprep(asr_sae, period_from = as.Date("2020-10-10"), period_to = as.Date("2021-10-10"), trial_type = "m") asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "m", 60, n_per_arm = list(grp1 = NA, grp2 = NA)) # other trial asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "o", 60, n_per_arm = list(grp1 = 150, grp2 = 150)) # tpr trial asr_safety_summary(data = prepped$data, period_data = prepped$period_data, "t", 60, n_per_arm = list(grp1 = 150, grp2 = 150))