© 2024 IQVIA - All Rights Reserved
Cockcroft-Gault Equation
Summary
This method returns the output of the Cockcroft-Gault Equation. See online references for details about the equation itself.
Form Setup
You must specify the study event and the name of the form containing the subject weight. Also update the name of the item where the Serum Creatinine value can be found.
Formal Expression
var weightKg = findFormData('Screening', 'Height / Weight / BMI');
var scr = findFirstItemByName(formJson, 'Serum Creatinine'); //get value from form
if (weightKg != null && weightKg.length > 0) {
var d = findFirstCompletedItemByName(weightKg, 'Weight');
weightKg = parseFloat(d.value);
}
if (scr != null) {
scr = scr.value;
if (scr != null && !isNaN(scr)) {
scr = parseFloat(scr);
}
}
var dobFromDate = function(birthday) {
var ageDifMs = Date.now() - birthday.getTime();
var ageDate = new Date(ageDifMs); // miliseconds from epoch
return Math.abs(ageDate.getUTCFullYear() - 1970);
};
var dateFromString = function(dateString) {
var reggie = /(\d{4})-(\d{2})-(\d{2})/;
var dateArray = reggie.exec(dateString);
var dateObject = new Date(
(+dateArray[1]),
(+dateArray[2])-1, // Careful, month starts at 0!
(+dateArray[3]),
(+0),
(+0),
(+0)
);
return dateObject;
}
var crockAndGault = null;
var volunteer = formJson.form.subject.volunteer;
var sexFemale = (volunteer.sexMale === false);
dob = dateFromString(volunteer.dateOfBirth);
var ageYears = dobFromDate(dob);
if (scr !== null && ageYears !== null && weightKg !== null && sexFemale !== null) {
if (!sexFemale) { //male
crockAndGault = ((140 - ageYears) * weightKg) / (72 * scr);
} else { //female
crockAndGault = ((.85 * (140 - ageYears)) * weightKg) / (72 * scr);
}
crockAndGault = Math.round(crockAndGault);
}
return crockAndGault;
function findFirstCompletedItemByName(formJson, itemName, sasFieldName) {
var forms = formJson;
var completedForm = null;
if (forms && forms.length) {
for (var k = 0; k < forms.length; k++) {
var form = forms[k].form;
if (form.dataCollectionStatus == 'Complete') {
completedForm = form;
}
}
}
var itemGroups = completedForm.itemGroups;
if (itemGroups && itemGroups.length) {
for (var i = 0; i < itemGroups.length; i++) {
var itemGroup = itemGroups[i];
var items = itemGroup.items;
for (var j = 0; j < items.length; j++) {
var item = items[j];
if (item.dataCollectionStatus == 'Complete') {
if (itemName != null && item.name == itemName) {
return item;
} else {
}
if ((sasFieldName != null) && (sasFieldName.length > 0) && (item.sasFieldName == sasFieldName)) {
return item;
}
}
}
}
}
return null;
}
Exported and Printed Copies Are Uncontrolled