Case Study - Permuted Block Randomization

For this app, a research study needs participants assigned to random cohorts upon enrollment, based on a predetermined permuted block randomization sequence.


Permuted block randomization helps to ensure that at the end of each “block” of assignments, the distribution is 50/50. This provides for a more reliable distribution than using a simple randomization (like a coin flip). Simple randomizations will trend toward a 50/50 distribution as you approach large numbers of participants, but can can result in unequal distributions—particularly with small numbers of participants.

Randomized control and treatment cohorts.
Randomized control and treatment cohorts.

For more information about block randomization, consider these resources:


At a high level, there are two major components to this app:

  • MyDataHelps - Stores cohort information for each participant and provides information about newly-enrolled participants.
  • Amazon Web Services (AWS) - Interacts with the MyDataHelps API to assign participants to cohorts.

The app uses several AWS services to control the randomization.

  1. An AWS CloudWatch event is configured to run several times a day.
  2. An AWS DynamoDB database stores the pre-determined randomization sequence and other information necessary to determine which cohort the next participant should be assigned to.
  3. The scheduled event kicks off an AWS Lambda that:
    • Uses the MyDataHelps API to check for newly-enrolled participants who haven’t been assigned to a cohort.
    • Assigns them to the appropriate cohorts using the randomization sequence in the database.
    • Updates the database so the next participant can be assigned correctly.
    • Uses the MyDataHelps API to save the cohort information for the new participants.

The AWS lambda leverages the MyDataHelps Participants API to obtain participants who do not have a cohort assigned, and to assign their cohort. Cohort information is saved as a custom field in MyDataHelps.

Project Setup

For all of this to work, several things need to be configured in the MyDataHelps project: