© 2024 IQVIA - All Rights Reserved
Age-specific Validation
Summary
Methods and edit checks have access to a variety of data in the volunteer profile. This is made available to the formal expression via the formJson variable which is implicitly passed to all executions. Note that the form data itself is removed from the below, showing only the study and subject context that is available.
{
"form": {
"name": "Vital Signs",
"studyEventName": "Day -1",
"cohort": {
"id": 499,
"name": "Cohort 1",
"epoch": {
"id": 256,
"name": "Treatment"
}
},
"timepoint": null,
"canceled": false,
"dataCollectionStatus": "Complete",
"subject": {
"id": 216,
"locked": false,
"screeningNumber": "S001",
"leadInNumber": null,
"randomizationNumber": "1001",
"subjectStudyStatus": "Active",
"subjectEligibilityType": "Eligible",
"volunteer": {
"id": 645,
"initials": "ECT",
"age": 45,
"sexMale": true,
"dateOfBirth": "1975-07-04"
}
}
}
}
In this case the task is to validate based on a subject’s age. The age is available in the Json directly, and can be accessed by:
formJson.form.subject.volunteer.age
Note that this is a general technique that can be applied to many use cases and leverage any data passed in formJson.
Form Setup and Edit Check
Any form will work for this scenario since all executions have access to the volunteer profile info. In this example we are applying validation that is age dependent for the systolic pressure.
Here is an example form stetup for this method.
And here is a method which applies age-specific validations.
This method uses the implicit customErrorMessage method which allows you to specify a custom message to the user that can be set in the edit check itself. This method is available in ClinSpark 1.5.3 and later. For earlier instances, you must remove this function or the edit check will fail.
var value = itemJson.item.value;
var age = formJson.form.subject.volunteer.age;
logger('value '+value+', age '+age);
var isValid;
if (age < 59) {
isValid = value >= 90 && value <= 140;
if (!isValid) {
// customErrorMessage requires ClinSpark 1.5.3+
customErrorMessage("Systolic must be between 90-140 for subjects 59 and younger")
}
} else {
isValid = value >= 90 && value <= 160;
if (!isValid) {
customErrorMessage("Systolic must be between 90-160 for subjects 60 or older")
}
}
return isValid;
Exported and Printed Copies Are Uncontrolled