// for each time point get the list of flags' records foreach ($result as $currentTimepoint) { // get the identification data // from the query above $sessionID = $currentTimepoint['SessionID']; $data['SessionID'] = $sessionID; $data['MRIQCStatus'] = $currentTimepoint['MRIQCStatus']; $data['MRIQCPending'] = $currentTimepoint['MRIQCPending']; $data['Scan_done'] = $currentTimepoint['Scan_done']; $data['BVLQCStatus'] = $currentTimepoint['BVLQCStatus']; $data['BVLQCType'] = $currentTimepoint['BVLQCType']; $data['Submitted'] = $currentTimepoint['Submitted']; $data['Approval'] = $currentTimepoint['Approval']; fwrite(STDERR, "Timepoint: {$sessionID}; "); // create TimePoint_exclusion object $timepointFlagObject =& TimePoint_Flag::singleton($sessionID); // from the timepoint class $data['Site'] = $timepointFlagObject->getPSC(); $data['DCCID'] = $timepointFlagObject->getCandID(); $data['Visit'] = $timepointFlagObject->getVisitLabel(); $data['Objective'] = $timepointFlagObject->getObjective(); // NOT YET AVAILABLE $data['Certification'] = ''; /** * PROFILE & timepoint info */ $query = "SELECT c.DoB, c.EDC, c.PSCID, s.Date_visit, w.Date_taken as WASI_date," . "d.Date_taken as DAS_date FROM candidate as c LEFT JOIN session as s " . "USING (CandID) LEFT JOIN flag as f ON (s.ID = f.SessionID) " . "LEFT JOIN wasi as w ON (f.CommentID = w.CommentID) " . "LEFT JOIN das as d ON (f.CommentID = d.CommentID) " . "WHERE f.Test_name IN ('wasi', 'das') AND s.VisitNo=1 " . "AND c.CandID=" . $data['DCCID']; $db->selectRow($query, $candrow); $data['PSCID'] = $candrow['PSCID']; if ($data['Objective'] == 2) { $dateBirth = $candrow['EDC'];
$filename .= "_obj{$subProjectID}"; } if (!empty($sessionID)) { $filename .= "_candidate_" . $result[0]['CandID'] . "_visit_" . $result[0]['Visit_label']; } $today = date("YMd"); $filename .= "_{$today}"; fwrite(STDERR, $filename . "\n"); $i = 0; foreach ($result as $currentTimepoint) { $sessionID = $currentTimepoint['ID']; // create Flag object if (isset($timepointFlagObject)) { unset($timepointFlagObject); } $timepointFlagObject = new TimePoint_Flag(); $success = $timepointFlagObject->select($sessionID); $constantsArray = array($timepointFlagObject->showConstant('TIMEPOINT_FLAG_MISSING_DATA'), $timepointFlagObject->showConstant('TIMEPOINT_FLAG_NA_INSTRUMENT')); // get flag types to assign the proper status to the session/flag records if (empty($flagTypeIDs)) { $flagTypeIDs = $timepointFlagObject->getFlagTypeIDs(); } // evaluate the flags for the timepoint and get the list // of triggered flags and their statuses // flag statuses are captured as constants TIMEPOINT_FLAG_TRIGGER, // TIMEPOINT_FLAG_NA_INSTRUMENT, TIMEPOINT_FLAG_NULL $flagList = array(); $flagList = $timepointFlagObject->evaluateTimepointFlags(); // if there are no flags skip to next timepoint if (count($flagList) == 0) { continue;