How to validate research software for clinical studies
What ICH E6(R3) and FDA guidance expect, how to scale testing to risk, and how to validate analysis scripts, study apps and eCRFs before trial data touch them.

- Any software that captures, changes or analyses trial data needs validation scaled to its risk.
- Validation is testing plus written requirements, traceability and change control.
- Test high-risk functions with scripted tests, saved evidence and an independent check.
- Keep the plan, risk assessment, trace matrix, evidence and signed report in one package.
Validating research software for a clinical study means showing, with written evidence, that each program touching trial data does what the protocol needs, every time, and that any change is controlled. In short: list every system that creates, changes or analyses trial data, rank each by its risk to participants and results, test the high-risk functions with scripted tests and saved evidence, keep the paperwork in one validation package, and re-test after every change.
The rules are written for computerised systems in general, not for big vendor platforms only. ICH E6(R3), the good clinical practice guideline adopted on 6 January 2025, says computerised systems used in clinical trials should be fit for purpose, for example through risk-based validation, and gives them a section of their own (4.3). That covers the R script that derives the primary endpoint and the study app a postdoc wrote, as well as the commercial data capture system.
Who does the work depends on the system. Academic groups usually validate their own scripts with help from a trials unit or a quality team. When a sponsor contracts out a study app or data platform, it often brings in a vendor offering healthcare software testing services to write and run the test protocol, while investigators keep the requirements, the risk calls and the final sign-off. The steps below apply either way.
Which research software counts as a clinical computerised system?
Any software that captures, transforms, stores or analyses data used to make decisions about participants or to support the trial's results counts. The question is not who wrote it, but what the data feed into.
| Software | Typical example | Validation expected? |
|---|---|---|
| Electronic data capture (eCRF) | REDCap project, commercial EDC build | Yes: the study build and edit checks, not only the platform |
| Participant-facing app | ePRO diary, home sensor app | Yes: data are source records |
| Derivation and analysis code | R or SAS scripts for endpoints and tables | Yes, scaled to risk; primary endpoints first |
| Randomisation and dosing tools | Allocation script, dose calculator | Yes, high risk: errors reach participants directly |
| Data transfer and cleaning scripts | Lab file import, merge of site exports | Yes: dropped or mismatched rows are easy to miss |
| Exploratory notebooks | Hypothesis-generating plots | Usually light; document and version them |
Start with an inventory. ICH E6(R3) asks sponsors to keep a record of the computerised systems used in a trial, including their use, functionality, interfaces, validation status and who is responsible for each one. A spreadsheet with those columns is a good first deliverable.
What do ICH E6(R3), Part 11 and FDA guidance ask for?
All of them ask for systems that are fit for their intended use, with evidence proportionate to the risk. They differ in scope and detail.
- ICH E6(R3), section 4.3. Covers procedures, training, security, validation, system failure, technical support and user management for computerised systems. Requirements should be proportionate to the importance of the system and the data.
- 21 CFR Part 11. The US rule for electronic records and signatures. It asks for validated systems, secure audit trails, access controls and controls on electronic signatures.
- FDA's Part 11 scope and application guidance (2003). Narrows how FDA applies Part 11 and supports a justified, risk-based approach to validation and audit trails.
- FDA's Q&A guidance on electronic systems in clinical investigations (October 2024). The most current FDA view for trials. It recommends a risk-based approach to validating electronic systems, weighing what the system does and how it affects participant safety and data reliability.
- FDA's General Principles of Software Validation (2002). Written for device and quality system software, but its life-cycle ideas (requirements, traceable tests, regression testing after change) are widely borrowed.
None of these documents certifies a product. A platform described as "Part 11 ready" offers the features; the team running the trial still has to show that its own configuration works.
What is the difference between testing and validation?
Testing checks that code behaves as written; validation shows, with evidence, that the system meets the needs of this study. Unit tests are part of validation, but they are not the whole of it.
A validated system has three things testing alone does not give you:
- Written requirements. What the system must do for this protocol, in words a monitor can read: "flags systolic pressure above 180 for review", not "function check_bp passes".
- Traceability. Each requirement links to the test that proves it, and each test result links to saved evidence such as an output file, a screenshot or a log.
- Control after release. Changes go through a recorded process, and affected tests run again before the new version touches trial data.
If your group already writes tests, you are part of the way there. Our guide to testing research code covers unit and regression tests; validation adds the requirements, the trace and the signatures around them.
How do you scale validation to risk?
Rate each function by how badly an error could hurt participants or bias the result, and how likely an error is to go unnoticed. Then match the testing effort to the rating.
| Risk | Examples | Testing approach |
|---|---|---|
| High | Randomisation, dose calculation, primary endpoint derivation, safety alerts | Scripted tests with expected results written in advance, saved evidence, independent check or double programming |
| Medium | Secondary endpoints, data imports, edit checks, exports to the statistician | Scripted tests for main paths and known edge cases, evidence for each run |
| Low | Report layout, exploratory plots, internal convenience tools | Unscripted or exploratory testing, recorded briefly; peer review of code |
Write the rating and the reason down. Light testing of a low-risk tool is defensible only if the risk assessment shows why the tool is low risk.
How do you validate a statistical analysis script in R or Python?
Pin the environment, write the expected results before you run the tests, and have someone other than the author confirm the key outputs. For the endpoints that decide the trial, independent double programming is the strongest check.
- Freeze the spec. Tie the script to the statistical analysis plan and list the derivations it performs: population flags, visit windows, imputation rules, the model.
- Pin the environment. Record language and package versions with a lockfile or container, as described in our guide to reproducible environments. A package update can change a default and shift a result.
- Build test datasets. Small synthetic datasets with hand-calculated answers, including edge cases: missing visits, out-of-window dates, duplicate IDs, extreme values, a participant who withdraws.
- Run and save evidence. Automate the tests, save outputs and logs with the git commit they came from, and record pass or fail against the expected values.
- Check independently. A second programmer rewrites the primary derivations from the spec without reading the original code, and the outputs are compared. Differences are investigated and recorded, not quietly fixed.
- Review the code. A structured review catches errors tests miss; our article on code review in research groups explains how to run one.
Only about one in eight clinical prediction studies shared code, according to the review covered in our report on code sharing in clinical prediction studies. That leaves readers no way to check the analysis behind most published models.
How do you test a study app or eCRF built in-house?
Test the study build against the protocol, not just the platform. A validated platform with a wrong branching rule or a missing range check still produces bad data.
- Edit checks and branching. For each field, enter valid, invalid and boundary values and confirm the right query or skip fires. Keep a table of inputs and expected results.
- Audit trail. Create, change and delete a test record; confirm the trail shows who, what, when and the old value, and that users cannot edit it.
- Roles and access. Log in as each role and confirm that site staff see only their site and that blinded users cannot see allocation.
- Offline and sync. For mobile apps, collect data with the network off, reconnect, and check that nothing is lost or duplicated. Our guide to mobile data collection apps covers this failure in more detail.
- Exports. Export a known test dataset and compare it field by field with what was entered, including dates, time zones and coded values.
- User acceptance. Have study coordinators run realistic visits with test participants before go-live and sign off the results.
Never test on live participant data, and keep test records in a separate project or clearly flagged so they cannot leak into the analysis.
What documents belong in a validation package?
A validation package is the set of documents that lets someone outside the team see what was tested, how and with what result. For a small academic system it can be short, but it should exist in one place.
- Validation plan: scope, roles, approach and acceptance criteria.
- Requirements specification: what the system must do for this study.
- Risk assessment: each function rated, with the reason.
- Traceability matrix: requirement to test to result.
- Test scripts and evidence: steps, expected results, actual results, tester, date.
- Deviation log: every failed test, its cause and how it was resolved.
- Summary report: outcome and a release decision signed by the responsible person.
- Change control and version history: what changed after release and what was re-tested.
Store it with the trial master file or wherever your quality system says. If the code lives in git, put the tag of the validated release in the summary report.
How do you keep validation current when the code changes?
Treat every change to a validated system as a small project: describe it, assess its impact, re-run the affected tests and record the release. Continuous integration makes the re-running cheap.
- Tag releases. Only tagged, validated versions touch trial data. Our guide to version control for researchers covers tags and branches.
- Automate regression tests. Run the full suite on every merge, so a fix in one derivation cannot break another without anyone noticing.
- Assess impact before coding. A change to a label needs less than a change to a visit window. Record the decision.
- Watch dependencies. Platform upgrades and package updates are changes too. Re-run tests after them, even if your own code did not move.
When does research software become a medical device?
Software can be regulated as a medical device when it is intended to diagnose, treat, monitor or prevent disease in individual patients, for example a tool that recommends a dose or flags a diagnosis for clinical action. Then device rules apply on top of trial rules, and standards such as IEC 62304 set the software life-cycle requirements.
Data capture and analysis code used only to run a trial usually stays on the trial side. The line depends on intended use and jurisdiction, so ask your regulatory office early if the software will inform care for individual participants.
When should a research team bring in outside testers?
Bring in outside help when the system is high risk, the team that built it is also the only team testing it, or the trial will face a regulatory inspection. Independence is part of what makes evidence credible.
- Your institution first. Clinical trials units and research quality offices often run validation for investigator-led studies and know local procedures.
- A colleague from another group. For analysis code, a second programmer from a different team gives real independence at low cost.
- A contracted test team. For apps and platforms built by contractors, a separate testing vendor avoids the builder marking its own homework.
Whoever tests, the investigators own the requirements and the risk decisions. Outsourcing the test runs does not outsource responsibility for the trial.
Checklist before trial data touch your software
- System listed in the inventory with purpose, interfaces, owner and validation status.
- Requirements written and tied to the protocol or analysis plan.
- Risk assessment done; high-risk functions identified.
- Scripted tests with expected results written before execution.
- Evidence saved for each test, linked from a traceability matrix.
- Audit trail, roles and exports tested; no live participant data used.
- Independent check of primary derivations or high-risk functions.
- Summary report signed, with the git tag or build number of the released version.
- Change control in place and regression tests automated.
For a small study this is days of work, not months. Doing it before the first participant is enrolled costs far less than re-analysing a trial afterwards.
Questions about validating clinical research software
Does a REDCap project need to be validated?
The REDCap installation is usually validated by the institution or vendor that hosts it; ask your REDCap administrator for their documentation. Your study build still needs testing by the study team: fields, branching logic, edit checks, user roles and exports are specific to your protocol.
Is unit testing enough for clinical trial software?
No. Unit tests show that code behaves as written. Validation also needs written requirements tied to the protocol, traceability from each requirement to a test and saved evidence, and change control after release.
What is double programming?
Double programming means a second programmer writes the same derivations or analyses independently from the specification, without reading the original code, and the two sets of outputs are compared. Differences are investigated and recorded. It is the strongest check for primary endpoints.
Does 21 CFR Part 11 apply to academic trials outside the US?
Part 11 applies when records fall under FDA regulations, for example a trial run under a US IND or data submitted to FDA. Trials outside that scope usually follow ICH E6(R3) and national rules, which set similar expectations for validated, risk-proportionate computerised systems.
How long does validating research software take?
It depends on risk and size. A small study with a REDCap build and a few analysis scripts can often be validated in days if requirements and test data are prepared early. Randomisation tools, dosing calculators and participant apps take longer because they need scripted tests and independent checks.
Keep reading. More from the desk.
Testing research code: where to start
You already check your results by hand. Automated tests do the same checks every time the code changes, so a quiet bug gets caught the same day instead of in review.

Only 1 in 8 clinical prediction studies shares its code, MIT and Dana-Farber review finds
An MIT and Dana-Farber review of 3,967 clinical prediction studies found that 12.2% shared code, and few repositories were easy to rerun. What to do.

Mobile data collection apps for research: when a form is enough and when to build
Most field studies never need custom software. This guide shows what form-based tools handle well, the signals that a study has outgrown them and how to keep either route reviewable.