diff --git a/deps/JetBrains_Mono-0.4.8/font.css b/deps/JetBrains_Mono-0.4.8/font.css index 395dd07..0d9466d 100644 --- a/deps/JetBrains_Mono-0.4.8/font.css +++ b/deps/JetBrains_Mono-0.4.8/font.css @@ -3,5 +3,5 @@ font-style: normal; font-weight: 400; font-display: swap; - src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff) format('woff'); + src: url(font?kit=tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg&skey=48ad01c60053c2ae&v=v18) format('woff'); } diff --git a/deps/JetBrains_Mono-0.4.8/font?kit=tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg&skey=48ad01c60053c2ae&v=v18 b/deps/JetBrains_Mono-0.4.8/font?kit=tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg&skey=48ad01c60053c2ae&v=v18 new file mode 100644 index 0000000..47db68d Binary files /dev/null and b/deps/JetBrains_Mono-0.4.8/font?kit=tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg&skey=48ad01c60053c2ae&v=v18 differ diff --git a/deps/Montserrat-0.4.8/font.css b/deps/Montserrat-0.4.8/font.css index 3691193..e56614e 100644 --- a/deps/Montserrat-0.4.8/font.css +++ b/deps/Montserrat-0.4.8/font.css @@ -3,5 +3,5 @@ font-style: normal; font-weight: 400; font-display: swap; - src: url(font?kit=JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew9&skey=7bc19f711c0de8f&v=v26) format('woff'); + src: url(JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew9.woff) format('woff'); } diff --git a/index.html b/index.html index 04f7acd..6b213e0 100644 --- a/index.html +++ b/index.html @@ -72,9 +72,7 @@ unbiased -
-

An API-based solution for Clinical Trial Randomization

-
+

Test CoverageDocsDocker Publishcodecov > An API-based solution for Clinical Trial Randomization

In clinical trials, the fair and efficient allocation of participants is essential for achieving reliable results. While there are many excellent R randomization packages available, none, to our knowledge, provide a dedicated API for this purpose. The unbiased package fills this gap by featuring a production-ready REST API designed for seamless integration. This unique combination allows for easy connection with electronic Case Report Forms (eCRF), enhancing data management and streamlining participant allocation.

