Package 'SwissASR'

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

Help Index


Fill the Annual Safety Report template

Description

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.

Usage

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
)

Arguments

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

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 imp, medical device, other. Abbreviations OK.

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

Details

Use of the var_tx argument results in the indicated variable being included in the line listing.

Value

nothing in R, creates a docx file in the target location

Examples

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"
#     )

Prepare data for the asr function

Description

This 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.

Usage

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
)

Arguments

data

dataframe containing safety data

trial_type

one of imp, medical device, other. Abbreviations OK.

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

Value

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

Examples

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())

Demonstration data set

Description

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.

Usage

asr_sae

Format

A data frame with the following variables:

sae_date

The date that the SAE occured

record_id

Participant ID

age

Participant age

sex

Participant sex

country

Participant's country

site

Which site the participant was recruited into

sae

Description of the SAE

intervention

Intervention arm

outcome

SAE outcome (e.g. fatal, sequel, improved, resolved)

comment

A comment about the SAE

trt

How was the participant treated?

class

SAE classification (SUSAR, SADR, ...)

expected

Was the SAE expected

devdef

(For device trials) was the SAE a device deficiency?

devattr

(For device trials) was the SAE attributable to the device?

devint

(For device trials) was the SAE attributable to the intervention?

safetymeasure

(For device trials) was the SAE a health hazards that required safety-related measures?

sae_n

SAE number/identifier

sae_trtstop

SAE treatment stop

sae_trtstart

SAE treatment start

related

Was the SAE related to the intervention


Summarize safety data

Description

This function creates the text and summary table for the report.

Usage

asr_safety_summary(data, period_data, trial_type, n_pat_e, n_per_arm)

Arguments

data

SAE data

period_data

SAE data restricted to a specific period

trial_type

trial type (imp, medical device or other)

n_pat_e

Number of enrolled participants

n_per_arm

Number of participants enrolled per arm

Value

txt

The sentences required for the report

tab

The summary table required for the report

tab_map

Mapping between the variable name in tab and a nicer label

Examples

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))