/**
 * project metadata
 */
global $Proj;
$baseline_event_id = $Proj->firstEventId;
$plugin_title = "Derive values";
/**
 * plugin title
 */
echo "<h3>$plugin_title</h3>";

$timer['set tx data'] = microtime(true);
set_tx_data($subjects, $debug);
$timer['set bmi'] = microtime(true);
set_bmi($subjects, $debug);
$timer['set cbc'] = microtime(true);
set_cbc_flags($subjects, $debug);
$timer['set cirrhosis'] = microtime(true);
set_cirrhosis($subjects, $debug);
$timer['set crcl'] = microtime(true);
set_crcl($subjects, null, 'both', $debug);
$timer['set trt exp'] = microtime(true);
set_treatment_exp($subjects, $debug);
$timer['set egfr'] = microtime(true);
set_egfr($subjects, null, 'both', $debug);
/**
 * timing
 */
$timer['main_end'] = microtime(true);
$init_time = benchmark_timing($timer);
echo $init_time;
             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':
     $debug = false;
     set_cbc_flags($record, $debug);
     set_cirrhosis($record, $debug);
     standardize_lab_form($instrument, $project_id, $record, $redcap_event_name, $debug);
     if ($debug) {
         $timer['main_end'] = microtime(true);
         error_log(benchmark_timing($timer));
     }
     break;
     /*case 'inr':*/
 /*case 'inr':*/
 case 'hcv_rna_results':
     $debug = false;
     set_svr_dates($record, $debug);
     standardize_lab_form($instrument, $project_id, $record, $redcap_event_name, $debug);
     if ($debug) {
         $timer['main_end'] = microtime(true);