Why choose unbiased? diff --git a/pkgdown.yml b/pkgdown.yml index 1f59a0e..a1e9c83 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: minimization_randomization_comparison: minimization_randomization_comparison.html -last_built: 2024-03-08T14:33Z +last_built: 2024-03-08T14:50Z urls: reference: https://ttscience.github.io/unbiased/reference article: https://ttscience.github.io/unbiased/articles diff --git a/search.json b/search.json index 37a900d..96be6c1 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://ttscience.github.io/unbiased/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Transition Technologies Science sp. z o.o. Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Benchmarking randomization methods","text":"Randomization clinical trials gold standard widely considered best design evaluating effectiveness new treatments compared alternative treatments (standard care) placebo. Indeed, selection appropriate randomisation important selection appropriate statistical analysis study analysis strategy, whether based randomisation population model (Berger et al. (2021)). One primary advantages randomization, particularly simple randomization (usually using flipping coin method), ability balance confounding variables across treatment groups. especially effective large sample sizes (n > 200), random allocation participants helps ensure known unknown confounders evenly distributed study arms. balanced distribution contributes significantly internal validity study, minimizes risk selection bias confounding influencing results (Lim (2019)). ’s important note, however, simple randomization powerful large trials, may always guarantee even distribution confounding factors trials smaller sample sizes (n < 100). cases, random allocation might result imbalances baseline characteristics groups, can affect interpretation treatment’s effectiveness. potential limitation sets stage considering additional methods, stratified randomization, dynamic minimization algorithms address challenges smaller trials (Kang, Ragan, Park (2008)). document provides summary comparison three randomization methods: simple randomization, block randomization, adaptive randomization. Simple randomization adaptive randomization (minimization method) tools available unbiased package randomize_simple randomize_minimisation_pocock functions (Sijko et al. (2024)). comparison aims demonstrate superiority adaptive randomization (minimization method) methods assessing least imbalance accompanying variables therapeutic groups. Monte Carlo simulations used generate data, utilizing simstudy package (Goldfeld Wujciak-Jens (2020)). Parameters binary distribution variables based data publication Mrozikiewicz-Rakowska et al. (2023) information researchers. document structure follows: first, based defined parameters, data simulated using Monte Carlo method single simulation; , generated patient data, appropriate groups assigned using three randomization methods; data summarized form descriptive statistics along relevant statistical test; next, data prepared .Rds format generated 1000 simulations loaded., results based standardised mean difference (SMD) test discussed visual form (boxplot, violin plot) percentage success achieved method given precision (tabular summary)","code":"# load packages library(unbiased) library(dplyr) library(simstudy) library(tableone) library(ggplot2) library(gt) library(gtsummary) library(truncnorm) library(tidyr) library(randomizeR)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"the-randomization-methods-considered-for-comparison","dir":"Articles","previous_headings":"","what":"The randomization methods considered for comparison","title":"Benchmarking randomization methods","text":"process comparing balance covariates among randomization methods, three randomization methods selected evaluation: simple randomization - simple coin toss, algorithm gives participants equal chances assigned particular arm. method’s advantage lies simplicity elimination predictability. However, due complete randomness, may lead imbalance sample sizes arms imbalances prognostic factors. large sample size (n > 200), simple randomisation gives similar number generated participants group. small sample size (n < 100), results imbalance (Kang, Ragan, Park (2008)). block randomization - randomization method takes account defined covariates patients. method involves assigning patients therapeutic arms blocks fixed size, recommendation blocks different sizes. , extent, reduces risk researchers predicting future arm assignments. contrast simple randomization, block method aims balance number patients within block, hence reducing overall imbalance arms (Rosenberger Lachin (2015)). adaptive randomization using minimization method based Pocock Simon (1975) algorithm - - randomization approach aims balance prognostic factors across treatment arms within clinical study. functions evaluating total imbalance factors time new patient considered study. minimization method computes overall imbalance potential arm assignment new patient, considering factors like variance specified criteria. patient assigned arm addition results smallest total imbalance. assignment deterministic made predetermined probability, ensuring level randomness arm allocation. method particularly useful trials multiple prognostic factors smaller studies traditional randomization might fail achieve balance.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"assessment-of-covariate-balance","dir":"Articles","previous_headings":"","what":"Assessment of covariate balance","title":"Benchmarking randomization methods","text":"proposed approach assessment randomization methods, primary objective evaluate method terms achieving balance specified covariates. assessment balance aims determine whether distributions covariates similarly balanced therapeutic group. Based literature, standardized mean differences (SMD) employed assessing balance (Berger et al. (2021)). SMD method one commonly used statistics assessing balance covariates, regardless unit measurement. statistical measure comparing differences two groups. covariates examined case expressed binary variables. case categorical variables, SMD calculated using following formula (Zhang et al. (2019)): \\[ SMD = \\frac{{p_1 - p_2}}{{\\sqrt{\\frac{{p_1 \\cdot (1 - p_1) + p_2 \\cdot (1 - p_2)}}{2}}}} \\], : \\(p_1\\) proportion first arm, \\(p_2\\) proportion second arm.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"definied-number-of-patients","dir":"Articles","previous_headings":"","what":"Definied number of patients","title":"Benchmarking randomization methods","text":"simulation, using real use case - planned FootCell study - non-commercial clinical research area civilisation diseases - guide data generation process. FootCell study, anticipated total 105 patients randomized trial. patients equally divided among three research groups - Group , Group B, Group C - group comprising 35 patients.","code":"# defined number of patients n <- 105"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"defining-parameters-for-monte-carlo-simulation","dir":"Articles","previous_headings":"","what":"Defining parameters for Monte-Carlo simulation","title":"Benchmarking randomization methods","text":"distribution parameters individual covariates, subsequently used validate randomization methods, defined using publication Mrozikiewicz-Rakowska et al. (2023) allogenic interventions.. publication describes effectiveness comparing therapy using ADSC (Adipose-Derived Stem Cells) gel versus standard therapy fibrin gel patients diabetic foot ulcer treatment. FootCell study also aims assess safety advanced therapy involving live ASCs (Adipose-Derived Stem Cells) treatment diabetic foot syndrome, considering two groups treated ADSCs (one two administrations) compared fibrin gel. Therefore, appropriate population data extracted publication determine distributions can maintained designing FootCell study. process defining study randomization, following covariates selected: gender [male/female], diabetes type [type /type II], HbA1c [9/9 11] [%], tpo2 [50/50] [mmHg], age [55/55] [years], wound size [2/2] [cm\\(^2\\)]. case variables gender diabetes type publication Mrozikiewicz-Rakowska et al. (2023), expressed form frequencies. remaining variables presented terms measures central tendency along indication variability, well minimum maximum values. determine parameters binary distribution, truncated normal distribution available truncnorm package utilized. truncated normal distribution often used statistics probability modeling dealing data constrained certain range. particularly useful want model random variable take values beyond certain limits (Burkardt (2014)). generate necessary information remaining covariates, function simulate_proportions_trunc written, utilizing rtruncnorm function (Mersmann et al. (2023)). parameters mean, sd, lower, upper taken publication based expertise regarding ranges parameters. results presented table, assuming outcome refers first category parameter.","code":"# simulate parameters using truncated normal distribution simulate_proportions_trunc <- function(n, lower, upper, mean, sd, threshold) { simulate_data <- rtruncnorm( n = n, a = lower, b = upper, mean = mean, sd = sd ) <= threshold sum(simulate_data == TRUE) / n } set.seed(123) data.frame( hba1c = simulate_proportions_trunc(1000, 0, 11, 7.41, 1.33, 9), tpo2 = simulate_proportions_trunc(1000, 30, 100, 53.4, 18.4, 50), age = simulate_proportions_trunc(1000, 0, 100, 59.2, 9.7, 55), wound_size = simulate_proportions_trunc(1000, 0, 20, 2.7, 2.28, 2) ) |> rename(\"wound size\" = wound_size) |> pivot_longer( cols = everything(), names_to = \"parametr\", values_to = \"proportions\" ) |> mutate(\"first catogory of strata\" = c(\"<=9\", \"<=50\", \"<=55\", \"<=2\")) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"generate-data-using-monte-carlo-simulations","dir":"Articles","previous_headings":"","what":"Generate data using Monte-Carlo simulations","title":"Benchmarking randomization methods","text":"Monte-Carlo simulations used accumulate data. method designed model variables based defined parameters. Variables defined using simstudy package, utilizing defData function (Goldfeld Wujciak-Jens (2020)). variables specify proportions, dist = 'binary' used define variables. Due likely association type diabetes age – meaning older patient, higher probability type II diabetes – relationship diabetes established defining age variable using logit function link = \"logit\". proportions gender diabetes defined researchers consistent literature Mrozikiewicz-Rakowska et al. (2023). Using genData function simstudy package, data frame (data) generated artificially adopted variable arm, filled subsequent randomization methods arm allocation process n patients.","code":"# defining variables # male - 0.9 def <- simstudy::defData(varname = \"sex\", formula = \"0.9\", dist = \"binary\") # type I - 0.15 def <- simstudy::defData(def, varname = \"diabetes_type\", formula = \"0.15\", dist = \"binary\") # <= 9 - 0.888 def <- simstudy::defData(def, varname = \"hba1c\", formula = \"0.888\", dist = \"binary\") # <= 50 - 0.354 def <- simstudy::defData(def, varname = \"tpo2\", formula = \"0.354\", dist = \"binary\") # correlation with diabetes type def <- simstudy::defData( def, varname = \"age\", formula = \"(diabetes_type == 0) * (-0.95)\", link = \"logit\", dist = \"binary\" ) # <= 2 - 0.302 def <- simstudy::defData(def, varname = \"wound_size\", formula = \"0.302\", dist = \"binary\") # generate data using genData() data <- genData(n, def) |> mutate( sex = as.character(sex), age = as.character(age), diabetes_type = as.character(diabetes_type), hba1c = as.character(hba1c), tpo2 = as.character(tpo2), wound_size = as.character(wound_size) ) |> as_tibble() # add arm to tibble data <- data |> tibble::add_column(arm = \"\") # first 5 rows of the data head(data, 5) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"minimization-randomization","dir":"Articles","previous_headings":"","what":"Minimization randomization","title":"Benchmarking randomization methods","text":"generate appropriate research arms, function called minimize_results written, utilizing randomize_minimisation_pocock function available within unbiased package (Sijko et al. (2024)). probability parameter set level defined within function (p = 0.85). case minimization randomization, verify type minimization (equal weights unequal weights) used, three calls minimize_results function prepared: minimize_equal_weights - covariate weight takes value equal 1 divided number covariates. case, weight 1/6, minimize_unequal_weights - following expert assessment physicians, parameters potentially significant impact treatment outcomes (hba1c, tpo2, wound size) assigned weight 2. remaining covariates assigned weight 1. minimize_unequal_weights_3 - following expert assessment physicians, parameters potentially significant impact treatment outcomes (hba1c, tpo2, wound size) assigned weight 3. remaining covariates assigned weight 1. tables present information allocations first 5 patients. statistic_table function developed provide information : distribution number patients across research arms, distribution covariates across research arms, along p-value information statistical analyses used compare proportions - chi^2, exact Fisher’s test, typically used small samples. function relies use tbl_summary function available gtsummary package (Sjoberg et al. (2021)). table presents statistical summary results first iteration : Minimization weights equal 1/6. Minimization weights 2:1. Minimization weights 3:1.","code":"# drawing an arm for each patient minimize_results <- function(current_data, arms, weights) { for (n in seq_len(nrow(current_data))) { current_state <- current_data[1:n, 2:ncol(current_data)] current_data$arm[n] <- randomize_minimisation_pocock( arms = arms, current_state = current_state, weights = weights ) } return(current_data) } set.seed(123) # eqal weights - 1/6 minimize_equal_weights <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\") ) head(minimize_equal_weights, 5) |> gt() set.seed(123) # double weights where the covariant is of high clinical significance minimize_unequal_weights <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), weights = c( \"sex\" = 1, \"diabetes_type\" = 1, \"hba1c\" = 2, \"tpo2\" = 2, \"age\" = 1, \"wound_size\" = 2 ) ) head(minimize_unequal_weights, 5) |> gt() set.seed(123) # triple weights where the covariant is of high clinical significance minimize_unequal_weights_3 <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), weights = c( \"sex\" = 1, \"diabetes_type\" = 1, \"hba1c\" = 3, \"tpo2\" = 3, \"age\" = 1, \"wound_size\" = 3 ) ) head(minimize_unequal_weights_3, 5) |> gt() # generation of frequency and chi^2 statistic values or fisher exact test statistics_table <- function(data) { data |> mutate( sex = ifelse(sex == \"1\", \"men\", \"women\"), diabetes_type = ifelse(diabetes_type == \"1\", \"type1\", \"type2\"), hba1c = ifelse(hba1c == \"1\", \"<=9\", \"(9,11>\"), tpo2 = ifelse(tpo2 == \"1\", \"<=50\", \">50\"), age = ifelse(age == \"1\", \"<=55\", \">55\"), wound_size = ifelse(wound_size == \"1\", \"<=2\", \">2\") ) |> tbl_summary( include = c(sex, diabetes_type, hba1c, tpo2, age, wound_size), by = arm ) |> modify_header(label = \"\") |> modify_header(all_stat_cols() ~ \"**{level}**, N = {n}\") |> bold_labels() |> add_p() } statistics_table(minimize_equal_weights) statistics_table(minimize_unequal_weights) statistics_table(minimize_unequal_weights_3)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"simple-randomization","dir":"Articles","previous_headings":"","what":"Simple randomization","title":"Benchmarking randomization methods","text":"next step, appropriate arms generated patients using simple randomization, available unbiased package - randomize_simple function (Sijko et al. (2024)). simple_results function called within simple_data, considering initial assumption assigning patients three arms 1:1:1 ratio. Since simple randomization, take account initial covariates, treatment assignment occurs randomly (flip coin method). tables illustrate example data output summary statistics including summary statistical tests.","code":"# simple randomization simple_results <- function(current_data, arms, ratio) { for (n in seq_len(nrow(current_data))) { current_data$arm[n] <- randomize_simple(arms, ratio) } return(current_data) } set.seed(123) simple_data <- simple_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), ratio = c(\"armB\" = 1L, \"armA\" = 1L, \"armC\" = 1L) ) head(simple_data, 5) |> gt() statistics_table(simple_data)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"block-randomization","dir":"Articles","previous_headings":"","what":"Block randomization","title":"Benchmarking randomization methods","text":"Block randomization, opposed minimization simple randomization methods, developed based rbprPar function available randomizeR package (Uschner et al. (2018)). Using , block_rand function created, , based defined number patients, arms, list stratifying factors, generates randomization list length equal number patients multiplied product categories covariate. case specified data document, one iteration, amounts 105 * 2^6 = 6720 rows. ensures appropriate number randomisation codes opportunity. case equal characteristics, certain right number codes defined n patients. Based block_rand function, possible generate randomisation list, based patients allocated, characteristics output data frame. Due 3 arms need blind allocation consecutive patients, block sizes 3,6 9 used calculations. next step, patients assigned research groups using block_results function (based list generated function block_rand). first available code randomization list meets specific conditions selected, removed list available codes. Based , research arms generated ensure appropriate number patients group (based assumed ratio 1:1:1). tables show assignment patients groups using block randomisation summary statistics including summary statistical tests.","code":"# Function to generate a randomisation list block_rand <- function(n, block, n_groups, strata, arms = LETTERS[1:n_groups]) { strata_grid <- expand.grid(strata) strata_n <- nrow(strata_grid) ratio <- rep(1, n_groups) gen_seq_list <- lapply(seq_len(strata_n), function(i) { rand <- rpbrPar( N = n, rb = block, K = n_groups, ratio = ratio, groups = arms, filledBlock = FALSE ) getRandList(genSeq(rand))[1, ] }) df_list <- tibble::tibble() for (i in seq_len(strata_n)) { local_df <- strata_grid |> dplyr::slice(i) |> dplyr::mutate(count_n = n) |> tidyr::uncount(count_n) |> tibble::add_column(rand_arm = gen_seq_list[[i]]) df_list <- rbind(local_df, df_list) } return(df_list) } # Generate a research arm for patients in each iteration block_results <- function(current_data) { simulation_result <- block_rand( n = n, block = c(3, 6, 9), n_groups = 3, strata = list( sex = c(\"0\", \"1\"), diabetes_type = c(\"0\", \"1\"), hba1c = c(\"0\", \"1\"), tpo2 = c(\"0\", \"1\"), age = c(\"0\", \"1\"), wound_size = c(\"0\", \"1\") ), arms = c(\"armA\", \"armB\", \"armC\") ) for (n in seq_len(nrow(current_data))) { # \"-1\" is for \"arm\" column current_state <- current_data[n, 2:(ncol(current_data) - 1)] matching_rows <- which(apply( simulation_result[, -ncol(simulation_result)], 1, function(row) all(row == current_state) )) if (length(matching_rows) > 0) { current_data$arm[n] <- simulation_result[matching_rows[1], \"rand_arm\"] # Delete row from randomization list simulation_result <- simulation_result[-matching_rows[1], , drop = FALSE] } } return(current_data) } set.seed(123) block_data <- block_results(data) head(block_data, 5) |> gt() statistics_table(block_data)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"generate-1000-simulations","dir":"Articles","previous_headings":"","what":"Generate 1000 simulations","title":"Benchmarking randomization methods","text":"performed 1000 iterations data generation parameters defined . number iterations indicates number iterations included Monte-Carlo simulations accumulate data given parameters. allowed generation data 1000 times 105 patients efficiently assess effect randomization methods context covariate balance. data assigned variable sim_data based data stored .Rds file 1000_sim_data.Rds, available within vignette information GitHub repository unbiased package.","code":"# define number of iterations # no_of_iterations <- 1000 # nolint # define number of cores # no_of_cores <- 20 # nolint # perform simulations (run carefully!) # source(\"~/unbiased/vignettes/helpers/run_parallel.R\") # nolint # read data from file sim_data <- readRDS(\"1000_sim_data.Rds\")"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"check-balance-using-smd-test","dir":"Articles","previous_headings":"","what":"Check balance using smd test","title":"Benchmarking randomization methods","text":"order select test define precision specified level, assume imbalance, literature analysis conducted based publications Lee et al. (2021), Austin (2009), Doah et al. (2021), Brown et al. (2020), Nguyen et al. (2017), Sánchez-Meca, Marı́n-Martı́nez, Chacón-Moscoso (2003), Lee, Acharya, et al. (2022), Berger et al. (2021). assess balance covariates research groups , B, C, Standardized Mean Difference (SMD) test employed, compares two groups. Since three groups example, SMD test computed pair comparisons: vs B, vs C, B vs C. average SMD test given covariate calculated based comparisons. literature analysis, precision level ranged 0.1-0.2. small samples, expected SMD test exceed 0.2 (Austin (2009)). Additionally, according publication Sánchez-Meca, Marı́n-Martı́nez, Chacón-Moscoso (2003), golden standard dictates specific threshold SMD test considered balanced. Generally, smaller SMD test, smaller difference covariate imbalance. analyzed example, due sample size 105 patients, threshold 0.2 SMD test adopted. function called smd_covariants_data written generate frames produce SMD test covariate iteration, utilizing CreateTableOne function available tableone package (Yoshida Bartel (2022)). cases test result <0.001, value 0 assigned. results randomization method stored cov_balance_data. results SMD test presented form boxplot violin plot, depicting outcomes randomization method. red dashed line indicates adopted precision threshold. Boxplot combined results Summary average smd randomization methods Violin plot Summary smd randomization methods covariants Summary table success Based specified precision threshold 0.2, function defining randomization success, named success_power, developed. SMD test value covariate given iteration 0.2, function defines analysis data ‘failure’ - 0; otherwise, defined ‘success’ - 1. final success power calculated sum successes iteration divided total number specified iterations. results summarized table percentage success randomization method.","code":"# definied covariants vars <- c(\"sex\", \"age\", \"diabetes_type\", \"wound_size\", \"tpo2\", \"hba1c\") smd_covariants_data <- function(data, vars, strata) { result_table <- lapply(unique(data$simnr), function(i) { current_data <- data[data$simnr == i, ] arms_to_check <- setdiff(names(current_data), c(vars, \"id\", \"simnr\")) # check SMD for any covariants lapply(arms_to_check, function(arm) { tab <- CreateTableOne( vars = vars, data = current_data, strata = arm ) results_smd <- ExtractSmd(tab) |> as.data.frame() |> tibble::rownames_to_column(\"covariants\") |> select(covariants, results = average) |> mutate(results = round(as.numeric(results), 3)) results <- bind_cols( simnr = i, strata = arm, results_smd ) return(results) }) |> bind_rows() }) |> bind_rows() return(result_table) } cov_balance_data <- smd_covariants_data( data = sim_data, vars = vars ) |> mutate(method = case_when( strata == \"minimize_equal_weights_arms\" ~ \"minimize equal\", strata == \"minimize_unequal_weights_arms\" ~ \"minimize unequal 2:1\", strata == \"minimize_unequal_weights_triple_arms\" ~ \"minimize unequal 3:1\", strata == \"simple_data_arms\" ~ \"simple randomization\", strata == \"block_data_arms\" ~ \"block randomization\" )) |> select(-strata) # boxplot cov_balance_data |> select(simnr, results, method) |> group_by(simnr, method) |> mutate(results = mean(results)) |> distinct() |> ggplot(aes(x = method, y = results, fill = method)) + geom_boxplot() + geom_hline(yintercept = 0.2, linetype = \"dashed\", color = \"red\") + theme_bw() # violin plot cov_balance_data |> ggplot(aes(x = method, y = results, fill = method)) + geom_violin() + geom_hline( yintercept = 0.2, linetype = \"dashed\", color = \"red\" ) + facet_wrap(~covariants, ncol = 3) + theme_bw() + theme(axis.text = element_text(angle = 45, vjust = 0.5, hjust = 1)) # function defining success of randomisation success_power <- function(cov_data) { result_table <- lapply(unique(cov_data$simnr), function(i) { current_data <- cov_data[cov_data$simnr == i, ] current_data |> group_by(method) |> summarise(success = ifelse(any(results > 0.2), 0, 1)) |> tibble::add_column(simnr = i, .before = 1) }) |> bind_rows() success <- result_table |> group_by(method) |> summarise(results_power = sum(success) / n() * 100) return(success) } success_power(cov_balance_data) |> as.data.frame() |> rename(`power results [%]` = results_power) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Benchmarking randomization methods","text":"Considering three randomization methods: minimization, block randomization, simple randomization, minimization performs best terms covariate balance. Simple randomization significant drawback, patient allocation arms occurs randomly equal probability. leads imbalance number patients covariate balance, also random. particularly case small samples. Balancing number patients possible larger samples n > 200. hand, block randomization performs well balancing number patients groups specified allocation ratio. However, compared adaptive randomisation using minimisation method, block randomisation lower probability terms balancing co-variables. Minimization method, provides highest success power ensuring balance across covariates groups. made possible appropriate algorithm implemented part minimisation randomisation. assigning next patient group, method examines total imbalance assigns patient appropriate study group specified probability balance sample terms size, covariates.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kamil Sijko. Author, maintainer. Kinga Sałata. Author. Aleksandra Duda. Author. Łukasz Wałejko. Author. Jagoda Głowacka-Walas. Author. Laura Bąkała. Author. Michał Seweryn. Contributor. Transition Technologies Science Sp. z o.o.. Funder, copyright holder.","code":""},{"path":"https://ttscience.github.io/unbiased/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sijko K, Sałata K, Duda , Wałejko Ł, Głowacka-Walas J, Bąkała L (2024). unbiased: Unbiased: Production-Grade Randomization API. R package version 1.0.0, https://ttscience.github.io/unbiased/.","code":"@Manual{, title = {unbiased: Unbiased: Production-Grade Randomization API}, author = {Kamil Sijko and Kinga Sałata and Aleksandra Duda and Łukasz Wałejko and Jagoda Głowacka-Walas and Laura Bąkała}, year = {2024}, note = {R package version 1.0.0}, url = {https://ttscience.github.io/unbiased/}, }"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"unbiased-","dir":"","previous_headings":"","what":"Unbiased: Production-Grade Randomization API","title":"Unbiased: Production-Grade Randomization API","text":"API-based solution Clinical Trial Randomization clinical trials, fair efficient allocation participants essential achieving reliable results. many excellent R randomization packages available, none, knowledge, provide dedicated API purpose. unbiased package fills gap featuring production-ready REST API designed seamless integration. unique combination allows easy connection electronic Case Report Forms (eCRF), enhancing data management streamlining participant allocation.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"why-choose-unbiased","dir":"","previous_headings":"","what":"Why choose unbiased?","title":"Unbiased: Production-Grade Randomization API","text":"goal creating unbiased provide user-friendly yet powerful tool addresses nuanced demands clinical trial randomization. offers: Production-Ready REST API: Built seamless integration eCRF/EDC systems, facilitating real-time randomization automation. Extensive Database Integration: Supports robust data management practices, ensuring participant information randomization outcomes securely managed easily accessible. Commitment Quality: Emphasizes development best practices, including comprehensive code coverage, deliver reliable trustworthy solution. Adaptability: Whether small-scale studies large, multi-center trials, unbiased scales meet needs. Comprehensive Documentation: support applying package effectively. choosing unbiased, ’re adopting sophisticated approach trial randomization, ensuring fair efficient participant allocation across studies support broader objectives clinical research technology.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"table-of-contents","dir":"","previous_headings":"","what":"Table of Contents","title":"Unbiased: Production-Grade Randomization API","text":"Quick Setup Docker Compose Quick Setup Docker API Server Configuration Alternative Installation Method Study Creation Patient Randomization Study List Study Details Randomization List Audit Log Quality Assurance Measures Executing Tests R Interactive Session Executing Tests Command Line Running Tests Docker Compose Code Coverage Configuring Sentry Purpose Scope Clinical Trial Randomization Comparison Solutions","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quickstart-guide","dir":"","previous_headings":"","what":"Quickstart Guide","title":"Unbiased: Production-Grade Randomization API","text":"Initiating work unbiased involves simple setup steps. Whether ’re integrating R environment deploying API, aim equip reliable tool enhances integrity efficiency clinical trials.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quick-setup-with-docker-compose","dir":"","previous_headings":"","what":"Quick Setup with Docker Compose","title":"Unbiased: Production-Grade Randomization API","text":"prepared simple Docker Compose setup allows run unbiased minimal configuration. method ideal users want quickly test unbiased locally development environment. get started, follow steps: Clone unbiased repository local machine just copy docker-compose.yml file repository. Navigate directory containing docker-compose.yml file. Run following command start unbiased: command start unbiased API server, making accessible specified port. PostgreSQL also started, ensuring API can connect database. can use docker-compose.yml file starting point deployment, modifying suit specific requirements.","code":"docker compose pull docker compose up"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"configuration","dir":"","previous_headings":"Quick Setup with Docker Compose","what":"Configuration","title":"Unbiased: Production-Grade Randomization API","text":"docker-compose.yml file contains necessary configuration running unbiased Docker Compose. can override default environment variables creating .env file directory docker-compose.yml file. following environment variables can set: UNBIASED_PORT: port API listen. Defaults 3838 provided. POSTGRES_USER: username authentication PostgreSQL database. Defaults postgres provided. POSTGRES_PASSWORD: password authentication PostgreSQL database. Warning: can set first run, work database already exists. Defaults postgres provided. UNBIASED_VERSION: version unbiased Docker image use. Defaults latest provided. POSTGRES_VERSION: version PostgreSQL Docker image use. Defaults latest provided.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"building-the-docker-image-locally","dir":"","previous_headings":"Quick Setup with Docker Compose","what":"Building the Docker Image Locally","title":"Unbiased: Production-Grade Randomization API","text":"cloned repository, can also build Docker image locally using following command:","code":"docker compose build"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quick-setup-with-docker","dir":"","previous_headings":"","what":"Quick Setup with Docker","title":"Unbiased: Production-Grade Randomization API","text":"straightforward way deploy unbiased Docker images. ensures can get unbiased running minimal setup, regardless local environment. use unbiased, pull latest Docker image: run unbiased Docker, ensuring set necessary environment variables: command starts unbiased API, making accessible specified port. ’s crucial PostgreSQL database ready, unbiased automatically configure necessary database structures upon startup. PostgreSQL can run separate container local machine. Make sure use PostgreSQL instance temporal_tables extension available. can use ghcr.io/ttscience/postgres-temporal-tables/postgres-temporal-tables:latest image run PostgreSQL temporal_tables extension.","code":"docker pull ghcr.io/ttscience/unbiased docker run -e POSTGRES_DB=mydb -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mypassword -e UNBIASED_PORT=3838 ghcr.io/ttscience/unbiased"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"api-server-configuration","dir":"","previous_headings":"","what":"API Server configuration","title":"Unbiased: Production-Grade Randomization API","text":"unbiased API server can configured using environment variables. following environment variables need set server start: POSTGRES_DB: name PostgreSQL database connect . POSTGRES_HOST: host PostgreSQL database. hostname, localhost database.example.com, IP address. POSTGRES_PORT: port PostgreSQL database listening. Defaults 5432 provided. POSTGRES_USER: username authentication PostgreSQL database. POSTGRES_PASSWORD: password authentication PostgreSQL database. UNBIASED_HOST: host API run. Defaults 0.0.0.0 provided. UNBIASED_PORT: port API listen. Defaults 3838 provided.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"alternative-installation-method","dir":"","previous_headings":"","what":"Alternative Installation Method","title":"Unbiased: Production-Grade Randomization API","text":"preferring work directly within R environment, unbiased package offers alternative installation method via GitHub. approach allows users easily integrate unbiased R projects. proceed method, utilize devtools package installation executing following command: Following package installation, unbiased API can launched within R. Simply invoke run_unbiased() function start API: initiates API server, default, local machine (http://localhost:3838), making accessible interaction various HTTP clients, including curl, Postman, R’s httr package.","code":"devtools::install_github(\"ttscience/unbiased\") unbiased::run_unbiased()"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"getting-started-with-unbiased","dir":"","previous_headings":"","what":"Getting started with unbiased","title":"Unbiased: Production-Grade Randomization API","text":"unbiased package offers functions randomizing participants clinical trials, ensuring fair transparent process. Complete documentation implemented methodology examples use available GitHub Pages, providing information need integrate unbiased trial management workflow. , present basic steps using unbiased API.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"api-endpoints","dir":"","previous_headings":"","what":"API Endpoints","title":"Unbiased: Production-Grade Randomization API","text":"unbiased API designed facilitate clinical trial management set endpoints: Study Management: Create configure new studies, including specifying randomization parameters treatment arms. Participant Randomization: Dynamically randomize participants treatment groups based study’s configuration existing participant data. Study List: List previously defined studies. Study Details: Show details selected study. Randomization List: Generate list randomized patients selected study. Audit Log: Show audit log selected study.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-creation","dir":"","previous_headings":"API Endpoints","what":"Study Creation","title":"Unbiased: Production-Grade Randomization API","text":"initialize study using Pocock’s minimization method, use POST /minimisation_pocock endpoint. required JSON payload detail study, including treatment groups, allocation ratios, covariates. endpoint sets study returns ID accessing study-related endpoints.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"patient-randomization","dir":"","previous_headings":"API Endpoints","what":"Patient Randomization","title":"Unbiased: Production-Grade Randomization API","text":"POST /{study_id}/patient endpoint assigns new patient treatment group, requiring patient details covariate information JSON payload. endpoint determines patient’s treatment group.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-list","dir":"","previous_headings":"API Endpoints","what":"Study List","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/ endpoint allow list previously defined studies. returns information : Study ID Identifier Name study Randomization method Last edit date","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-details","dir":"","previous_headings":"API Endpoints","what":"Study Details","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id} endpoint allows retrieve details selected study. response body return: Name study Randomization method Last edit date Input parameters Strata","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"randomization-list","dir":"","previous_headings":"API Endpoints","what":"Randomization List","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id}/randomization_list endpoint allows generate list randomized patients along assigned study arms.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"audit-log","dir":"","previous_headings":"API Endpoints","what":"Audit Log","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id}/audit endpoint allows print records audit log selected study. response body includes following information: Log ID Creation date Type event Request ID Study ID Endpoint URL Request method Request body study definition Response code Response body study details endpoint facilitates tracking history requests sent database, along corresponding responses. enables us trace actions involving API.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/index.html","id":"running-tests","dir":"","previous_headings":"","what":"Running Tests","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased provides extensive collection tests ensure correct functionality.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"executing-tests-from-an-r-interactive-session","dir":"","previous_headings":"Running Tests","what":"Executing Tests from an R Interactive Session","title":"Unbiased: Production-Grade Randomization API","text":"execute tests using interactive R session, run following commands: Make sure devtools package installed environment. Ensure necessary database connection environment variables set running tests. can set environment variables using methods Sys.setenv. Running tests start Unbiased API random port.","code":"devtools::load_all() testthat::test_package(**unbiased**)"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"executing-tests-from-the-command-line","dir":"","previous_headings":"Running Tests","what":"Executing Tests from the Command Line","title":"Unbiased: Production-Grade Randomization API","text":"Use helper script run_tests.sh execute tests command line. Remember set database connection environment variables running tests.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"running-tests-with-docker-compose","dir":"","previous_headings":"Running Tests","what":"Running Tests with Docker Compose","title":"Unbiased: Production-Grade Randomization API","text":"Docker Compose can used build Unbiased Docker image execute tests. can done using provided docker-compose.test.yml file. method ensures consistent testing environment simplifies setup process.","code":"docker compose -f docker-compose.test.yml build docker compose -f docker-compose.test.yml run tests"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"code-coverage","dir":"","previous_headings":"Running Tests","what":"Code Coverage","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased supports code coverage analysis covr package. allows measure effectiveness tests showing parts R code R directory actually tested. calculate code coverage, need install covr package. installed, can use following methods: covr::report(): method runs tests generates detailed coverage report HTML format. covr::package_coverage(): method provides simpler, text-based code coverage report. Alternatively, can use provided run_tests_with_coverage.sh script run Unbiased tests code coverage.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"configuring-sentry","dir":"","previous_headings":"Running Tests","what":"Configuring Sentry","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased server offers robust error reporting capabilities integration Sentry service. activate Sentry, simply set SENTRY_DSN environment variable. Additionally, flexibility customize setup configuring following environment variables: SENTRY_ENVIRONMENT used set environment (e.g., “production”, “staging”, “development”). set, environment defaults “development”. SENTRY_RELEASE used set release Sentry. set, release defaults “unspecified”.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/index.html","id":"purpose-and-scope-for-clinical-trial-randomization","dir":"","previous_headings":"","what":"Purpose and Scope for Clinical Trial Randomization","title":"Unbiased: Production-Grade Randomization API","text":"Randomization gold standard conducting clinical trials fundamental aspect clinical trials, studies comparing two arms. cases randomization desirable technique ensure patients randomly allocated defined groups. essential maintaining integrity trial ensuring results reliable, blinding research personnel. However, situations desirable studies balance patients terms numbers group , addition, achieve balance respect relevant factors, sex diabetes type. Adequate selection randomization methods allows intended randomization goals realized. Unbiased compared standard commonly used randomization methods, e.g. simple method block method, apart methods, additionally offers enhanced features flexible adaptive methods, based current information allocation patients trial. Compared , example, block randomization, adaptive randomization ensures relatively equal allocation patient groups, also allows groups balanced basis certain important covariates, key advantage. randomization requires predefined criteria, probability given patient assigned group based minimizing total imbalance, weights can assigned personally individual covariate. advanced algorithmic approach sets apart others minimizing selection bias improving overall efficiency randomization process clinical trials. Unbiased allows use simple, block adaptive minimization randomization methods relevant conduct clinical trials, package caters needs clinical trial randomization. … find differences randomization methods, read vignette Comparative Analysis Randomization Methods.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"comparison-with-other-solutions","dir":"","previous_headings":"","what":"Comparison with other solutions","title":"Unbiased: Production-Grade Randomization API","text":"many packages perform specific randomization methods R. designed stratified randomization permuted blocks, blockrand randomizeR. also utilize options using minimization randomization - e.g. randpack Minirand. unique contribution landscape integration comprehensive API commitment rigorous testing. dual focus ensures unbiased supports practical needs clinical trials, also aligns technical requirements modern clinical research environments. prioritizing aspects, unbiased addresses critical gap market: need eCRF-compatible randomization solution dependable easily integrated existing workflows. , together implementation minimization techniques, sets unbiased apart novel, comprehensive tool.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":null,"dir":"Reference","previous_headings":"","what":"AuditLog Class — AuditLog","title":"AuditLog Class — AuditLog","text":"class used internally store audit logs request.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"AuditLog Class — AuditLog","text":"AuditLog$new() AuditLog$disable() AuditLog$is_enabled() AuditLog$set_request_body() AuditLog$set_response_body() AuditLog$set_ip_address() AuditLog$set_user_agent() AuditLog$set_event_type() AuditLog$set_study_id() AuditLog$set_response_code() AuditLog$validate_log() AuditLog$persist() AuditLog$clone()","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$new(request_method, endpoint_url)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$disable()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$is_enabled()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_request_body(request_body)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_response_body(response_body)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_ip_address(ip_address)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_user_agent(user_agent)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-7","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_event_type(event_type)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-8","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_study_id(study_id)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-9","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_response_code(response_code)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-10","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$validate_log()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-11","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$persist()"},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"AuditLog Class — AuditLog","text":"objects class cloneable method.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-12","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$clone(deep = FALSE)"},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"AuditLog Class — AuditLog","text":"deep Whether make deep clone.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Set Audit Log Event Type — audit_log_set_event_type","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"function sets event type audit log. retrieves audit log request's internal data, calls audit log's set_event_type method provided event type.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"","code":"audit_log_set_event_type(event_type, req)"},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"event_type event type set audit log. req request object, contain audit log internal data.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"Returns nothing modifies audit log -place.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":null,"dir":"Reference","previous_headings":"","what":"Set Audit Log Study ID — audit_log_set_study_id","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"function sets study ID audit log. retrieves audit log request's internal data, calls audit log's set_study_id method provided study ID.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"","code":"audit_log_set_study_id(study_id, req)"},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"study_id study ID set audit log. req request object, contain audit log internal data.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"Returns nothing modifies audit log -place.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":null,"dir":"Reference","previous_headings":"","what":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"randomize_dynamic function implements dynamic randomization algorithm using minimization method proposed Pocock (Pocock Simon, 1975). requires defining basic study parameters: number arms (K), number covariates (C), patient allocation ratios (\\(a_k\\)) (k = 1,2,…., K), weights covariates (\\(w_i\\)) (= 1,2,…., C), maximum probability (p) assigning patient group smallest total unbalance multiplied respective weights (\\(G_k\\)). total unbalance first patient regardless assigned arm, patient randomly allocated given arm. Subsequent patients randomized based calculation unbalance depending selected method: \"range\", \"var\" (variance), \"sd\" (standard deviation). case two arms, \"range\" method equivalent \"sd\" method.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"","code":"randomize_minimisation_pocock( arms, current_state, weights, ratio, method = \"var\", p = 0.85 )"},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"arms character() Arm names. current_state tibble() table covariates current arm assignments column arm, last row contains new patient empty string arm weights numeric() vector positive weights, equal length number covariates, numbered covariates, defaults equal weights ratio integer() Vector positive integers (0 allowed), equal length number arms, named arms, defaults equal weight method character() Function used compute within-arm variability, must one : sd, var, range, defaults var p numeric() single value, proportion randomness (0, 1) randomization vs determinism, defaults 85% deterministic","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"character() name arm assigned patient","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"Initially, algorithm creates matrix results comparing newly randomized patient current balance patients based defined covariates. next step, arm specified covariate, various scenarios patient allocation calculated. existing results (n) updated new patient, , considering ratio coefficients, results divided specific allocation ratio. Depending method, total unbalance calculated, taking account weights, number covariates using one three methods (“sd”, “range”, “var”). Based number defined arms, minimum value (\\(G_k\\)) (defined weighted sum level-based imbalance) selects arm patient assigned predefined probability (p). probability patient assigned arm equal (1-p)/(K-1) remaining arms.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"function's implementation refactored adaptation codebase 'Minirand' package.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"Pocock, S. J., & Simon, R. (1975). Minimization: new method assigning patients treatment control groups clinical trials. Minirand Package: Man Jin, Adam Polis, Jonathan Hartzel. (https://CRAN.R-project.org/package=Minirand)","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"","code":"n_at_the_moment <- 10 arms <- c(\"control\", \"active low\", \"active high\") sex <- sample(c(\"F\", \"M\"), n_at_the_moment + 1, replace = TRUE, prob = c(0.4, 0.6) ) diabetes <- sample(c(\"diabetes\", \"no diabetes\"), n_at_the_moment + 1, replace = TRUE, prob = c(0.2, 0.8) ) arm <- sample(arms, n_at_the_moment, replace = TRUE, prob = c(0.4, 0.4, 0.2) ) |> c(\"\") covar_df <- tibble::tibble(sex, diabetes, arm) covar_df #> # A tibble: 11 × 3 #> sex diabetes arm #> #> 1 M no diabetes \"control\" #> 2 F no diabetes \"active low\" #> 3 F no diabetes \"active high\" #> 4 M no diabetes \"control\" #> 5 M no diabetes \"active low\" #> 6 M no diabetes \"control\" #> 7 M no diabetes \"control\" #> 8 M no diabetes \"control\" #> 9 F diabetes \"active low\" #> 10 F no diabetes \"active low\" #> 11 F no diabetes \"\" randomize_minimisation_pocock(arms = arms, current_state = covar_df) #> [1] \"active high\" randomize_minimisation_pocock( arms = arms, current_state = covar_df, ratio = c( \"control\" = 1, \"active low\" = 2, \"active high\" = 2 ), weights = c( \"sex\" = 0.5, \"diabetes\" = 1 ) ) #> [1] \"active high\""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple randomization — randomize_simple","title":"Simple randomization — randomize_simple","text":"Randomly assigns patient one arms according specified ratios, regardless already performed assignments.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple randomization — randomize_simple","text":"","code":"randomize_simple(arms, ratio)"},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple randomization — randomize_simple","text":"arms character() Arm names. ratio integer() Vector positive integers (0 allowed), equal length number arms, named arms, defaults equal weight","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple randomization — randomize_simple","text":"Selected arm assignment.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simple randomization — randomize_simple","text":"","code":"randomize_simple(c(\"active\", \"placebo\"), c(\"active\" = 2, \"placebo\" = 1)) #> [1] \"active\""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":null,"dir":"Reference","previous_headings":"","what":"Run API — run_unbiased","title":"Run API — run_unbiased","text":"Starts unbiased API.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run API — run_unbiased","text":"","code":"run_unbiased()"},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run API — run_unbiased","text":"host character(1) Host URL. port integer(1) Port serve API .","code":""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run API — run_unbiased","text":"Function called serve API caller thread.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/unbiased-package.html","id":null,"dir":"Reference","previous_headings":"","what":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","title":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","text":"Unbiased package delivers minimization-based randomization algorithm patient allocation clinical trials, fully integrated production-ready API. designed work seamlessly persistent PostgreSQL database, ensuring reliable data management integrity. Packaged precompiled Docker images, Unbiased simplifies deployment just running docker-compose , making exceptionally straightforward incorporate environment.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/unbiased-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","text":"Maintainer: Kamil Sijko kamil.sijko@ttsi.com.pl (ORCID) Authors: Kinga Sałata kinga.salata@ttsi.com.pl Aleksandra Duda aleksandra.duda@ttsi.com.pl Łukasz Wałejko lukasz.walejko@ttsi.com.pl Jagoda Głowacka-Walas jagoda.glowacka-walas@ttsi.com.pl (ORCID) Laura Bąkała contributors: Michał Seweryn michal.seweryn@biol.uni.lodz.pl (ORCID) [contributor] Transition Technologies Science Sp. z o.o. [funder, copyright holder]","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"new-features-1-0-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"unbiased 1.0.0","text":"Implemented support adaptive randomization using Pocock’s minimization algorithm, integrating new R function based Minirand package Man Jin, Adam Polis, Jonathan Hartzel (Minirand Package). Introduced new POST endpoints facilitating creation studies randomization subjects. Added new GET endpoints comprehensive access study overviews, -depth details, information randomized patients. Implemented audit trial mechanism systematically logs stores request database alongside unbiased’s response. Introduced new GET endpoint enabling users access complete audit trail specific study.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"vignettes--articles-1-0-0","dir":"Changelog","previous_headings":"","what":"Vignettes / Articles","title":"unbiased 1.0.0","text":"Added new article benchmarking Pocock’s minimization algorithm permuted block randomization simple randomization, focusing balance covariates.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"devops-integration-1-0-0","dir":"Changelog","previous_headings":"","what":"DevOps Integration","title":"unbiased 1.0.0","text":"Integrated project Sentry capture errors, empowering users provide credentials receive notifications event unexpected occurrences, including HTTP 500 instances. Integrated project CodeCov, achieving code coverage 95% higher, maintenance level improvement required merging. Integrated project pkgdown, hosting project site ttscience.github.io/unbiased/. Enforced use linter, ensuring errors present upon merging.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"smaller-improvements-1-0-0","dir":"Changelog","previous_headings":"","what":"Smaller Improvements","title":"unbiased 1.0.0","text":"Improved handling malformed JSONs, now returning HTTP 400 instead default HTTP 500 (plumber behavior).","code":""}] +[{"path":"https://ttscience.github.io/unbiased/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Transition Technologies Science sp. z o.o. Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Benchmarking randomization methods","text":"Randomization clinical trials gold standard widely considered best design evaluating effectiveness new treatments compared alternative treatments (standard care) placebo. Indeed, selection appropriate randomisation important selection appropriate statistical analysis study analysis strategy, whether based randomisation population model (Berger et al. (2021)). One primary advantages randomization, particularly simple randomization (usually using flipping coin method), ability balance confounding variables across treatment groups. especially effective large sample sizes (n > 200), random allocation participants helps ensure known unknown confounders evenly distributed study arms. balanced distribution contributes significantly internal validity study, minimizes risk selection bias confounding influencing results (Lim (2019)). ’s important note, however, simple randomization powerful large trials, may always guarantee even distribution confounding factors trials smaller sample sizes (n < 100). cases, random allocation might result imbalances baseline characteristics groups, can affect interpretation treatment’s effectiveness. potential limitation sets stage considering additional methods, stratified randomization, dynamic minimization algorithms address challenges smaller trials (Kang, Ragan, Park (2008)). document provides summary comparison three randomization methods: simple randomization, block randomization, adaptive randomization. Simple randomization adaptive randomization (minimization method) tools available unbiased package randomize_simple randomize_minimisation_pocock functions (Sijko et al. (2024)). comparison aims demonstrate superiority adaptive randomization (minimization method) methods assessing least imbalance accompanying variables therapeutic groups. Monte Carlo simulations used generate data, utilizing simstudy package (Goldfeld Wujciak-Jens (2020)). Parameters binary distribution variables based data publication Mrozikiewicz-Rakowska et al. (2023) information researchers. document structure follows: first, based defined parameters, data simulated using Monte Carlo method single simulation; , generated patient data, appropriate groups assigned using three randomization methods; data summarized form descriptive statistics along relevant statistical test; next, data prepared .Rds format generated 1000 simulations loaded., results based standardised mean difference (SMD) test discussed visual form (boxplot, violin plot) percentage success achieved method given precision (tabular summary)","code":"# load packages library(unbiased) library(dplyr) library(simstudy) library(tableone) library(ggplot2) library(gt) library(gtsummary) library(truncnorm) library(tidyr) library(randomizeR)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"the-randomization-methods-considered-for-comparison","dir":"Articles","previous_headings":"","what":"The randomization methods considered for comparison","title":"Benchmarking randomization methods","text":"process comparing balance covariates among randomization methods, three randomization methods selected evaluation: simple randomization - simple coin toss, algorithm gives participants equal chances assigned particular arm. method’s advantage lies simplicity elimination predictability. However, due complete randomness, may lead imbalance sample sizes arms imbalances prognostic factors. large sample size (n > 200), simple randomisation gives similar number generated participants group. small sample size (n < 100), results imbalance (Kang, Ragan, Park (2008)). block randomization - randomization method takes account defined covariates patients. method involves assigning patients therapeutic arms blocks fixed size, recommendation blocks different sizes. , extent, reduces risk researchers predicting future arm assignments. contrast simple randomization, block method aims balance number patients within block, hence reducing overall imbalance arms (Rosenberger Lachin (2015)). adaptive randomization using minimization method based Pocock Simon (1975) algorithm - - randomization approach aims balance prognostic factors across treatment arms within clinical study. functions evaluating total imbalance factors time new patient considered study. minimization method computes overall imbalance potential arm assignment new patient, considering factors like variance specified criteria. patient assigned arm addition results smallest total imbalance. assignment deterministic made predetermined probability, ensuring level randomness arm allocation. method particularly useful trials multiple prognostic factors smaller studies traditional randomization might fail achieve balance.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"assessment-of-covariate-balance","dir":"Articles","previous_headings":"","what":"Assessment of covariate balance","title":"Benchmarking randomization methods","text":"proposed approach assessment randomization methods, primary objective evaluate method terms achieving balance specified covariates. assessment balance aims determine whether distributions covariates similarly balanced therapeutic group. Based literature, standardized mean differences (SMD) employed assessing balance (Berger et al. (2021)). SMD method one commonly used statistics assessing balance covariates, regardless unit measurement. statistical measure comparing differences two groups. covariates examined case expressed binary variables. case categorical variables, SMD calculated using following formula (Zhang et al. (2019)): \\[ SMD = \\frac{{p_1 - p_2}}{{\\sqrt{\\frac{{p_1 \\cdot (1 - p_1) + p_2 \\cdot (1 - p_2)}}{2}}}} \\], : \\(p_1\\) proportion first arm, \\(p_2\\) proportion second arm.","code":""},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"definied-number-of-patients","dir":"Articles","previous_headings":"","what":"Definied number of patients","title":"Benchmarking randomization methods","text":"simulation, using real use case - planned FootCell study - non-commercial clinical research area civilisation diseases - guide data generation process. FootCell study, anticipated total 105 patients randomized trial. patients equally divided among three research groups - Group , Group B, Group C - group comprising 35 patients.","code":"# defined number of patients n <- 105"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"defining-parameters-for-monte-carlo-simulation","dir":"Articles","previous_headings":"","what":"Defining parameters for Monte-Carlo simulation","title":"Benchmarking randomization methods","text":"distribution parameters individual covariates, subsequently used validate randomization methods, defined using publication Mrozikiewicz-Rakowska et al. (2023) allogenic interventions.. publication describes effectiveness comparing therapy using ADSC (Adipose-Derived Stem Cells) gel versus standard therapy fibrin gel patients diabetic foot ulcer treatment. FootCell study also aims assess safety advanced therapy involving live ASCs (Adipose-Derived Stem Cells) treatment diabetic foot syndrome, considering two groups treated ADSCs (one two administrations) compared fibrin gel. Therefore, appropriate population data extracted publication determine distributions can maintained designing FootCell study. process defining study randomization, following covariates selected: gender [male/female], diabetes type [type /type II], HbA1c [9/9 11] [%], tpo2 [50/50] [mmHg], age [55/55] [years], wound size [2/2] [cm\\(^2\\)]. case variables gender diabetes type publication Mrozikiewicz-Rakowska et al. (2023), expressed form frequencies. remaining variables presented terms measures central tendency along indication variability, well minimum maximum values. determine parameters binary distribution, truncated normal distribution available truncnorm package utilized. truncated normal distribution often used statistics probability modeling dealing data constrained certain range. particularly useful want model random variable take values beyond certain limits (Burkardt (2014)). generate necessary information remaining covariates, function simulate_proportions_trunc written, utilizing rtruncnorm function (Mersmann et al. (2023)). parameters mean, sd, lower, upper taken publication based expertise regarding ranges parameters. results presented table, assuming outcome refers first category parameter.","code":"# simulate parameters using truncated normal distribution simulate_proportions_trunc <- function(n, lower, upper, mean, sd, threshold) { simulate_data <- rtruncnorm( n = n, a = lower, b = upper, mean = mean, sd = sd ) <= threshold sum(simulate_data == TRUE) / n } set.seed(123) data.frame( hba1c = simulate_proportions_trunc(1000, 0, 11, 7.41, 1.33, 9), tpo2 = simulate_proportions_trunc(1000, 30, 100, 53.4, 18.4, 50), age = simulate_proportions_trunc(1000, 0, 100, 59.2, 9.7, 55), wound_size = simulate_proportions_trunc(1000, 0, 20, 2.7, 2.28, 2) ) |> rename(\"wound size\" = wound_size) |> pivot_longer( cols = everything(), names_to = \"parametr\", values_to = \"proportions\" ) |> mutate(\"first catogory of strata\" = c(\"<=9\", \"<=50\", \"<=55\", \"<=2\")) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"generate-data-using-monte-carlo-simulations","dir":"Articles","previous_headings":"","what":"Generate data using Monte-Carlo simulations","title":"Benchmarking randomization methods","text":"Monte-Carlo simulations used accumulate data. method designed model variables based defined parameters. Variables defined using simstudy package, utilizing defData function (Goldfeld Wujciak-Jens (2020)). variables specify proportions, dist = 'binary' used define variables. Due likely association type diabetes age – meaning older patient, higher probability type II diabetes – relationship diabetes established defining age variable using logit function link = \"logit\". proportions gender diabetes defined researchers consistent literature Mrozikiewicz-Rakowska et al. (2023). Using genData function simstudy package, data frame (data) generated artificially adopted variable arm, filled subsequent randomization methods arm allocation process n patients.","code":"# defining variables # male - 0.9 def <- simstudy::defData(varname = \"sex\", formula = \"0.9\", dist = \"binary\") # type I - 0.15 def <- simstudy::defData(def, varname = \"diabetes_type\", formula = \"0.15\", dist = \"binary\") # <= 9 - 0.888 def <- simstudy::defData(def, varname = \"hba1c\", formula = \"0.888\", dist = \"binary\") # <= 50 - 0.354 def <- simstudy::defData(def, varname = \"tpo2\", formula = \"0.354\", dist = \"binary\") # correlation with diabetes type def <- simstudy::defData( def, varname = \"age\", formula = \"(diabetes_type == 0) * (-0.95)\", link = \"logit\", dist = \"binary\" ) # <= 2 - 0.302 def <- simstudy::defData(def, varname = \"wound_size\", formula = \"0.302\", dist = \"binary\") # generate data using genData() data <- genData(n, def) |> mutate( sex = as.character(sex), age = as.character(age), diabetes_type = as.character(diabetes_type), hba1c = as.character(hba1c), tpo2 = as.character(tpo2), wound_size = as.character(wound_size) ) |> as_tibble() # add arm to tibble data <- data |> tibble::add_column(arm = \"\") # first 5 rows of the data head(data, 5) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"minimization-randomization","dir":"Articles","previous_headings":"","what":"Minimization randomization","title":"Benchmarking randomization methods","text":"generate appropriate research arms, function called minimize_results written, utilizing randomize_minimisation_pocock function available within unbiased package (Sijko et al. (2024)). probability parameter set level defined within function (p = 0.85). case minimization randomization, verify type minimization (equal weights unequal weights) used, three calls minimize_results function prepared: minimize_equal_weights - covariate weight takes value equal 1 divided number covariates. case, weight 1/6, minimize_unequal_weights - following expert assessment physicians, parameters potentially significant impact treatment outcomes (hba1c, tpo2, wound size) assigned weight 2. remaining covariates assigned weight 1. minimize_unequal_weights_3 - following expert assessment physicians, parameters potentially significant impact treatment outcomes (hba1c, tpo2, wound size) assigned weight 3. remaining covariates assigned weight 1. tables present information allocations first 5 patients. statistic_table function developed provide information : distribution number patients across research arms, distribution covariates across research arms, along p-value information statistical analyses used compare proportions - chi^2, exact Fisher’s test, typically used small samples. function relies use tbl_summary function available gtsummary package (Sjoberg et al. (2021)). table presents statistical summary results first iteration : Minimization weights equal 1/6. Minimization weights 2:1. Minimization weights 3:1.","code":"# drawing an arm for each patient minimize_results <- function(current_data, arms, weights) { for (n in seq_len(nrow(current_data))) { current_state <- current_data[1:n, 2:ncol(current_data)] current_data$arm[n] <- randomize_minimisation_pocock( arms = arms, current_state = current_state, weights = weights ) } return(current_data) } set.seed(123) # eqal weights - 1/6 minimize_equal_weights <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\") ) head(minimize_equal_weights, 5) |> gt() set.seed(123) # double weights where the covariant is of high clinical significance minimize_unequal_weights <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), weights = c( \"sex\" = 1, \"diabetes_type\" = 1, \"hba1c\" = 2, \"tpo2\" = 2, \"age\" = 1, \"wound_size\" = 2 ) ) head(minimize_unequal_weights, 5) |> gt() set.seed(123) # triple weights where the covariant is of high clinical significance minimize_unequal_weights_3 <- minimize_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), weights = c( \"sex\" = 1, \"diabetes_type\" = 1, \"hba1c\" = 3, \"tpo2\" = 3, \"age\" = 1, \"wound_size\" = 3 ) ) head(minimize_unequal_weights_3, 5) |> gt() # generation of frequency and chi^2 statistic values or fisher exact test statistics_table <- function(data) { data |> mutate( sex = ifelse(sex == \"1\", \"men\", \"women\"), diabetes_type = ifelse(diabetes_type == \"1\", \"type1\", \"type2\"), hba1c = ifelse(hba1c == \"1\", \"<=9\", \"(9,11>\"), tpo2 = ifelse(tpo2 == \"1\", \"<=50\", \">50\"), age = ifelse(age == \"1\", \"<=55\", \">55\"), wound_size = ifelse(wound_size == \"1\", \"<=2\", \">2\") ) |> tbl_summary( include = c(sex, diabetes_type, hba1c, tpo2, age, wound_size), by = arm ) |> modify_header(label = \"\") |> modify_header(all_stat_cols() ~ \"**{level}**, N = {n}\") |> bold_labels() |> add_p() } statistics_table(minimize_equal_weights) statistics_table(minimize_unequal_weights) statistics_table(minimize_unequal_weights_3)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"simple-randomization","dir":"Articles","previous_headings":"","what":"Simple randomization","title":"Benchmarking randomization methods","text":"next step, appropriate arms generated patients using simple randomization, available unbiased package - randomize_simple function (Sijko et al. (2024)). simple_results function called within simple_data, considering initial assumption assigning patients three arms 1:1:1 ratio. Since simple randomization, take account initial covariates, treatment assignment occurs randomly (flip coin method). tables illustrate example data output summary statistics including summary statistical tests.","code":"# simple randomization simple_results <- function(current_data, arms, ratio) { for (n in seq_len(nrow(current_data))) { current_data$arm[n] <- randomize_simple(arms, ratio) } return(current_data) } set.seed(123) simple_data <- simple_results( current_data = data, arms = c(\"armA\", \"armB\", \"armC\"), ratio = c(\"armB\" = 1L, \"armA\" = 1L, \"armC\" = 1L) ) head(simple_data, 5) |> gt() statistics_table(simple_data)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"block-randomization","dir":"Articles","previous_headings":"","what":"Block randomization","title":"Benchmarking randomization methods","text":"Block randomization, opposed minimization simple randomization methods, developed based rbprPar function available randomizeR package (Uschner et al. (2018)). Using , block_rand function created, , based defined number patients, arms, list stratifying factors, generates randomization list length equal number patients multiplied product categories covariate. case specified data document, one iteration, amounts 105 * 2^6 = 6720 rows. ensures appropriate number randomisation codes opportunity. case equal characteristics, certain right number codes defined n patients. Based block_rand function, possible generate randomisation list, based patients allocated, characteristics output data frame. Due 3 arms need blind allocation consecutive patients, block sizes 3,6 9 used calculations. next step, patients assigned research groups using block_results function (based list generated function block_rand). first available code randomization list meets specific conditions selected, removed list available codes. Based , research arms generated ensure appropriate number patients group (based assumed ratio 1:1:1). tables show assignment patients groups using block randomisation summary statistics including summary statistical tests.","code":"# Function to generate a randomisation list block_rand <- function(n, block, n_groups, strata, arms = LETTERS[1:n_groups]) { strata_grid <- expand.grid(strata) strata_n <- nrow(strata_grid) ratio <- rep(1, n_groups) gen_seq_list <- lapply(seq_len(strata_n), function(i) { rand <- rpbrPar( N = n, rb = block, K = n_groups, ratio = ratio, groups = arms, filledBlock = FALSE ) getRandList(genSeq(rand))[1, ] }) df_list <- tibble::tibble() for (i in seq_len(strata_n)) { local_df <- strata_grid |> dplyr::slice(i) |> dplyr::mutate(count_n = n) |> tidyr::uncount(count_n) |> tibble::add_column(rand_arm = gen_seq_list[[i]]) df_list <- rbind(local_df, df_list) } return(df_list) } # Generate a research arm for patients in each iteration block_results <- function(current_data) { simulation_result <- block_rand( n = n, block = c(3, 6, 9), n_groups = 3, strata = list( sex = c(\"0\", \"1\"), diabetes_type = c(\"0\", \"1\"), hba1c = c(\"0\", \"1\"), tpo2 = c(\"0\", \"1\"), age = c(\"0\", \"1\"), wound_size = c(\"0\", \"1\") ), arms = c(\"armA\", \"armB\", \"armC\") ) for (n in seq_len(nrow(current_data))) { # \"-1\" is for \"arm\" column current_state <- current_data[n, 2:(ncol(current_data) - 1)] matching_rows <- which(apply( simulation_result[, -ncol(simulation_result)], 1, function(row) all(row == current_state) )) if (length(matching_rows) > 0) { current_data$arm[n] <- simulation_result[matching_rows[1], \"rand_arm\"] # Delete row from randomization list simulation_result <- simulation_result[-matching_rows[1], , drop = FALSE] } } return(current_data) } set.seed(123) block_data <- block_results(data) head(block_data, 5) |> gt() statistics_table(block_data)"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"generate-1000-simulations","dir":"Articles","previous_headings":"","what":"Generate 1000 simulations","title":"Benchmarking randomization methods","text":"performed 1000 iterations data generation parameters defined . number iterations indicates number iterations included Monte-Carlo simulations accumulate data given parameters. allowed generation data 1000 times 105 patients efficiently assess effect randomization methods context covariate balance. data assigned variable sim_data based data stored .Rds file 1000_sim_data.Rds, available within vignette information GitHub repository unbiased package.","code":"# define number of iterations # no_of_iterations <- 1000 # nolint # define number of cores # no_of_cores <- 20 # nolint # perform simulations (run carefully!) # source(\"~/unbiased/vignettes/helpers/run_parallel.R\") # nolint # read data from file sim_data <- readRDS(\"1000_sim_data.Rds\")"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"check-balance-using-smd-test","dir":"Articles","previous_headings":"","what":"Check balance using smd test","title":"Benchmarking randomization methods","text":"order select test define precision specified level, assume imbalance, literature analysis conducted based publications Lee et al. (2021), Austin (2009), Doah et al. (2021), Brown et al. (2020), Nguyen et al. (2017), Sánchez-Meca, Marı́n-Martı́nez, Chacón-Moscoso (2003), Lee, Acharya, et al. (2022), Berger et al. (2021). assess balance covariates research groups , B, C, Standardized Mean Difference (SMD) test employed, compares two groups. Since three groups example, SMD test computed pair comparisons: vs B, vs C, B vs C. average SMD test given covariate calculated based comparisons. literature analysis, precision level ranged 0.1-0.2. small samples, expected SMD test exceed 0.2 (Austin (2009)). Additionally, according publication Sánchez-Meca, Marı́n-Martı́nez, Chacón-Moscoso (2003), golden standard dictates specific threshold SMD test considered balanced. Generally, smaller SMD test, smaller difference covariate imbalance. analyzed example, due sample size 105 patients, threshold 0.2 SMD test adopted. function called smd_covariants_data written generate frames produce SMD test covariate iteration, utilizing CreateTableOne function available tableone package (Yoshida Bartel (2022)). cases test result <0.001, value 0 assigned. results randomization method stored cov_balance_data. results SMD test presented form boxplot violin plot, depicting outcomes randomization method. red dashed line indicates adopted precision threshold. Boxplot combined results Summary average smd randomization methods Violin plot Summary smd randomization methods covariants Summary table success Based specified precision threshold 0.2, function defining randomization success, named success_power, developed. SMD test value covariate given iteration 0.2, function defines analysis data ‘failure’ - 0; otherwise, defined ‘success’ - 1. final success power calculated sum successes iteration divided total number specified iterations. results summarized table percentage success randomization method.","code":"# definied covariants vars <- c(\"sex\", \"age\", \"diabetes_type\", \"wound_size\", \"tpo2\", \"hba1c\") smd_covariants_data <- function(data, vars, strata) { result_table <- lapply(unique(data$simnr), function(i) { current_data <- data[data$simnr == i, ] arms_to_check <- setdiff(names(current_data), c(vars, \"id\", \"simnr\")) # check SMD for any covariants lapply(arms_to_check, function(arm) { tab <- CreateTableOne( vars = vars, data = current_data, strata = arm ) results_smd <- ExtractSmd(tab) |> as.data.frame() |> tibble::rownames_to_column(\"covariants\") |> select(covariants, results = average) |> mutate(results = round(as.numeric(results), 3)) results <- bind_cols( simnr = i, strata = arm, results_smd ) return(results) }) |> bind_rows() }) |> bind_rows() return(result_table) } cov_balance_data <- smd_covariants_data( data = sim_data, vars = vars ) |> mutate(method = case_when( strata == \"minimize_equal_weights_arms\" ~ \"minimize equal\", strata == \"minimize_unequal_weights_arms\" ~ \"minimize unequal 2:1\", strata == \"minimize_unequal_weights_triple_arms\" ~ \"minimize unequal 3:1\", strata == \"simple_data_arms\" ~ \"simple randomization\", strata == \"block_data_arms\" ~ \"block randomization\" )) |> select(-strata) # boxplot cov_balance_data |> select(simnr, results, method) |> group_by(simnr, method) |> mutate(results = mean(results)) |> distinct() |> ggplot(aes(x = method, y = results, fill = method)) + geom_boxplot() + geom_hline(yintercept = 0.2, linetype = \"dashed\", color = \"red\") + theme_bw() # violin plot cov_balance_data |> ggplot(aes(x = method, y = results, fill = method)) + geom_violin() + geom_hline( yintercept = 0.2, linetype = \"dashed\", color = \"red\" ) + facet_wrap(~covariants, ncol = 3) + theme_bw() + theme(axis.text = element_text(angle = 45, vjust = 0.5, hjust = 1)) # function defining success of randomisation success_power <- function(cov_data) { result_table <- lapply(unique(cov_data$simnr), function(i) { current_data <- cov_data[cov_data$simnr == i, ] current_data |> group_by(method) |> summarise(success = ifelse(any(results > 0.2), 0, 1)) |> tibble::add_column(simnr = i, .before = 1) }) |> bind_rows() success <- result_table |> group_by(method) |> summarise(results_power = sum(success) / n() * 100) return(success) } success_power(cov_balance_data) |> as.data.frame() |> rename(`power results [%]` = results_power) |> gt()"},{"path":"https://ttscience.github.io/unbiased/articles/minimization_randomization_comparison.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Benchmarking randomization methods","text":"Considering three randomization methods: minimization, block randomization, simple randomization, minimization performs best terms covariate balance. Simple randomization significant drawback, patient allocation arms occurs randomly equal probability. leads imbalance number patients covariate balance, also random. particularly case small samples. Balancing number patients possible larger samples n > 200. hand, block randomization performs well balancing number patients groups specified allocation ratio. However, compared adaptive randomisation using minimisation method, block randomisation lower probability terms balancing co-variables. Minimization method, provides highest success power ensuring balance across covariates groups. made possible appropriate algorithm implemented part minimisation randomisation. assigning next patient group, method examines total imbalance assigns patient appropriate study group specified probability balance sample terms size, covariates.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kamil Sijko. Author, maintainer. Kinga Sałata. Author. Aleksandra Duda. Author. Łukasz Wałejko. Author. Jagoda Głowacka-Walas. Author. Laura Bąkała. Author. Michał Seweryn. Contributor. Transition Technologies Science Sp. z o.o.. Funder, copyright holder.","code":""},{"path":"https://ttscience.github.io/unbiased/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sijko K, Sałata K, Duda , Wałejko Ł, Głowacka-Walas J, Bąkała L (2024). unbiased: Unbiased: Production-Grade Randomization API. R package version 1.0.0, https://ttscience.github.io/unbiased/.","code":"@Manual{, title = {unbiased: Unbiased: Production-Grade Randomization API}, author = {Kamil Sijko and Kinga Sałata and Aleksandra Duda and Łukasz Wałejko and Jagoda Głowacka-Walas and Laura Bąkała}, year = {2024}, note = {R package version 1.0.0}, url = {https://ttscience.github.io/unbiased/}, }"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"unbiased-","dir":"","previous_headings":"","what":"Unbiased: Production-Grade Randomization API","title":"Unbiased: Production-Grade Randomization API","text":"> API-based solution Clinical Trial Randomization clinical trials, fair efficient allocation participants essential achieving reliable results. many excellent R randomization packages available, none, knowledge, provide dedicated API purpose. unbiased package fills gap featuring production-ready REST API designed seamless integration. unique combination allows easy connection electronic Case Report Forms (eCRF), enhancing data management streamlining participant allocation.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"why-choose-unbiased","dir":"","previous_headings":"","what":"Why choose unbiased?","title":"Unbiased: Production-Grade Randomization API","text":"goal creating unbiased provide user-friendly yet powerful tool addresses nuanced demands clinical trial randomization. offers: Production-Ready REST API: Built seamless integration eCRF/EDC systems, facilitating real-time randomization automation. Extensive Database Integration: Supports robust data management practices, ensuring participant information randomization outcomes securely managed easily accessible. Commitment Quality: Emphasizes development best practices, including comprehensive code coverage, deliver reliable trustworthy solution. Adaptability: Whether small-scale studies large, multi-center trials, unbiased scales meet needs. Comprehensive Documentation: support applying package effectively. choosing unbiased, ’re adopting sophisticated approach trial randomization, ensuring fair efficient participant allocation across studies support broader objectives clinical research technology.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"table-of-contents","dir":"","previous_headings":"","what":"Table of Contents","title":"Unbiased: Production-Grade Randomization API","text":"Quick Setup Docker Compose Quick Setup Docker API Server Configuration Alternative Installation Method Study Creation Patient Randomization Study List Study Details Randomization List Audit Log Quality Assurance Measures Executing Tests R Interactive Session Executing Tests Command Line Running Tests Docker Compose Code Coverage Configuring Sentry Purpose Scope Clinical Trial Randomization Comparison Solutions","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quickstart-guide","dir":"","previous_headings":"","what":"Quickstart Guide","title":"Unbiased: Production-Grade Randomization API","text":"Initiating work unbiased involves simple setup steps. Whether ’re integrating R environment deploying API, aim equip reliable tool enhances integrity efficiency clinical trials.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quick-setup-with-docker-compose","dir":"","previous_headings":"","what":"Quick Setup with Docker Compose","title":"Unbiased: Production-Grade Randomization API","text":"prepared simple Docker Compose setup allows run unbiased minimal configuration. method ideal users want quickly test unbiased locally development environment. get started, follow steps: Clone unbiased repository local machine just copy docker-compose.yml file repository. Navigate directory containing docker-compose.yml file. Run following command start unbiased: command start unbiased API server, making accessible specified port. PostgreSQL also started, ensuring API can connect database. can use docker-compose.yml file starting point deployment, modifying suit specific requirements.","code":"docker compose pull docker compose up"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"configuration","dir":"","previous_headings":"Quick Setup with Docker Compose","what":"Configuration","title":"Unbiased: Production-Grade Randomization API","text":"docker-compose.yml file contains necessary configuration running unbiased Docker Compose. can override default environment variables creating .env file directory docker-compose.yml file. following environment variables can set: UNBIASED_PORT: port API listen. Defaults 3838 provided. POSTGRES_USER: username authentication PostgreSQL database. Defaults postgres provided. POSTGRES_PASSWORD: password authentication PostgreSQL database. Warning: can set first run, work database already exists. Defaults postgres provided. UNBIASED_VERSION: version unbiased Docker image use. Defaults latest provided. POSTGRES_VERSION: version PostgreSQL Docker image use. Defaults latest provided.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"building-the-docker-image-locally","dir":"","previous_headings":"Quick Setup with Docker Compose","what":"Building the Docker Image Locally","title":"Unbiased: Production-Grade Randomization API","text":"cloned repository, can also build Docker image locally using following command:","code":"docker compose build"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"quick-setup-with-docker","dir":"","previous_headings":"","what":"Quick Setup with Docker","title":"Unbiased: Production-Grade Randomization API","text":"straightforward way deploy unbiased Docker images. ensures can get unbiased running minimal setup, regardless local environment. use unbiased, pull latest Docker image: run unbiased Docker, ensuring set necessary environment variables: command starts unbiased API, making accessible specified port. ’s crucial PostgreSQL database ready, unbiased automatically configure necessary database structures upon startup. PostgreSQL can run separate container local machine. Make sure use PostgreSQL instance temporal_tables extension available. can use ghcr.io/ttscience/postgres-temporal-tables/postgres-temporal-tables:latest image run PostgreSQL temporal_tables extension.","code":"docker pull ghcr.io/ttscience/unbiased docker run -e POSTGRES_DB=mydb -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mypassword -e UNBIASED_PORT=3838 ghcr.io/ttscience/unbiased"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"api-server-configuration","dir":"","previous_headings":"","what":"API Server configuration","title":"Unbiased: Production-Grade Randomization API","text":"unbiased API server can configured using environment variables. following environment variables need set server start: POSTGRES_DB: name PostgreSQL database connect . POSTGRES_HOST: host PostgreSQL database. hostname, localhost database.example.com, IP address. POSTGRES_PORT: port PostgreSQL database listening. Defaults 5432 provided. POSTGRES_USER: username authentication PostgreSQL database. POSTGRES_PASSWORD: password authentication PostgreSQL database. UNBIASED_HOST: host API run. Defaults 0.0.0.0 provided. UNBIASED_PORT: port API listen. Defaults 3838 provided.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"alternative-installation-method","dir":"","previous_headings":"","what":"Alternative Installation Method","title":"Unbiased: Production-Grade Randomization API","text":"preferring work directly within R environment, unbiased package offers alternative installation method via GitHub. approach allows users easily integrate unbiased R projects. proceed method, utilize devtools package installation executing following command: Following package installation, unbiased API can launched within R. Simply invoke run_unbiased() function start API: initiates API server, default, local machine (http://localhost:3838), making accessible interaction various HTTP clients, including curl, Postman, R’s httr package.","code":"devtools::install_github(\"ttscience/unbiased\") unbiased::run_unbiased()"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"getting-started-with-unbiased","dir":"","previous_headings":"","what":"Getting started with unbiased","title":"Unbiased: Production-Grade Randomization API","text":"unbiased package offers functions randomizing participants clinical trials, ensuring fair transparent process. Complete documentation implemented methodology examples use available GitHub Pages, providing information need integrate unbiased trial management workflow. , present basic steps using unbiased API.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"api-endpoints","dir":"","previous_headings":"","what":"API Endpoints","title":"Unbiased: Production-Grade Randomization API","text":"unbiased API designed facilitate clinical trial management set endpoints: Study Management: Create configure new studies, including specifying randomization parameters treatment arms. Participant Randomization: Dynamically randomize participants treatment groups based study’s configuration existing participant data. Study List: List previously defined studies. Study Details: Show details selected study. Randomization List: Generate list randomized patients selected study. Audit Log: Show audit log selected study.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-creation","dir":"","previous_headings":"API Endpoints","what":"Study Creation","title":"Unbiased: Production-Grade Randomization API","text":"initialize study using Pocock’s minimization method, use POST /minimisation_pocock endpoint. required JSON payload detail study, including treatment groups, allocation ratios, covariates. endpoint sets study returns ID accessing study-related endpoints.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"patient-randomization","dir":"","previous_headings":"API Endpoints","what":"Patient Randomization","title":"Unbiased: Production-Grade Randomization API","text":"POST /{study_id}/patient endpoint assigns new patient treatment group, requiring patient details covariate information JSON payload. endpoint determines patient’s treatment group.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-list","dir":"","previous_headings":"API Endpoints","what":"Study List","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/ endpoint allow list previously defined studies. returns information : Study ID Identifier Name study Randomization method Last edit date","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"study-details","dir":"","previous_headings":"API Endpoints","what":"Study Details","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id} endpoint allows retrieve details selected study. response body return: Name study Randomization method Last edit date Input parameters Strata","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"randomization-list","dir":"","previous_headings":"API Endpoints","what":"Randomization List","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id}/randomization_list endpoint allows generate list randomized patients along assigned study arms.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"audit-log","dir":"","previous_headings":"API Endpoints","what":"Audit Log","title":"Unbiased: Production-Grade Randomization API","text":"GET /study/{study_id}/audit endpoint allows print records audit log selected study. response body includes following information: Log ID Creation date Type event Request ID Study ID Endpoint URL Request method Request body study definition Response code Response body study details endpoint facilitates tracking history requests sent database, along corresponding responses. enables us trace actions involving API.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/index.html","id":"running-tests","dir":"","previous_headings":"","what":"Running Tests","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased provides extensive collection tests ensure correct functionality.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"executing-tests-from-an-r-interactive-session","dir":"","previous_headings":"Running Tests","what":"Executing Tests from an R Interactive Session","title":"Unbiased: Production-Grade Randomization API","text":"execute tests using interactive R session, run following commands: Make sure devtools package installed environment. Ensure necessary database connection environment variables set running tests. can set environment variables using methods Sys.setenv. Running tests start Unbiased API random port.","code":"devtools::load_all() testthat::test_package(**unbiased**)"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"executing-tests-from-the-command-line","dir":"","previous_headings":"Running Tests","what":"Executing Tests from the Command Line","title":"Unbiased: Production-Grade Randomization API","text":"Use helper script run_tests.sh execute tests command line. Remember set database connection environment variables running tests.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"running-tests-with-docker-compose","dir":"","previous_headings":"Running Tests","what":"Running Tests with Docker Compose","title":"Unbiased: Production-Grade Randomization API","text":"Docker Compose can used build Unbiased Docker image execute tests. can done using provided docker-compose.test.yml file. method ensures consistent testing environment simplifies setup process.","code":"docker compose -f docker-compose.test.yml build docker compose -f docker-compose.test.yml run tests"},{"path":"https://ttscience.github.io/unbiased/index.html","id":"code-coverage","dir":"","previous_headings":"Running Tests","what":"Code Coverage","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased supports code coverage analysis covr package. allows measure effectiveness tests showing parts R code R directory actually tested. calculate code coverage, need install covr package. installed, can use following methods: covr::report(): method runs tests generates detailed coverage report HTML format. covr::package_coverage(): method provides simpler, text-based code coverage report. Alternatively, can use provided run_tests_with_coverage.sh script run Unbiased tests code coverage.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"configuring-sentry","dir":"","previous_headings":"Running Tests","what":"Configuring Sentry","title":"Unbiased: Production-Grade Randomization API","text":"Unbiased server offers robust error reporting capabilities integration Sentry service. activate Sentry, simply set SENTRY_DSN environment variable. Additionally, flexibility customize setup configuring following environment variables: SENTRY_ENVIRONMENT used set environment (e.g., “production”, “staging”, “development”). set, environment defaults “development”. SENTRY_RELEASE used set release Sentry. set, release defaults “unspecified”.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/index.html","id":"purpose-and-scope-for-clinical-trial-randomization","dir":"","previous_headings":"","what":"Purpose and Scope for Clinical Trial Randomization","title":"Unbiased: Production-Grade Randomization API","text":"Randomization gold standard conducting clinical trials fundamental aspect clinical trials, studies comparing two arms. cases randomization desirable technique ensure patients randomly allocated defined groups. essential maintaining integrity trial ensuring results reliable, blinding research personnel. However, situations desirable studies balance patients terms numbers group , addition, achieve balance respect relevant factors, sex diabetes type. Adequate selection randomization methods allows intended randomization goals realized. Unbiased compared standard commonly used randomization methods, e.g. simple method block method, apart methods, additionally offers enhanced features flexible adaptive methods, based current information allocation patients trial. Compared , example, block randomization, adaptive randomization ensures relatively equal allocation patient groups, also allows groups balanced basis certain important covariates, key advantage. randomization requires predefined criteria, probability given patient assigned group based minimizing total imbalance, weights can assigned personally individual covariate. advanced algorithmic approach sets apart others minimizing selection bias improving overall efficiency randomization process clinical trials. Unbiased allows use simple, block adaptive minimization randomization methods relevant conduct clinical trials, package caters needs clinical trial randomization. … find differences randomization methods, read vignette Comparative Analysis Randomization Methods.","code":""},{"path":"https://ttscience.github.io/unbiased/index.html","id":"comparison-with-other-solutions","dir":"","previous_headings":"","what":"Comparison with other solutions","title":"Unbiased: Production-Grade Randomization API","text":"many packages perform specific randomization methods R. designed stratified randomization permuted blocks, blockrand randomizeR. also utilize options using minimization randomization - e.g. randpack Minirand. unique contribution landscape integration comprehensive API commitment rigorous testing. dual focus ensures unbiased supports practical needs clinical trials, also aligns technical requirements modern clinical research environments. prioritizing aspects, unbiased addresses critical gap market: need eCRF-compatible randomization solution dependable easily integrated existing workflows. , together implementation minimization techniques, sets unbiased apart novel, comprehensive tool.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":null,"dir":"Reference","previous_headings":"","what":"AuditLog Class — AuditLog","title":"AuditLog Class — AuditLog","text":"class used internally store audit logs request.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"AuditLog Class — AuditLog","text":"AuditLog$new() AuditLog$disable() AuditLog$is_enabled() AuditLog$set_request_body() AuditLog$set_response_body() AuditLog$set_ip_address() AuditLog$set_user_agent() AuditLog$set_event_type() AuditLog$set_study_id() AuditLog$set_response_code() AuditLog$validate_log() AuditLog$persist() AuditLog$clone()","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$new(request_method, endpoint_url)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$disable()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$is_enabled()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_request_body(request_body)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_response_body(response_body)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_ip_address(ip_address)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_user_agent(user_agent)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-7","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_event_type(event_type)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-8","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_study_id(study_id)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-9","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$set_response_code(response_code)"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-10","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$validate_log()"},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-11","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$persist()"},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"AuditLog Class — AuditLog","text":"objects class cloneable method.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"usage-12","dir":"Reference","previous_headings":"","what":"Usage","title":"AuditLog Class — AuditLog","text":"","code":"AuditLog$clone(deep = FALSE)"},{"path":"https://ttscience.github.io/unbiased/reference/AuditLog.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"AuditLog Class — AuditLog","text":"deep Whether make deep clone.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Set Audit Log Event Type — audit_log_set_event_type","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"function sets event type audit log. retrieves audit log request's internal data, calls audit log's set_event_type method provided event type.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"","code":"audit_log_set_event_type(event_type, req)"},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"event_type event type set audit log. req request object, contain audit log internal data.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_event_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set Audit Log Event Type — audit_log_set_event_type","text":"Returns nothing modifies audit log -place.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":null,"dir":"Reference","previous_headings":"","what":"Set Audit Log Study ID — audit_log_set_study_id","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"function sets study ID audit log. retrieves audit log request's internal data, calls audit log's set_study_id method provided study ID.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"","code":"audit_log_set_study_id(study_id, req)"},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"study_id study ID set audit log. req request object, contain audit log internal data.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/audit_log_set_study_id.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set Audit Log Study ID — audit_log_set_study_id","text":"Returns nothing modifies audit log -place.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":null,"dir":"Reference","previous_headings":"","what":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"randomize_dynamic function implements dynamic randomization algorithm using minimization method proposed Pocock (Pocock Simon, 1975). requires defining basic study parameters: number arms (K), number covariates (C), patient allocation ratios (\\(a_k\\)) (k = 1,2,…., K), weights covariates (\\(w_i\\)) (= 1,2,…., C), maximum probability (p) assigning patient group smallest total unbalance multiplied respective weights (\\(G_k\\)). total unbalance first patient regardless assigned arm, patient randomly allocated given arm. Subsequent patients randomized based calculation unbalance depending selected method: \"range\", \"var\" (variance), \"sd\" (standard deviation). case two arms, \"range\" method equivalent \"sd\" method.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"","code":"randomize_minimisation_pocock( arms, current_state, weights, ratio, method = \"var\", p = 0.85 )"},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"arms character() Arm names. current_state tibble() table covariates current arm assignments column arm, last row contains new patient empty string arm weights numeric() vector positive weights, equal length number covariates, numbered covariates, defaults equal weights ratio integer() Vector positive integers (0 allowed), equal length number arms, named arms, defaults equal weight method character() Function used compute within-arm variability, must one : sd, var, range, defaults var p numeric() single value, proportion randomness (0, 1) randomization vs determinism, defaults 85% deterministic","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"character() name arm assigned patient","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"Initially, algorithm creates matrix results comparing newly randomized patient current balance patients based defined covariates. next step, arm specified covariate, various scenarios patient allocation calculated. existing results (n) updated new patient, , considering ratio coefficients, results divided specific allocation ratio. Depending method, total unbalance calculated, taking account weights, number covariates using one three methods (“sd”, “range”, “var”). Based number defined arms, minimum value (\\(G_k\\)) (defined weighted sum level-based imbalance) selects arm patient assigned predefined probability (p). probability patient assigned arm equal (1-p)/(K-1) remaining arms.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"function's implementation refactored adaptation codebase 'Minirand' package.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"Pocock, S. J., & Simon, R. (1975). Minimization: new method assigning patients treatment control groups clinical trials. Minirand Package: Man Jin, Adam Polis, Jonathan Hartzel. (https://CRAN.R-project.org/package=Minirand)","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_minimisation_pocock.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Patient Randomization Using Minimization Method — randomize_minimisation_pocock","text":"","code":"n_at_the_moment <- 10 arms <- c(\"control\", \"active low\", \"active high\") sex <- sample(c(\"F\", \"M\"), n_at_the_moment + 1, replace = TRUE, prob = c(0.4, 0.6) ) diabetes <- sample(c(\"diabetes\", \"no diabetes\"), n_at_the_moment + 1, replace = TRUE, prob = c(0.2, 0.8) ) arm <- sample(arms, n_at_the_moment, replace = TRUE, prob = c(0.4, 0.4, 0.2) ) |> c(\"\") covar_df <- tibble::tibble(sex, diabetes, arm) covar_df #> # A tibble: 11 × 3 #> sex diabetes arm #> #> 1 M no diabetes \"control\" #> 2 F no diabetes \"active low\" #> 3 F no diabetes \"active high\" #> 4 M no diabetes \"control\" #> 5 M no diabetes \"active low\" #> 6 M no diabetes \"control\" #> 7 M no diabetes \"control\" #> 8 M no diabetes \"control\" #> 9 F diabetes \"active low\" #> 10 F no diabetes \"active low\" #> 11 F no diabetes \"\" randomize_minimisation_pocock(arms = arms, current_state = covar_df) #> [1] \"active high\" randomize_minimisation_pocock( arms = arms, current_state = covar_df, ratio = c( \"control\" = 1, \"active low\" = 2, \"active high\" = 2 ), weights = c( \"sex\" = 0.5, \"diabetes\" = 1 ) ) #> [1] \"active high\""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple randomization — randomize_simple","title":"Simple randomization — randomize_simple","text":"Randomly assigns patient one arms according specified ratios, regardless already performed assignments.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple randomization — randomize_simple","text":"","code":"randomize_simple(arms, ratio)"},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple randomization — randomize_simple","text":"arms character() Arm names. ratio integer() Vector positive integers (0 allowed), equal length number arms, named arms, defaults equal weight","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple randomization — randomize_simple","text":"Selected arm assignment.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/randomize_simple.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simple randomization — randomize_simple","text":"","code":"randomize_simple(c(\"active\", \"placebo\"), c(\"active\" = 2, \"placebo\" = 1)) #> [1] \"active\""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":null,"dir":"Reference","previous_headings":"","what":"Run API — run_unbiased","title":"Run API — run_unbiased","text":"Starts unbiased API.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run API — run_unbiased","text":"","code":"run_unbiased()"},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run API — run_unbiased","text":"host character(1) Host URL. port integer(1) Port serve API .","code":""},{"path":"https://ttscience.github.io/unbiased/reference/run_unbiased.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run API — run_unbiased","text":"Function called serve API caller thread.","code":""},{"path":"https://ttscience.github.io/unbiased/reference/unbiased-package.html","id":null,"dir":"Reference","previous_headings":"","what":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","title":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","text":"Unbiased package delivers minimization-based randomization algorithm patient allocation clinical trials, fully integrated production-ready API. designed work seamlessly persistent PostgreSQL database, ensuring reliable data management integrity. Packaged precompiled Docker images, Unbiased simplifies deployment just running docker-compose , making exceptionally straightforward incorporate environment.","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/reference/unbiased-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"unbiased: Unbiased: Production-Grade Randomization API — unbiased-package","text":"Maintainer: Kamil Sijko kamil.sijko@ttsi.com.pl (ORCID) Authors: Kinga Sałata kinga.salata@ttsi.com.pl Aleksandra Duda aleksandra.duda@ttsi.com.pl Łukasz Wałejko lukasz.walejko@ttsi.com.pl Jagoda Głowacka-Walas jagoda.glowacka-walas@ttsi.com.pl (ORCID) Laura Bąkała contributors: Michał Seweryn michal.seweryn@biol.uni.lodz.pl (ORCID) [contributor] Transition Technologies Science Sp. z o.o. [funder, copyright holder]","code":""},{"path":[]},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"new-features-1-0-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"unbiased 1.0.0","text":"Implemented support adaptive randomization using Pocock’s minimization algorithm, integrating new R function based Minirand package Man Jin, Adam Polis, Jonathan Hartzel (Minirand Package). Introduced new POST endpoints facilitating creation studies randomization subjects. Added new GET endpoints comprehensive access study overviews, -depth details, information randomized patients. Implemented audit trial mechanism systematically logs stores request database alongside unbiased’s response. Introduced new GET endpoint enabling users access complete audit trail specific study.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"vignettes--articles-1-0-0","dir":"Changelog","previous_headings":"","what":"Vignettes / Articles","title":"unbiased 1.0.0","text":"Added new article benchmarking Pocock’s minimization algorithm permuted block randomization simple randomization, focusing balance covariates.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"devops-integration-1-0-0","dir":"Changelog","previous_headings":"","what":"DevOps Integration","title":"unbiased 1.0.0","text":"Integrated project Sentry capture errors, empowering users provide credentials receive notifications event unexpected occurrences, including HTTP 500 instances. Integrated project CodeCov, achieving code coverage 95% higher, maintenance level improvement required merging. Integrated project pkgdown, hosting project site ttscience.github.io/unbiased/. Enforced use linter, ensuring errors present upon merging.","code":""},{"path":"https://ttscience.github.io/unbiased/news/index.html","id":"smaller-improvements-1-0-0","dir":"Changelog","previous_headings":"","what":"Smaller Improvements","title":"unbiased 1.0.0","text":"Improved handling malformed JSONs, now returning HTTP 400 instead default HTTP 500 (plumber behavior).","code":""}]