Notebooks
N
NVIDIA
Clinical Trials

Clinical Trials

gpu-accelerationretrieval-augmented-generationllm-inferencetensorrthealthcare-datasetsnvidia-generative-ai-examplesself-hosted-tutorialslarge-language-modelsmicroservicetriton-inference-servercommunity-contributionsLLMragnemoNeMo-Data-Designer

🏥 NeMo Data Designer: Clinical Trials Dataset Generator

📚 What you'll learn

This notebook demonstrates how to use structured samplers, person/PII generators, and LLMs to create a realistic
synthetic clinical trials dataset—including trial metadata, participant demographics, investigator details,
clinical notes, and adverse event reports—for evaluating data protection and anonymization techniques.


👋 IMPORTANT – Environment Setup

  • If you haven't already, follow the instructions in the README to install the necessary dependencies.

  • You may need to restart your notebook's kernel after setting up the environment.

  • In this notebook, we assume you have a self-hosted instance of Data Designer up and running.

  • For deployment instructions, see the Installation Options section of the NeMo Data Designer documentation.

📦 Import the essentials

  • The data_designer module of nemo_microservices exposes Data Designer's high-level SDK.

  • The essentials module provides quick access to the most commonly used objects.

[ ]

⚙️ Initialize the NeMo Data Designer Client

  • NeMoDataDesignerClient is responsible for submitting generation requests to the microservice.
[ ]

🎛️ Define model configurations

  • Each ModelConfig defines a model that can be used during the generation process.

  • The "model alias" is used to reference the model in the Data Designer config (as we will see below).

  • The "model provider" is the external service that hosts the model (see the model config docs for more details).

  • By default, the microservice uses build.nvidia.com as the model provider.

[ ]

🏗️ Initialize the Data Designer Config Builder

  • The Data Designer config defines the dataset schema and generation process.

  • The config builder provides an intuitive interface for building this configuration.

  • The list of model configs is provided to the builder at initialization.

[ ]

🎲 Getting Started with Sampler Columns

  • Sampler columns offer non-LLM based generation of synthetic data.

  • They are particularly useful for steering the diversity of the generated data, as we demonstrate below.

  • The persona samplers allow you to sample realistic details of individuals using a model trained on the US Census.
    If the locale of the persona you are generating is anything other than en_US, then the personas will be generated using Faker

[ ]

Creating Trial Information

Next, we'll create the basic trial information:

  • Study ID (unique identifier)
  • Trial phase and therapeutic area
  • Study design details
  • Start and end dates for the trial
[ ]

Participant Information

Now we'll create fields for participant demographics and enrollment details:

  • Participant ID and basic information
  • Demographics (age, gender, etc.)
  • Enrollment status and dates
  • Randomization assignment
[ ]

Investigator and Staff Information

Here we'll add information about the trial staff:

  • Investigator information (principal investigator)
  • Study coordinator details
  • Site information
[ ]

Clinical Measurements and Outcomes

These columns will track the key clinical data collected during the trial:

  • Vital signs and lab values
  • Efficacy measurements
  • Dosing information
[ ]

Adverse Events Tracking

Here we'll capture adverse events that occur during the clinical trial:

  • Adverse event presence and type
  • Severity and relatedness to treatment
  • Dates and resolution
[ ]

Narrative text fields with style variations

These fields will contain natural language text that incorporates PII elements. We'll use style seed categories to ensure diversity in the writing styles:

  1. Medical observations and notes
  2. Adverse event descriptions
  3. Protocol deviation explanations

Note: At this time, we only support using a single file as the seed. If you have multiple files you would like to use as seeds, it is recommended you consolidated these into a single file.

[ ]

Adding Constraints

Finally, we'll add constraints to ensure our data is logically consistent:

  • Trial dates must be in proper sequence
  • Adverse event dates must occur after enrollment
  • Measurement changes must be realistic
[ ]

🔁 Iteration is key – preview the dataset!

  1. Use the preview method to generate a sample of records quickly.

  2. Inspect the results for quality and format issues.

  3. Adjust column configurations, prompts, or parameters as needed.

  4. Re-run the preview until satisfied.

[ ]
[ ]

📊 Analyze the generated data

  • Data Designer automatically generates a basic statistical analysis of the generated data.

  • This analysis is available via the analysis property of generation result objects.

[ ]

🆙 Scale up!

  • Happy with your preview data?

  • Use the create method to submit larger Data Designer generation jobs.

[ ]
[ ]
[ ]
[ ]