本文整理汇总了PHP中REDCap::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP REDCap::getData方法的具体用法?PHP REDCap::getData怎么用?PHP REDCap::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REDCap
的用法示例。
在下文中一共展示了REDCap::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: score
$pretty_field_names['cirr_suppfa_cirrstat'] = 'Cirrhosis status';
$pretty_field_names['plt_suppfa_faorres'] = 'Platelets <140K';
$pretty_field_names['livbp_faorres'] = 'Fibrosis score (adjusted)';
/**
* WORKING DATA
*/
$pts = array();
$table_csv = "";
$fields = array_merge(array('cirr_suppfa_cirrstat'), $fields, array('plt_suppfa_faorres'));
$pt_result = db_query("SELECT DISTINCT record FROM redcap_data WHERE project_id = '$project_id' AND field_name = 'cirr_suppfa_cirrstat' AND value != '' ORDER BY abs(record) ASC");
if ($pt_result) {
while ($pt_row = db_fetch_assoc($pt_result)) {
$pts[] = $pt_row['record'];
}
}
$data = REDCap::getData('array', $pts, $fields);
foreach ($data AS $subject_id => $subject) {
$data_row = array();
$data_row['subjid'] = $subject_id;
foreach ($subject AS $event_id => $event) {
/**
* if ishak or unknown scales were used, adjust the scale value
*/
if ($event['livbp_facat'] == 'ISHAK' || $event['livbp_facat'] == 'UNKNOWN') {
if ($event['livbp_faorres'] >= '5') {
$event['livbp_faorres'] = '4';
} elseif ($event['livbp_faorres'] == '3' || $event['livbp_faorres'] == '4') {
$event['livbp_faorres'] = '3';
}
}
switch ($event['fib_lbtest']) {
示例2: microtime
* initialize variables
*/
$timer_start = microtime(true);
$monitor_name = $_POST['monitor_name'];
$table_csv = "";
$export_filename = "TRANSPLANT_MONITORING_" . strtoupper($monitor_name);
/**
* get sim/sof data
*/
$fields = array('sim_cmstdtc', 'sof_cmstdtc');
$data = REDCap::getData('array', '', $fields);
/**
* get TX history data
*/
$hist_fields = array("dm_rfstdtc", "dis_suppfa_txendt", "livr_mhoccur");
$hist_data = REDCap::getData('array', '', $hist_fields, $baseline_event_id);
$subject_sql = "SELECT data.record AS subjid, IF (demo.username IS NULL, 'N', 'Y') AS demo_locker, IF (eot.username IS NULL, 'N', 'Y') AS eot_locker, dsterm.value AS eot_status, geno.value AS genotype FROM
(SELECT DISTINCT record, project_id FROM `redcap_data`) data
LEFT OUTER JOIN
(SELECT * FROM `redcap_locking_data` WHERE form_name = 'demographics') demo
ON data.record = demo.record AND data.project_id = demo.project_id
LEFT OUTER JOIN
(SELECT * FROM `redcap_locking_data` WHERE form_name = 'early_discontinuation_eot') eot
ON data.record = eot.record AND data.project_id = eot.project_id
LEFT OUTER JOIN
(SELECT * FROM redcap_data WHERE field_name = 'eot_dsterm') dsterm
ON data.record = dsterm.record AND data.project_id = dsterm.project_id
LEFT OUTER JOIN
(SELECT * FROM redcap_data WHERE field_name = 'hcvgt_lborres') geno
ON data.record = geno.record AND data.project_id = geno.project_id
WHERE data.project_id = '$project_id'";
示例3: microtime
*/
$timer['start_fields'] = microtime(true);
$su_fields_result = db_query($fields_query);
$su_fields = array('dm_usubjid');
if ($su_fields_result) {
while ($su_fields_row = db_fetch_assoc($su_fields_result)) {
foreach ($su_fields_row AS $field_key => $field_name) {
if (!in_array($field_key, array('type', 'label'))) {
$su_fields[] = $field_name;
}
}
}
db_free_result($su_fields_result);
}
$su_fields = array_unique($su_fields);
$data = REDCap::getData('array', $subjects, $su_fields);
$timer['have_data'] = microtime(true);
$fields_result = db_query($fields_query);
$timer['have_fields'] = microtime(true);
if ($fields_result) {
while ($fields = db_fetch_assoc($fields_result)) {
foreach ($data AS $subject_id => $subject) {
$usubjid = '';
foreach ($subject AS $event_id => $event) {
$inner_vals = array();
if ($usubjid == '') {
$usubjid = $event['dm_usubjid'];
}
if ($fields['type'] == 'descriptive') {
示例4: microtime
*/
global $Proj;
$first_event_id = $Proj->firstEventId;
$plugin_title = "Derive stuff";
/**
* plugin title
*/
echo "<h3>$plugin_title</h3>";
/**
* MAIN
*/
if ($debug) {
$timer['main_start'] = microtime(true);
}
$fields = array('dm_usubjid');
$data = REDCap::getData('array', $subjects, $fields, $first_event_id);
d($data);
foreach ($data AS $subject_id => $subject) {
/**
* SUBJECT-LEVEL vars
*/
$var = array();
/**
* MAIN EVENT LOOP
*/
foreach ($subject AS $event_id => $event) {
foreach ($event AS $key => $value) {
/**
* do stuff
*/
示例5: d
/**
* do stuff
*/
if ($debug) {
if (!is_form_locked($record, $instrument, $redcap_event_name)) {
d(is_t_complete($record, $event_id), $redcap_event_name);
}
global $Proj, $project_id;
$today = date("Y-m-d");
$fields = array();
$arms = get_arms(array_keys($Proj->eventsForms));
d($arms);
$baseline_event_id = $Proj->firstEventId;
$tx_duration = get_single_field($record, $project_id, $baseline_event_id, 'trt_exdur', null);
$tx_duration = substr($tx_duration, strpos($tx_duration, 'P') + 1, strlen($tx_duration) - 2);
$tx_first_event = array_search_recursive($tx_duration . ' Weeks', $arms) !== false ? array_search_recursive($tx_duration . ' Weeks', $arms) : null;
$survey_event_ids = $Proj->getEventsByArmNum($arms[$tx_first_event]['arm_num']);
d($survey_event_ids);
foreach ($survey_event_ids as $survey_event_id) {
$survey_event_name = $Proj->getUniqueEventNames($survey_event_id);
$survey_prefix = substr($survey_event_name, 0, strpos($survey_event_name, '_'));
$fields[] = $survey_prefix . '_completed';
$fields[] = $survey_prefix . '_date';
$fields[] = $survey_prefix . '_startdate';
$fields[] = $survey_prefix . '_deadline';
$fields[] = $survey_prefix . '_missed';
}
d($fields);
$data = REDCap::getData('array', $record, $fields, $baseline_event_id);
d($data);
}
示例6: set_survey_completion
/**
* @param $record
* @param $debug
* determine completeness of all survey-containing events
*/
function set_survey_completion($record, $debug)
{
if (isset($record)) {
global $Proj, $project_id;
$today = date("Y-m-d");
$fields = array();
$arms = get_arms(array_keys($Proj->eventsForms));
$baseline_event_id = $Proj->firstEventId;
$trt = Treatment::getTrtInfo($record);
/**
* use the selected duration ($trt['arm']) to set timings
*/
$tx_first_event = array_search_recursive($trt['arm'], $arms) !== false ? array_search_recursive($trt['arm'], $arms) : null;
$survey_event_ids = isset($tx_first_event) ? $Proj->getEventsByArmNum($arms[$tx_first_event]['arm_num']) : null;
foreach ($survey_event_ids AS $survey_event_id) {
$data_event_name = $Proj->getUniqueEventNames($survey_event_id);
$prefix = substr($data_event_name, 0, strpos($data_event_name, '_'));
/**
* derive inter-event timing variables
*/
$start_date_value = get_single_field($record, $project_id, $baseline_event_id, $prefix . '_startdate', null);
$deadline_value = get_single_field($record, $project_id, $baseline_event_id, $prefix . '_deadline', null);
/**
* for baseline surveys, reference date is randomization date. For all other survey events,
* reference date is dm_rfxstdtc, recorded treatment start date NOT dm_rfstdtc, the
* treatment start derived from the treatment med data
*/
$t_base_date = in_array($prefix, array('baseline', 'eot1year', 'eot3year')) ? $trt['rand_date'] : $trt['rfxstdtc'];
if (isset($t_base_date) && $t_base_date != '') {
$t_start_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] - $arms[$data_event_name]['offset_min']));
update_field_compare($record, $project_id, $baseline_event_id, $t_start_date, $start_date_value, $prefix . '_startdate', $debug);
$t_deadline_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] + $arms[$data_event_name]['offset_max']) - 1);
update_field_compare($record, $project_id, $baseline_event_id, $t_deadline_date, $deadline_value, $prefix . '_deadline', $debug);
}
}
foreach ($survey_event_ids AS $survey_event_id) {
$survey_event_name = $Proj->getUniqueEventNames($survey_event_id);
$survey_prefix = substr($survey_event_name, 0, strpos($survey_event_name, '_'));
$fields[] = $survey_prefix . '_completed';
$fields[] = $survey_prefix . '_date';
$fields[] = $survey_prefix . '_startdate';
$fields[] = $survey_prefix . '_deadline';
}
$data = REDCap::getData('array', $record, $fields, $baseline_event_id);
/**
* switch to the scheduled arm to determine completion
* this is done to avoid subjects switching arms and orphaning surveys completed
* prior to duration change. This should (almost) never happen, but we still need to handle if it does
*/
$tx_first_event = array_search_recursive($trt['timing_arm'], $arms) !== false ? array_search_recursive($trt['timing_arm'], $arms) : null;
$survey_event_ids = isset($tx_first_event) ? $Proj->getEventsByArmNum($arms[$tx_first_event]['arm_num']) : null;
foreach ($survey_event_ids AS $survey_event_id) {
$data_event_name = $Proj->getUniqueEventNames($survey_event_id);
$prefix = substr($data_event_name, 0, strpos($data_event_name, '_'));
$is_t_complete = is_t_complete($record, $survey_event_id);
$t_complete = $is_t_complete ? '1' : '0';
$complete_value = get_single_field($record, $project_id, $baseline_event_id, $prefix . '_completed', null);
$deadline_value = get_single_field($record, $project_id, $baseline_event_id, $prefix . '_deadline', null);
$t_missed = $complete_value == '0' && $today > $deadline_value && isset($deadline_value) && $deadline_value != '' ? '1' : '0';
foreach ($data[$record] AS $data_event_id => $data_event) {
foreach ($data_event AS $key => $value) {
/**
* derive completion variables
*/
switch ($key) {
case $prefix . '_completed':
update_field_compare($record, $project_id, $data_event_id, $t_complete, $value, $key, $debug);
break;
case $prefix . '_date':
if ($value == '' && $is_t_complete) {
update_field_compare($record, $project_id, $data_event_id, $today, $value, $key, $debug);
}
break;
case $prefix . '_missed':
update_field_compare($record, $project_id, $data_event_id, $t_missed, $value, $key, $debug);
break;
default:
break;
}
}
}
}
}
}
示例7: events_completion
/**
* @param $subject_id
* @param $debug
* determine completeness of all survey-containing events
*/
function events_completion($subject_id, $debug) {
if (isset($subject_id)) {
global $Proj, $project_id;
$today = date("Y-m-d");
$fields = array();
$arms = get_arms(array_keys($Proj->eventsForms));
$baseline_event_id = $Proj->firstEventId;
$enrollment_event_id = getNextEventId($baseline_event_id);
$tx_duration = get_single_field($subject_id, $project_id, $enrollment_event_id, 'dm_suppdm_actarmdur', null);
$tx_first_event = array_search_recursive($tx_duration . ' Weeks', $arms) !== false ? array_search_recursive($tx_duration . ' Weeks', $arms) : null;
$survey_event_ids = isset($tx_first_event) ? array_merge(array($baseline_event_id), $Proj->getEventsByArmNum($arms[$tx_first_event]['arm_num'])) : array($baseline_event_id);
foreach ($survey_event_ids AS $survey_event_id) {
$survey_event_name = $Proj->getUniqueEventNames($survey_event_id);
$survey_prefix = substr($survey_event_name, 0, strpos($survey_event_name, '_'));
$fields[] = $survey_prefix . '_completed';
$fields[] = $survey_prefix . '_date';
$fields[] = $survey_prefix . '_startdate';
$fields[] = $survey_prefix . '_deadline';
}
$data = REDCap::getData('array', $subject_id, $fields, $baseline_event_id);
foreach ($survey_event_ids AS $survey_event_id) {
$data_event_name = $Proj->getUniqueEventNames($survey_event_id);
$prefix = substr($data_event_name, 0, strpos($data_event_name, '_'));
$is_t_complete = is_t_complete($subject_id, $survey_event_id);
$t_complete = $is_t_complete ? '1' : '0';
foreach ($data[$subject_id] AS $data_event_id => $data_event) {
foreach ($data_event AS $key => $value) {
/**
* derive intra-event timing variables
*/
switch ($key) {
case $prefix . '_completed':
update_field_compare($subject_id, $project_id, $data_event_id, $t_complete, $value, $key, $debug);
break;
case $prefix . '_date':
if ($value == '' && $is_t_complete) {
update_field_compare($subject_id, $project_id, $data_event_id, $today, $value, $key, $debug);
}
break;
default:
break;
}
}
}
/**
* derive inter-event timing variables
*/
$complete_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_completed', null);
$start_date_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_startdate', null);
$deadline_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_deadline', null);
$missed_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_missed', null);
$t_missed = $complete_value == '0' && $today > $deadline_value && isset($deadline_value) && $deadline_value != '' ? '1' : '0';
switch ($prefix) {
case 't1':
$t_base_date = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_date', null);
$t_start_date = $t_base_date;
$t_deadline_date = add_date($t_base_date, 89);
break;
default:
$t_base_date = get_single_field($subject_id, $project_id, $enrollment_event_id, 'dm_rfstdtc', null);
$t_start_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] - $arms[$data_event_name]['offset_min']));
$t_deadline_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] + $arms[$data_event_name]['offset_max']) - 1);
break;
}
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_complete, $complete_value, $prefix . '_completed', $debug);
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_missed, $missed_value, $prefix . '_missed', $debug);
if (isset($t_base_date) && $t_base_date != '') {
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_start_date, $start_date_value, $prefix . '_startdate', $debug);
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_deadline_date, $deadline_value, $prefix . '_deadline', $debug);
}
}
}
}
示例8: array
/**
* AND today is TX stop date + 14 weeks ago, and no final outcome, data is due
*/
if (date("Y-m-d") >= (add_date($stop_date, 98, 0, 0)) && !in_array($outcome, array('SVR', 'VIRAL BREAKTHROUGH', 'RELAPSE', 'NON-RESPONDER'))) {
$hcv_data_due = true;
}
}
/**
* if not followup eligible (and no TX stop - implied by ineligible)...
*/
if ((!$hcv_fu_eligible || !$post_tx_followup_eligible) && $started_tx && !$stopped_tx) {
/**
* is regimen SOF + RBV?
*/
$due_fields = array('sof_cmstdtc', 'rib_cmstdtc');
$due_data = REDCap::getData('array', $subject_id, $due_fields);
$sof_rbv_regimen = false;
$sof = array();
$rbv = array();
foreach ($due_data[$subject_id] AS $event_id => $event) {
if ($event['sof_cmstdtc'] != '') {
$sof[] = true;
}
if ($event['rib_cmstdtc'] != '') {
$rbv[] = true;
}
}
$sof_rbv_regimen = eval("return ((" . implode(' || ', $sof) . ") && (" . implode(' || ', $rbv) . "));");
/**
* get genotype
*/
示例9: intval
$batch_remaining = intval($batch_total - count($batch_times));
$time_remaining = round($batch_remaining * $batch_avg);
$time_remaining_msg = "Approximately " . $time_remaining . " seconds remaining...";
}
$percent = intval(($b+1)/$batch_total * 100).'%';
$msg = "Processing batch " . ($b + 1) . " of $batch_total.";
echo "
<script language='javascript'>
//console.log($('#progress').html());
$('#progress').html('<div style=\"width:$percent;background-color:#ddd;\"> </div>');
$('#progress_info').html('$msg<br>$percent complete<br>$time_remaining_msg');
</script>";
echo str_repeat(' ',1024*64);
flush();
ob_flush();
$records = REDCap::getData('csv', $batch, NULL, NULL, NULL, false, true); // need DAGs
// Trim the header on all but the first row of the first batch
//if ($b != 0) $records = trimHeader($records);
$records = trimHeader($records); // no headers
fwrite($fh, $records);
$batch_times[$b] = microtime(true) - $batch_start;
}
fclose($fh);
// Data CSV file download icon
$html = RCView::form(
array('method'=>'post', 'name'=>'full_export', 'action'=>$_SERVER['REQUEST_URI'], 'enctype'=>'multipart/form-data'),
RCView::input(array('type'=>'hidden', 'name'=>'download', 'value'=>$target_filename)) .
RCView::button(array(
'name'=>'submit-btn-download',
示例10:
*/
d($lab_subject);
d($this_data);
d($rfstdtc);
if ($this_data['chem_im_lbdtc'] != '' && $this_data['chem_im_lbdtc'] <= $rfstdtc) {
$baseline_date = $this_data['chem_im_lbdtc'];
$baseline_flag = 'Y';
/**
* Baseline date belongs in Baseline event
*/
update_field_compare($subject_id, $project_id, $initial_event, $baseline_date, $event['meld_im_supplb_lbdtbl'], "meld_im_supplb_lbdtbl", $debug);
d($baseline_date);
/**
* Now reset all other flags that have changed
*/
$flag_reset_data = REDCap::getData('array', $subject_id, "meld_im_lbblfl");
foreach ($flag_reset_data AS $reset) {
d($reset);
foreach ($reset AS $reset_event_id => $reset_event) {
foreach ($reset_event as $reset_field => $reset_val) {
if ($reset_event_id != $this_data['event_id']) {
update_field_compare($subject_id, $project_id, $reset_event_id, '', $reset_val, "meld_im_lbblfl", $debug);
}
}
}
}
}
/**
* Baseline flag belongs in the event where the date occurs
*/
update_field_compare($subject_id, $project_id, $this_data['event_id'], $baseline_flag, $this_data['meld_im_lbblfl'], "meld_im_lbblfl", $debug);
示例11: getNewReportIdAndOrder
public static function getNewReportIdAndOrder($project_id)
{
// When adding new report - get eventid, next report id and next project report_order
$allRpts = REDCap::getData(LR_REPORT_DATA_PROJECT_ID, 'array', null, array('project_id', 'report_order'));
// fields
$report_id = 0;
$report_order = 0;
$eventId = 0;
foreach ($allRpts as $rId => $reportEventRecord) {
$report_id++;
foreach ($reportEventRecord as $eventId => $rptSpec) {
$pId = $rptSpec['project_id'];
$order = $rptSpec['report_order'];
if ($pId == $project_id) {
$report_order = $order > $report_order ? $order : $report_order;
}
}
}
$report_id++;
$report_order++;
return array($eventId, $report_id, $report_order);
}
示例12: array
/**
* pretty form names
*/
$pretty_form_names = array();
$pretty_form_name_result = db_query("SELECT form_menu_description FROM redcap_metadata WHERE project_id = '$project_id' AND form_name = '{$locked_forms_array['form_name']}' AND form_menu_description IS NOT NULL");
if ($pretty_form_name_result) {
$form_name_row = db_fetch_assoc($pretty_form_name_result);
}
/**
* subjects with locked forms
*/
$subject_lock_result = db_query("SELECT record, event_id FROM `redcap_locking_data` WHERE project_id = '$project_id' AND form_name = '{$locked_forms_array['form_name']}'");
if ($subject_lock_result) {
while ($subject_lock_row = db_fetch_assoc($subject_lock_result)) {
$fields = REDCap::getFieldNames($locked_forms_array['form_name']);
$data = REDCap::getData('array', $subject_lock_row['record'], $fields, $subject_lock_row['event_id']);
foreach ($data AS $subject) {
foreach ($subject AS $event) {
foreach ($event AS $field => $value) {
$available_field_count++;
if ($value != '') {
$field_count++;
}
}
}
}
}
}
/**
* data in all fields, monitored or not
*/
示例13: foreach
foreach ($data as $subject_id => $subject) {
foreach ($subject as $event_id => $event) {
code_pt($project_id, $subject_id, $event_id, $event[$prefix . "_aemodify"], $event[$prefix . "_aedecod"], $prefix . "_aedecod", $debug, $recode_pt);
if ($debug) {
error_log("DEBUG: Coded " . strtoupper($prefix) . "_AEDECOD {$event[$prefix . '_aedecod']}: subject={$subject_id}, event={$event_id} for AEMODIFY {$event[$prefix . '_aemodify']}");
}
}
}
}
/**
* PREFIX_AEBODSYS
* uses $tx_prefixes preset array
*/
foreach ($tx_prefixes as $prefix) {
$fields = array($prefix . "_aedecod", $prefix . "_aebodsys");
$data = REDCap::getData('array', $record, $fields, $redcap_event_name);
foreach ($data as $subject_id => $subject) {
foreach ($subject as $event_id => $event) {
code_bodsys($project_id, $subject_id, $event_id, $event[$prefix . "_aedecod"], $event[$prefix . "_aebodsys"], $prefix . "_aebodsys", $debug, $recode_soc);
if ($debug) {
error_log("DEBUG: Coded SOC: subject={$subject_id}, event={$event_id} for AE {$event[$prefix . "_aedecod"]}");
}
}
}
}
if ($debug) {
$timer['main_end'] = microtime(true);
error_log(benchmark_timing($timer));
}
break;
case 'cbc':
示例14: get_field_label
$item = $event['cm_oth_cmindc'];
}
$desc_array[] = get_field_label($field, $project_id) . ': <strong>' . $item . "</strong>";
}
}
$event_start = $event['cm_cmstdtc'] != '' ? $event['cm_cmstdtc'] : $rfstdtc;
if ($event['cm_cmtrt'] != '') {
$eventAtts[] = get_event_array($event_start, '', '', implode("<br />", $desc_array), $event['cm_cmtrt'], '', '', $url);
}
}
}
/**
* transfusions
*/
$fields = array('xfsn_cmstdtc', 'xfsn_cmtrt', 'xfsn_cmdose', 'xfsn_cmindc');
$transfusion_data = REDCap::getData('array', $subjid, $fields);
foreach ($transfusion_data AS $subject) {
foreach ($subject AS $event_id => $event) {
$desc_array = array();
$url = APP_PATH_WEBROOT_FULL . "redcap_v" . $redcap_version . "/DataEntry/index.php?pid=$project_id&page=transfusions&id=$subjid&event_id=$event_id";
foreach ($event AS $field => $item) {
if ($item != '' && !in_array($field, array('xfsn_cmstdtc', 'xfsn_cmtrt'))) {
$desc_array[] = get_field_label($field, $project_id) . ': <strong>' . $item . "</strong>";
}
}
$eventAtts[] = get_event_array($event['xfsn_cmstdtc'], '', '', implode("<br />", $desc_array), $event['xfsn_cmtrt'], 'red', '', $url);
}
}
/**
* generate and return JSON to timeline script.
*/
示例15: array
require_once $base_path . '/plugins/includes/functions.php';
require_once APP_PATH_DOCROOT . '/Config/init_project.php';
require_once APP_PATH_DOCROOT . '/ProjectGeneral/header.php';
/**
* restrict use of this plugin to the appropriate project
*/
$allowed_pid = '26';
REDCap::allowProjects($allowed_pid);
Kint::enabled($debug);
global $Proj;
$baseline_event_id = $Proj->firstEventId;
/**
* let's bring this into the 21st century
*/
$fields = array('dm_subjid', 'dm_usubjid');
$data = REDCap::getData('array', $subjects, $fields, $baseline_event_id);
foreach ($data AS $subject) {
foreach ($subject AS $event_id => $event) {
if ($event['dm_usubjid'] != '') {
/**
* find which DAG this subject belongs to
*/
$site_prefix = substr($event['dm_usubjid'], 0, 3) . '%';
$dag_query = "SELECT group_id, group_name FROM redcap_data_access_groups WHERE project_id = '$project_id' AND group_name LIKE '$site_prefix'";
$dag_result = db_query($dag_query);
if ($dag_result) {
$dag = db_fetch_assoc($dag_result);
if (isset($dag['group_id'])) {
/**
* For each event in project for this subject, determine if this subject_id has been added to its appropriate DAG. If it hasn't, make it so.
* First, we need a list of events for which this subject has data