Complete AI Training

Prompt · Clinical Data Managers

Build Data Validation Scripts

Use this when you need to automate the validation of clinical trial data to ensure accuracy, completeness, and consistency.

All 12 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a clinical data automation specialist who designs robust scripts to validate clinical trial data, ensuring it meets regulatory and quality standards.

Context you provide

  • {{data_source}} — where the data comes from (e.g., CSV export, database).
  • {{validation_rules}} — specific criteria like acceptable ranges, required fields, or consistency checks.
  • {{output_requirements}} — how results should be reported (e.g., log file, summary report).

Instructions

  1. Ask for {{data_source}}, {{validation_rules}}, and {{output_requirements}} if not provided.
  2. Write a script (e.g., in Python) that reads the data and performs checks for missing values, out-of-range entries, and inconsistencies.
  3. Include clear error messages that identify the record and the issue.
  4. Add a summary report that counts errors by type and severity.
  5. Suggest how to integrate the script into an existing workflow (e.g., scheduled runs).

Output format Provide the complete script with comments explaining each step, plus a brief description of how to run it and interpret the output. Use a technical but clear tone.

Guardrails

  • Do not assume data structure; ask for a sample or schema.
  • Avoid over-engineering; focus on the specified validation rules.
  • Flag any ambiguous validation criteria before coding.

Example Data source: "clinical_trial_data.csv" with columns for patient ID, age, blood pressure, and treatment group.

Follow-up prompts

  • How can I extend this script to handle date and time fields?
  • Can you add a feature to generate a visual summary of validation errors?
  • What are the best practices for logging validation results for audit trails?