Creating patient 'blocks' to randomise in REDCap

46 views
Skip to first unread message

Liz Johnson

unread,
Jul 21, 2025, 10:39:25 AMJul 21
to Redcap Open
I'd like to create a project at our institute which uses the randomization module. The treatment allocation is pretty straightforward of 1:1:1, but the doctor writing the protocol would like the participants to be allocated to blocks as well so that this translates to a larger trial. Currently no stratification by demographic or condition is required. Certain randomisation systems like Sealed Envelope can support random permuted blocks, but I'm struggling to see how to activate this, or how to import this as an option into the randomisation template you upload to REDCap. Does anyone have any ideas?

Danilo Micali

unread,
Jul 22, 2025, 10:11:21 AMJul 22
to Redcap Open
Hi Liz,

I have already used block randomization in a REDCap project and all I had to do was upload a CSV allocation table to the randomization settings page on REDCap (Step 3). This allocation table will basically have the order of treatments REDCap will assign to the participants being randomized. 

All you have to guarantee is that this is order has been randomized in blocks. Supposing you set a block size of 6, at every six participants randomized all treatments will have been picked an equal number of times. This is great to avoid ending up with significant discrepancies among group sizes — which could potentially happen in a randomization with no blocks.

Attaching isn't working for me here, but below is an example what it could look like:

redcap_randomization_number redcap_randomization_group
1 Treatment A
2 Treatment C
3 Treatment B
4 Treatment B
5 Treatment A
6 Treatment C

7 Treatment B
8 Treatment C
9 Treatment A
10 Treatment B

In bold, we have the first block. You can notice that when the block ends it has equal counts for all treatments. The treatments are randomized inside each block only and you can have as many blocks as you want. 

To generate my allocation table, I wrote a script in R. But you can definitely find other ways of doing it. If you prefer, you can reach out to a statistician not related to the study (or who doesn't have to be blind to the treatments) and ask them to generate block randomization for you. And then you just have to make sure only non-blind personal (preferably only you) will have access to the allocation table. 

My tip for block randomization is to create an allocation table to at least 5x more participants than you will need to randomize as this is something you won't be able to change later on in case you need to enroll more participants.

I hope this helps!

Best regards,
Danilo

Rick Watts

unread,
Jul 22, 2025, 11:12:23 AMJul 22
to Liz Johnson, Redcap Open
I have a document that might help. I'll send a link separately.

Rick Watts

Team Lead, Research Informatics, Women and Children’s Health Research Institute

Health Research Data Strategist, College of Health Sciences


rick....@ualberta.ca

University of Alberta

5-083 Edmonton Clinic Health Academy (ECHA)

11405 87 Avenue NW Edmonton, AB T6G 1C9

F:  (780) 248-5616


        University of Alberta Logo


WCHRI is a partnership between the University of Alberta and Alberta Health Services, funded by the generosity of the Stollery Children's Hospital Foundation and the Alberta Women’s Health Foundation.


The University of Alberta respectfully acknowledges that we are situated on Treaty 6 territory, traditional lands of First Nations and Métis people.


 



On Mon, Jul 21, 2025 at 8:39 AM 'Liz Johnson' via Redcap Open <redca...@googlegroups.com> wrote:
I'd like to create a project at our institute which uses the randomization module. The treatment allocation is pretty straightforward of 1:1:1, but the doctor writing the protocol would like the participants to be allocated to blocks as well so that this translates to a larger trial. Currently no stratification by demographic or condition is required. Certain randomisation systems like Sealed Envelope can support random permuted blocks, but I'm struggling to see how to activate this, or how to import this as an option into the randomisation template you upload to REDCap. Does anyone have any ideas?

--
You received this message because you are subscribed to the Google Groups "Redcap Open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/redcap_open/c961e0c0-af81-4fd9-8a71-6d028926ad83n%40googlegroups.com.

Luke Stevens

unread,
Jul 22, 2025, 8:27:02 PMJul 22
to Liz Johnson, Redcap Open

Hello Liz,

 

You just need to set up your project with a field for the target allocation (i.e. groups) and any stratification factors (or none, in your case), then set up the randomisation model to use them. REDCap does not need to know about block sizes because it does not generate your schedule itself, only gives you the examples so you know what columns and values to use for allocation and stratification. That means you can generate your schedule to whatever specification you like in terms of allocation ratio and block size, using whatever tool it suits you best to use.

 

Our statisticians at Murdoch Children’s use Stata, for which there exists a package named “ralloc” (http://fmwww.bc.edu/repec/bocode/r/ralloc.html) that makes permuted block schedule generation very easy. You just plug your parameters into the function according to your requirements. For example:

ralloc block_id block_size arm, /// column names for block and group info

    seed(22072025)     /// seed for random number generation - for repeatability

    nsubj(60)          /// number of records per stratum

    ntreat(3)          /// number of allocation groups

    ratio(1)           /// allocation ratios

    init(3)            /// smallest block size

    osize(2)           /// number of block sizes

    strata(2)          /// number of strata

    equal              /// use equal frequency for block sizes

    saving("example")  /// save to dta file

 

gen randid=_n

 

 

There will be similar packages available for other software, no doubt. The important thing is to generate the schedule in a transparent, robust, and reproducible manner, and independently of the trial team. Our SOP allows the trial statistician to generate the Stata script to meet the requirements of the Protocol, but it is always an independent statistician that sets the seed and runs it. The list is then checked by a second independent statistician and passed to me or someone in my REDCap admin team for uploading into the project. The trial statistician and project team are not involved in those steps.

 

Beyond that, I always recommend you maintain any id/randomisation number generated with the schedule and upload as REDCap’s redcap_randomization_number values. This way you will maintain the traceability between the generated schedule and record allocations. I would also suggest capturing server time of randomisation using a datetime_seconds field with the @CALCDATE([rand-time],0,'s') action tag (and maybe also the utc time should you ever have sites in multiple timezones).

 

I hope that helps.


Regards,

Luke

Luke Stevens
Research Data Systems Manager
Clinical Epidemiology & Biostatistics Unit (CEBU)
Murdoch Children's Research Institute
The Royal Children's Hospital, 50 Flemington Road
Parkville, Victoria 3052 Australia
T   +61 3 9345 6552
E   luke.s...@mcri.edu.au
W  mcri.edu.au

 

 

 

From: 'Liz Johnson' via Redcap Open <redca...@googlegroups.com>
Sent: Tuesday, 22 July 2025 00:39
To: Redcap Open <redca...@googlegroups.com>
Subject: [REDCap Open] Creating patient 'blocks' to randomise in REDCap

 

CAUTION:  External Email. Please be cautious with attachments and clicking links

 

I'd like to create a project at our institute which uses the randomization module. The treatment allocation is pretty straightforward of 1:1:1, but the doctor writing the protocol would like the participants to be allocated to blocks as well so that this translates to a larger trial. Currently no stratification by demographic or condition is required. Certain randomisation systems like Sealed Envelope can support random permuted blocks, but I'm struggling to see how to activate this, or how to import this as an option into the randomisation template you upload to REDCap. Does anyone have any ideas?

--

You received this message because you are subscribed to the Google Groups "Redcap Open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/redcap_open/c961e0c0-af81-4fd9-8a71-6d028926ad83n%40googlegroups.com.



This e-mail and any attachments to it (the "Communication") are, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Murdoch Children’s Research Institute (MCRI) ABN 21 006 566 972 or any of its related entities. MCRI does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication.

Liz Johnson

unread,
Jul 23, 2025, 4:16:50 AMJul 23
to Redcap Open
Thank you all! Your responses have been incredibly helpful and I *think* I've got it worked out now. Much appreciated everyone! :)
Reply all
Reply to author
Forward
0 new messages