/
Comparison of End of Study and AE Outcomes
Ā© 2025 IQVIA - All Rights Reserved
Comparison of End of Study and AE Outcomes
Summary
This edit check ensures that if the end of study āReason for Completion or Terminationā item value is āADVERSE EVENTā, then an adverse event form must exist for the subject of interest and the item value for the āTreatment Actionā item within an adverse event form must be āDrug Withdrawnā
Formal Expression
// Constants for hardcoded strings
var ADV_REASON_STRING = 'ADVERSE EVENT';
var STUDY_EVENT_NAME = 'AE / CM';
var FORM_NAME = 'AE / CM';
var AE_TREATMENT_ACTION_ITEM = 'AE_TREATMENT_ACTION';
var DRUG_WITHDRAWN_VALUE = 'Drug Withdrawn';
// Fetch the current reason value
var reason = itemJson.item.value;
logger('reason: ' + reason);
// If reason is not ADVERSE EVENT (case insensitive), log and return true
if (reason.toLowerCase() !== ADV_REASON_STRING.toLowerCase()) {
logger('The reason is not an ADVERSE EVENT.');
return true;
}
// Otherwise, perform lookup using findFormData
var aeForms = findFormData(STUDY_EVENT_NAME, FORM_NAME);
logger('Number of AE / CM forms found: ' + aeForms.length);
// Initialize flag to check for 'Drug Withdrawn'
var drugWithdrawnFound = false;
// Iterate over each form and check AE_TREATMENT_ACTION value
for (var i = 0; i < aeForms.length; i++) {
var form = aeForms[i];
var treatmentActionItem = findFirstItemByName(form, AE_TREATMENT_ACTION_ITEM);
if (treatmentActionItem && treatmentActionItem.value) {
logger('AE_TREATMENT_ACTION value in form ' + (i + 1) + ': ' + treatmentActionItem.value);
// Check if the value is 'Drug Withdrawn' (case insensitive)
if (treatmentActionItem.value.toLowerCase() === DRUG_WITHDRAWN_VALUE.toLowerCase()) {
drugWithdrawnFound = true;
break; // No need to continue, we found a match
}
} else {
logger('AE_TREATMENT_ACTION not found or has no value in form ' + (i + 1));
}
}
// If 'Drug Withdrawn' is found, return true
if (drugWithdrawnFound) {
return true;
}
// If no 'Drug Withdrawn' is found, return false with an error message
customErrorMessage('No AE_TREATMENT_ACTION item with the value "Drug Withdrawn" was found.');
return false;
Edit Check Walkthrough
, multiple selections available,
Related content
Ongoing Consistent with End Date
Ongoing Consistent with End Date
More like this
Compare lab collections with date/ time of last meal
Compare lab collections with date/ time of last meal
Read with this
Comparison to Baseline
Comparison to Baseline
More like this
Custom Error Messages
Custom Error Messages
Read with this
Return a Unique Incremental ID Number
Return a Unique Incremental ID Number
More like this
Age-specific Validation
Age-specific Validation
Read with this
Exported and Printed Copies Are Uncontrolled