Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated project generation from php files to support inclusion criteria and other features #167

Merged
merged 9 commits into from
Aug 25, 2024
518 changes: 518 additions & 0 deletions composer.lock

Large diffs are not rendered by default.

Binary file not shown.
Binary file added cside/export_r/r_rsae_demoTestProject.zip
Binary file not shown.
2 changes: 0 additions & 2 deletions relis_app/controllers/test/Unit_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ function __construct()
$this->apiQueryUnitTest = new ApiQueryUnitTest();
$this->opUnitTest = new OpUnitTest();
$this->inclusion_mode_conflictUnitTest = new inclusion_mode_conflictUnitTest();
//$this->screeningInclusionModeConflictsTest = new X
//$this->customScreeningPhaseConfigTest = new X
}

public function relis_unit_test($result = "html_report")
Expand Down
27 changes: 22 additions & 5 deletions relis_app/helpers/install_project_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ function update_screening_values($screening, $target_db = 'current')
$config['screening_status_to_validate'] = !empty($screening['status_to_validate']) ? $screening['status_to_validate'] : "Excluded";
$config['validation_default_percentage'] = !empty($screening['validation_percentage']) ? $screening['validation_percentage'] : "20";
$config['screening_validator_assignment_type'] = !empty($screening['validation_assigment_mode']) ? $screening['validation_assigment_mode'] : "Normal";
$config['screening_inclusion_mode'] = !empty($screening['inclusion_mode']) ? $screening['inclusion_mode'] : "None";
$config['use_kappa'] = isset($screening['use_kappa']) ? $screening['use_kappa'] : 1;
$config['screening_on'] = 1;
$result = $ci->db3->update('config', $config, "config_id=1");
//add new phases
Expand All @@ -350,24 +352,39 @@ function update_screening_values($screening, $target_db = 'current')
//get total number
$nbr_phase = count($screening['phases']);
$i = 1;
$all_phases = array();
foreach ($screening['phases'] as $key => $value) {
$conf_phase['phase_title'] = !empty($value['title']) ? $value['title'] : "Phase " . $i;
$conf_phase['description'] = !empty($value['description']) ? $value['description'] : "";
$conf_phase['displayed_fields'] = !empty($value['fields']) ? $value['fields'] : "Title";
$conf_phase['screen_phase_final'] = ($nbr_phase == $i) ? '1' : "0";
$conf_phase['screen_phase_order '] = $i * 10;
$conf_phase['added_by'] = active_user_id();
array_push($all_phases, $conf_phase);

$ci->db3->insert('screen_phase', $conf_phase);
//insert corresponding phase config
if ($ci->db3->affected_rows() > 0) {
$phase_config = array();
$phase_config['screen_phase_id'] = $ci->db3->insert_id();
$phase_config['config_type'] = isset($value['config']) ? 'Custom' : 'Default';
if ($phase_config['config_type'] == 'Custom') {
$phase_config['screening_reviewer_number'] = !empty($value['config']['review_per_paper']) ? $value['config']['review_per_paper'] : $config['screening_reviewer_number'];
$phase_config['screening_screening_conflict_resolution'] = !empty($value['config']['conflict_resolution']) ? $value['config']['conflict_resolution'] : $config['screening_screening_conflict_resolution'];
$phase_config['screening_conflict_type'] = !empty($value['config']['conflict_type']) ? $value['config']['conflict_type'] : $config['screening_conflict_type'];
$phase_config['screening_status_to_validate'] = !empty($value['config']['status_to_validate']) ? $value['config']['status_to_validate'] : $config['screening_status_to_validate'];
$phase_config['validation_default_percentage'] = !empty($value['config']['validation_percentage']) ? $value['config']['validation_percentage'] : $config['validation_default_percentage'];
$phase_config['screening_validator_assignment_type'] = !empty($value['config']['validation_assigment_mode']) ? $value['config']['validation_assigment_mode'] : $config['screening_validator_assignment_type'];
$phase_config['screening_inclusion_mode'] = !empty($value['config']['inclusion_mode']) ? $value['config']['inclusion_mode'] : $config['screening_inclusion_mode'];
$phase_config['use_kappa'] = isset($screening['use_kappa']) ? $value['config']['use_kappa'] : $config['use_kappa'];
}
$ci->db3->insert('screen_phase_config', $phase_config);
}
$i++;
}
//print_test($all_phases);
$result = $ci->db3->insert_batch('screen_phase', $all_phases);
//print_test($result);
}
// Add exclusion criteria , sourcepapers,and searc_strategy
$screen_configs_to_save = array(
'exclusion_criteria' => array('table' => 'ref_exclusioncrieria'),
'inclusion_criteria' => array('table' => 'ref_inclusioncriteria'),
'source_papers' => array('table' => 'ref_papers_sources'),
'search_startegy' => array('table' => 'ref_search_strategy'),
);
Expand Down
10 changes: 5 additions & 5 deletions relis_app/helpers/tests/inclusion_mode_conflict_ut_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function run_tests() {
$this->defaultCriteria_one();
$this->keepOneFromAny();
$this->keepOneFromAll();
$this->resetScreening();
$this->resetScreening();
}

private function TestInitialize() {
Expand Down Expand Up @@ -75,14 +75,14 @@ private function affected_phases() {
$action = "get_affected_phases (Model method)";
$test_name = "Testing is changes are made to the right affected phases";
$test_aspect = "Affected phases";
$expected_value = json_encode(array(1));
$expected_value = json_encode(array(3));
$actual_value = "";

addScreeningPhase("Link");
$this->ci->db->query("UPDATE relis_dev_correct_" . getProjectShortName() . ".screen_phase_config SET config_type = 'Custom' WHERE screen_phase_config_id = 2");
$this->ci->db->query("UPDATE relis_dev_correct_" . getProjectShortName() . ".screen_phase_config SET config_type = 'Custom' WHERE screen_phase_config_id = 3");

$model = new Screening_dataAccess();
$actual_value = json_encode($model->get_affected_phases(getScreeningPhaseId("Abstract")));
$actual_value = json_encode($model->get_affected_phases(getScreeningPhaseId("Link")));

run_test($this->controller, $action, $test_name, $test_aspect, $actual_value, $actual_value);
}
Expand Down Expand Up @@ -209,7 +209,7 @@ private function keepOneFromAny() {
run_test($this->controller, $action, $test_name, $test_aspect, $expected_value, $actual_value);
}

private function keepOneFromAll() {
private function keepOneFromAll() {
$action = "solve_mode_conflict";
$test_name = "Testing if one random criteria is added properly when switching from All to One inclusion mode";
$test_aspect = "How many criteria were added?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,14 @@ function get_classification_demoTestProject()
$screening['validation_assigment_mode'] = 'Normal';
$screening['status_to_validate'] = 'Excluded';
$screening['validation_percentage'] = '10';
//$screening['inclusion_mode'] = 'One';
$screening['use_kappa'] = true;
$screening['exclusion_criteria'] = array();
array_push($screening['exclusion_criteria'], "EC1: Too short ");
array_push($screening['exclusion_criteria'], "EC2: Not abour chocolate");
/* $screening['inclusion_criteria'] = array();
array_push($screening['inclusion_criteria'], "IC1: Published at most 2 years ago");
array_push($screening['inclusion_criteria'], "IC2: Longer than 10 pages"); */
$screening['source_papers'] = array();
array_push($screening['source_papers'], "Google Scholar");
array_push($screening['source_papers'], "Chocolate DB");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,4 +762,4 @@ function get_classification_demoTestProject2()
//REPORTING

return $result;
}
}
Loading
Loading