Update to version2.(Fix all known bugs.)
This commit is contained in:
parent
73c46c2b51
commit
b8e6e80d81
|
@ -6,18 +6,25 @@ Array.prototype.get_nearest_value = function(goal){
|
|||
}
|
||||
function change_object_variables(obj1,obj2,operator="-",target="new"){
|
||||
var obj_new = {};
|
||||
Object.keys(function(k){
|
||||
if(operator == "-"){
|
||||
var obj_keys = Object.keys(obj1);
|
||||
obj_keys.forEach(function(k){
|
||||
if(obj2[k] == undefined){
|
||||
if( target == "new"){
|
||||
obj_new[k] = obj1[k] - obj2[k];
|
||||
}else{
|
||||
obj1[k] = obj1[k] - obj2[k];
|
||||
obj_new[k] = obj1[k];
|
||||
}
|
||||
}else if(operator == "+"){
|
||||
if( target == "new"){
|
||||
obj_new[k] = obj1[k] + obj2[k];
|
||||
}else{
|
||||
obj1[k] = obj1[k] + obj2[k];
|
||||
}else{
|
||||
if(operator == "-"){
|
||||
if( target == "new"){
|
||||
obj_new[k] = obj1[k] - obj2[k];
|
||||
}else{
|
||||
obj1[k] = obj1[k] - obj2[k];
|
||||
}
|
||||
}else if(operator == "+"){
|
||||
if( target == "new"){
|
||||
obj_new[k] = obj1[k] + obj2[k];
|
||||
}else{
|
||||
obj1[k] = obj1[k] + obj2[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -315,13 +322,22 @@ $(document).ready(function(){
|
|||
$('#hormone_therapy .cancer_table_btn').removeAttr('disabled');
|
||||
$('[for="hormone_therapy"]').css('color','');
|
||||
};
|
||||
if(post_json["HER2_status"] != 1){
|
||||
$('#Targeted_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||
$('[for="Targeted_therapy"]').css('color','rgb(204, 204, 204)');
|
||||
}else{
|
||||
$('#Targeted_therapy .cancer_table_btn').removeAttr('disabled');
|
||||
$('[for="Targeted_therapy"]').css('color','');
|
||||
};
|
||||
/*disable_condition start*/
|
||||
if(post_json["ER_status"] == 2 && post_json["PR_status"] == 2){
|
||||
$('#hormone_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||
$('[for="hormone_therapy"]').css('color','rgb(204, 204, 204)');
|
||||
}else{
|
||||
$('#hormone_therapy .cancer_table_btn').removeAttr('disabled');
|
||||
$('[for="hormone_therapy"]').css('color','');
|
||||
}
|
||||
if(post_json["HER2_status"] != 1){
|
||||
$('#Targeted_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||
$('[for="Targeted_therapy"]').css('color','rgb(204, 204, 204)');
|
||||
}else{
|
||||
$('#Targeted_therapy .cancer_table_btn').removeAttr('disabled');
|
||||
$('[for="Targeted_therapy"]').css('color','');
|
||||
}
|
||||
/*disable_condition end*/
|
||||
return post_json;
|
||||
}else{
|
||||
return null;
|
||||
|
@ -374,23 +390,28 @@ $(document).ready(function(){
|
|||
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active');
|
||||
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1");
|
||||
};
|
||||
var treatmeny_method = result.responseJSON.treatmeny_method;
|
||||
$('tr.'+treatmeny_method[0]).addClass('tr_show')
|
||||
var lpv = [0,-0.8397,-0.4147,-0.3203,-0.4687];
|
||||
var treatment_method = result.responseJSON.treatment_method;
|
||||
var treatment_method_active_indices = result.responseJSON.treatment_method_active_indices;
|
||||
$('tr.'+treatment_method[0]).addClass('tr_show');
|
||||
var servive_ratio_arr = [result.responseJSON.servive_ratio]
|
||||
var yes = (I18n.locale=="zh_tw") ? "是" : "yes";
|
||||
var year = $('#current_year').attr('value');
|
||||
var active_treatment = ['Surgery_only'];
|
||||
$('tr.'+active_treatment[0]+' .Overall_Survival').html(servive_ratio_arr[0]+'%');
|
||||
$('span.'+active_treatment[0]+'.Overall_Survival').html(Math.round(servive_ratio_arr[0]));
|
||||
$('#cancer_predict_result_block').css('display','block');
|
||||
var lpv_real = [result.responseJSON['lpv_variable']];
|
||||
var lpv_dict={}
|
||||
var lpv_calc=/*lpv_calc_formula_start*/{"1":"0.8095037**( Math.exp(lpv_current) )","1.5":"0.729158**( Math.exp(lpv_current) )","2":"0.6717211**( Math.exp(lpv_current) )","2.5":"0.6056773**( Math.exp(lpv_current) )"}/*lpv_calc_formula_end*/
|
||||
var lpv = /*therapy_lpv start*/[0, -0.8397, -0.4147, -0.3203, -0.4687];/*therapy_lpv end*/;
|
||||
var lpv_dict={};
|
||||
var lpv_calc=/*lpv_calc_formula_start*/{"1":"Math.exp(-0.001476145)**( Math.exp(lpv_current) )","3":"Math.exp(-0.01261639)**( Math.exp(lpv_current) )","5":"Math.exp(-0.02519608)**( Math.exp(lpv_current) )"};/*lpv_calc_formula_end*/
|
||||
active_treatment.push = function() {
|
||||
if(arguments.length == 1){
|
||||
var year = $('#current_year').attr('value');
|
||||
var lpv_current = change_object_variables(lpv_real[lpv_real.length-1],lpv_dict[arguments[0]],'+');
|
||||
console.log(lpv_real);
|
||||
console.log(lpv_dict[arguments[0]])
|
||||
var lpv_current = change_object_variables(lpv_real[lpv_real.length-1],{"lpv": lpv_dict[arguments[0]]},'+');
|
||||
lpv_real.push(lpv_current);
|
||||
lpv_current = lpv_current['lpv'];
|
||||
var servive_ratio = round((1 - eval(lpv_calc[year]))*100,2);
|
||||
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
||||
servive_ratio_arr.push(servive_ratio);
|
||||
|
@ -433,9 +454,10 @@ $(document).ready(function(){
|
|||
var year = $('#current_year').attr('value');
|
||||
if(index < this.length - 1){
|
||||
for(var i = index + 1;i < this.length; i++){
|
||||
change_object_variables(lpv_real[i] , lpv_dict[arguments[0]] , '-' , 'self');
|
||||
change_object_variables(lpv_real[i] , {"lpv": lpv_dict[arguments[0]]} , '-' , 'self');
|
||||
var lpv_current = lpv_real[i];
|
||||
var servive_ratio = round(eval(lpv_calc[year])*100,2);
|
||||
lpv_current = lpv_current['lpv'];
|
||||
var servive_ratio = round((1 - eval(lpv_calc[year]))*100,2);
|
||||
servive_ratio_arr[i] = servive_ratio;
|
||||
var benefit = servive_ratio - ((i == index+1) ? servive_ratio_arr[index - 1] : servive_ratio_arr[i - 1]);
|
||||
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
|
@ -471,39 +493,15 @@ $(document).ready(function(){
|
|||
$('.addition').css('display','none');
|
||||
$('#result_text_content .extra-text').css('display','none');
|
||||
};
|
||||
console.log(this)
|
||||
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
||||
}else{
|
||||
console.log(this)
|
||||
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
for(var i = 0;i<treatmeny_method.length;i++){
|
||||
lpv_dict[treatmeny_method[i]] = lpv[i];
|
||||
for(var i = 0;i<treatment_method.length;i++){
|
||||
lpv_dict[treatment_method[i]] = lpv[i];
|
||||
var click_flag=false;
|
||||
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(1).off('click');
|
||||
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(1).click(function(){
|
||||
var index = $(this).index()/2;
|
||||
try{
|
||||
$(this).parent().find('>input').attr('value',0);
|
||||
$(this).parent().find('>input').eq(index).attr('value',1);
|
||||
$(this).parent().find('>button').removeClass('active');
|
||||
$(this).parent().removeClass('cancertable_empty');
|
||||
if($('.cancertable_empty').length == 0){
|
||||
$('#danger_texts').remove();
|
||||
};
|
||||
}catch(e){};
|
||||
$(this).addClass('active');
|
||||
if(!click_flag){
|
||||
if(!active_treatment.includes($(this).parent().attr('id'))){
|
||||
click_flag = true;
|
||||
active_treatment.push($(this).parent().attr('id'));
|
||||
click_flag = false;
|
||||
};
|
||||
}
|
||||
});
|
||||
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(0).off('click');
|
||||
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(0).click(function(){
|
||||
$('#'+treatment_method[i]+' .cancer_table_btn').off('click').click(function(){
|
||||
var index = $(this).index()/2;
|
||||
try{
|
||||
$(this).parent().find('>input').attr('value',0);
|
||||
|
@ -523,6 +521,26 @@ $(document).ready(function(){
|
|||
};
|
||||
};
|
||||
});
|
||||
$('#'+treatment_method[i]+' .cancer_table_btn').eq(treatment_method_active_indices[i]).off('click').click(function(){
|
||||
var index = $(this).index()/2;
|
||||
try{
|
||||
$(this).parent().find('>input').attr('value',0);
|
||||
$(this).parent().find('>input').eq(index).attr('value',1);
|
||||
$(this).parent().find('>button').removeClass('active');
|
||||
$(this).parent().removeClass('cancertable_empty');
|
||||
if($('.cancertable_empty').length == 0){
|
||||
$('#danger_texts').remove();
|
||||
};
|
||||
}catch(e){};
|
||||
$(this).addClass('active');
|
||||
if(!click_flag){
|
||||
if(!active_treatment.includes($(this).parent().attr('id'))){
|
||||
click_flag = true;
|
||||
active_treatment.push($(this).parent().attr('id'));
|
||||
click_flag = false;
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
$('#current_year').change(function(){
|
||||
year = $(this).attr('value');
|
||||
|
@ -592,134 +610,82 @@ $(document).ready(function(){
|
|||
};
|
||||
};
|
||||
/* auto add start */
|
||||
function calculate_first_lpv(result_json){
|
||||
function calculate_first_lpv(result_json){
|
||||
result = {};
|
||||
var map_values , mapping_hash , temp_index ,temp_value , index , closest_value;
|
||||
result['sex_value'] = (2 - Number(result_json['sex_value']));
|
||||
result['age'] = Number(result_json['age']);
|
||||
mapping_hash = mapping_data_from_csv['age'];
|
||||
temp_index = 0;
|
||||
temp_value = result[age];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
}else{
|
||||
closest_value = v.get_nearest_value(temp_value);
|
||||
temp_index = v.indexOf(closest_value)
|
||||
}
|
||||
}
|
||||
result[k] = v[temp_index];
|
||||
index++;
|
||||
});
|
||||
result['calH'] = Number(result_json['calH']);
|
||||
mapping_hash = mapping_data_from_csv['calH'];
|
||||
temp_index = 0;
|
||||
temp_value = result[calH];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
}else{
|
||||
closest_value = v.get_nearest_value(temp_value);
|
||||
temp_index = v.indexOf(closest_value)
|
||||
}
|
||||
}
|
||||
result[k] = v[temp_index];
|
||||
index++;
|
||||
});
|
||||
result['calAH'] = Number(result_json['calAH']);
|
||||
mapping_hash = mapping_data_from_csv['calAH'];
|
||||
temp_index = 0;
|
||||
temp_value = result[calAH];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
}else{
|
||||
closest_value = v.get_nearest_value(temp_value);
|
||||
temp_index = v.indexOf(closest_value)
|
||||
}
|
||||
}
|
||||
result[k] = v[temp_index];
|
||||
index++;
|
||||
});
|
||||
result['calDH'] = Number(result_json['calDH']);
|
||||
mapping_hash = mapping_data_from_csv['calDH'];
|
||||
temp_index = 0;
|
||||
temp_value = result[calDH];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
}else{
|
||||
closest_value = v.get_nearest_value(temp_value);
|
||||
temp_index = v.indexOf(closest_value)
|
||||
}
|
||||
}
|
||||
result[k] = v[temp_index];
|
||||
index++;
|
||||
});
|
||||
result['fat'] = Number(result_json['fat']);
|
||||
mapping_hash = mapping_data_from_csv['fat'];
|
||||
temp_index = 0;
|
||||
temp_value = result[fat];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
}else{
|
||||
closest_value = v.get_nearest_value(temp_value);
|
||||
temp_index = v.indexOf(closest_value)
|
||||
}
|
||||
}
|
||||
result[k] = v[temp_index];
|
||||
index++;
|
||||
});
|
||||
result['N4'] = (2 - Number(result_json['N4']));
|
||||
result['N12'] = (2 - Number(result_json['N12']));
|
||||
result['N20'] = (2 - Number(result_json['N20']));
|
||||
result['N31'] = (2 - Number(result_json['N31']));
|
||||
result['O6'] = (2 - Number(result_json['O6']));
|
||||
result['N34'] = (2 - Number(result_json['N34']));
|
||||
result['N14'] = (2 - Number(result_json['N14']));
|
||||
result['N26'] = (2 - Number(result_json['N26']));
|
||||
result['O3'] = (2 - Number(result_json['O3']));
|
||||
result['O20'] = (2 - Number(result_json['O20']));
|
||||
result['O18'] = (2 - Number(result_json['O18']));
|
||||
result['O11'] = (2 - Number(result_json['O11']));
|
||||
result['N29'] = (2 - Number(result_json['N29']));
|
||||
result['N6'] = (2 - Number(result_json['N6']));
|
||||
result['O14'] = (2 - Number(result_json['O14']));
|
||||
result['N43'] = (2 - Number(result_json['N43']));
|
||||
result['O17'] = (2 - Number(result_json['O17']));
|
||||
result['O9'] = (2 - Number(result_json['O9']));
|
||||
result['age'] = Number(result_json['age']);
|
||||
result['size'] = Number(result_json['size']);
|
||||
result['lymph_nodes_examined'] = Number(result_json['lymph_nodes_examined']);
|
||||
result['lymph_nodes_positive'] = Number(result_json['lymph_nodes_positive']);
|
||||
result['grade'] = Number(result_json['grade']);
|
||||
result['ER_status'] = Number(result_json['ER_status']);
|
||||
result['PR_status'] = Number(result_json['PR_status']);
|
||||
result['HER2_status'] = Number(result_json['HER2_status']);
|
||||
result['Distant_Metastasis'] = Number(result_json['Distant_Metastasis']);
|
||||
result['micrometastasis'] = Number(result_json['micrometastasis']);
|
||||
result['tumor_direct_extension'] = Number(result_json['tumor_direct_extension']);
|
||||
result['lvi'] = Number(result_json['lvi']);
|
||||
result['hormone_therapy'] = Number(result_json['hormone_therapy']);
|
||||
result['Chemotherapy'] = Number(result_json['Chemotherapy']);
|
||||
result['Radiotherapy'] = Number(result_json['Radiotherapy']);
|
||||
result['Targeted_therapy'] = Number(result_json['Targeted_therapy']);
|
||||
|
||||
Object.keys(result).forEach(function(k){
|
||||
if(Number.isNaN(result[k])){
|
||||
result[k] = 0;
|
||||
}
|
||||
})
|
||||
age1 = (result["age"] / 100.0) ** (0.5);
|
||||
age2 = age1 * Math.log(result["age"] / 100.0);
|
||||
size1 = Math.log(result["size"] / 10.0);
|
||||
ratio = (result["lymph_nodes_examined"] == 0 ? 0 : (1.0 * result["lymph_nodes_positive"] / result["lymph_nodes_examined"]));
|
||||
ratio = (ratio > 1 ? 1 : ratio);
|
||||
T4 = (result["tumor_direct_extension"] == 1);
|
||||
T1 = !T4 && (result["size"] <= 20);
|
||||
T2 = !T4 && !T1 && (result["size"] > 20 && result["size"] <= 50);
|
||||
T = (T4 ? 'T4' : (T1 ? 'T1' : (T2 ? 'T2' : 'T3')));
|
||||
N0 = (result["lymph_nodes_positive"] == 0);
|
||||
N1_or_N1mi = !N0 && (result["lymph_nodes_positive"] >= 1 && result["lymph_nodes_positive"] <= 3);
|
||||
N1 = N1_or_N1mi && result["micrometastasis"] != 1;
|
||||
N1mi = N1_or_N1mi && result["micrometastasis"] == 1;
|
||||
N2 = !N0 && !N1_or_N1mi && (result["lymph_nodes_positive"] <= 9);
|
||||
N = (N0 ? 'N0' : (N1 ? 'N1' : (N1mi ? 'N1mi' : (N2 ? 'N2' : 'N3'))));
|
||||
M = (result["Distant_Metastasis"] != 1) ? 'M0' : 'M1';
|
||||
pstage = (M == 'M1' ? 4 : ((T == 'T1' && (N == 'N0' || N == 'N1mi')) ? 1 : (((T == 'T2' || T == 'T3') && (N == 'N0')) || ((T == 'T1' || T == 'T2') && (N == 'N1')) ? 2 : 3)) );
|
||||
nposit = ((ratio + 0.1) / 0.1) ** 0.5;
|
||||
grade_2 = (result["grade"] == 2 || result["grade"] == 4) ? 1 : 0;
|
||||
grade_3 = (result["grade"] == 3) ? 1 : 0;
|
||||
subtype_1 = (result["ER_status"] != 2 || result["PR_status"] != 2) && (result["HER2_status"] != 1);
|
||||
subtype_2 = !subtype_1 && (result["HER2_status"] == 1);
|
||||
subtype_3 = !subtype_1 && !subtype_2 && (result["ER_status"] == 2 && result["PR_status"] == 2 && result["HER2_status"] != 1);
|
||||
subtype_HER2 = subtype_2 ? 1 : 0;
|
||||
subtype_triple = subtype_3 ? 1 : 0;
|
||||
pstage_2 = (pstage == 2) ? 1 : 0;
|
||||
pstage_3 = (pstage == 3) ? 1 : 0;
|
||||
pstage_4 = (pstage == 4) ? 1 : 0;
|
||||
lvi_yes = (result["lvi"] == 1) ? 1 : 0;
|
||||
chemo = (result["Chemotherapy"] == 2) ? 1 : 0;
|
||||
radio = (result["Radiotherapy"] == 2) ? 1 : 0;
|
||||
hormone = (result["hormone_therapy"] == 2) ? 1 : 0;
|
||||
target = (result["Targeted_therapy"] == 2) ? 1 : 0;
|
||||
try{
|
||||
result['lpv'] = (A = 0.1327868* (result["sex_value"]- 0.4858824) + 0.0371720* (result["age_test1"] - 61.56000) -0.07447278* (result["age_test2"] - 13.10152) + 0.4315686* (result["age_test3"] - 0.9844332) + 0.0009163615*( result["calH_test1"] - 182.9347) -0.0007536899*( result["calH_test2"] - 124.8706) -0.00004697183*( result["calH_test3"] -80.75636) + 0.0001401325*( result["calAH_test1"] - 700.7824) -0.001349783*( result["calAH_test2"] - 634.2167) +0.001753832*( result["calAH_test3"] -419.3361) + 0.0001906046*( result["calDH_test1"] -835.2894) -0.000251567*( result["calDH_test2"] - 213.1630) -0.002173942*( result["fat_test1"] -108.4149)+0.003066541*( result["fat_test2"] - 28.33497) +0.6700708*(result["N4"]-0.3241176) +0.3336162*(result["O3"]-0.4994118) +0.1322476*(result["O20"]-0.1741176) +0.9084972*(result["O18"]-0.008823529) +0.2978388*(result["N12"]-0.1152941) +0.1777935*(result["N20"]-0.3582353) +1.588042*(result["N31"]-0.002352941) +0.2197419*(result["O6"]-0.07823529) +1.791159*(result["N34"]-0.001176471) +0.4305973*(result["N14"]-0.02176471) -0.4472885*(result["N29"]-0.02411765) +0.2601319*(result["N26"]-0.04941176) -0.2364269*(result["O11"]-0.1164706) +0.1784179*(result["N6"]-0.1070588) +0.6023170*(result["O14"]-0.01294118) -1.031959*(result["N43"]-0.007058824) +0.4257809*(result["O17"]-0.01823529) +0.2002546*(result["O9"]-0.06176471));
|
||||
}catch(e){result['lpv'] = "error"};
|
||||
console.log(result['lpv']);
|
||||
result['lpv_variable']['A'] = A;
|
||||
lpv = ((age1-0.7276655)*(-10.87)+(age2+0.4540707)*8.968+(size1-0.643632)*0.7678+(nposit-1.346932)*0.5339+ grade_2*0.4795+grade_3*0.818+subtype_HER2*0.1806+subtype_triple*0.6457+pstage_2*0.5311+ pstage_3*1.134+pstage_4*2.172+lvi_yes*0.3321-0.04+chemo*(-0.4147)+radio*(-0.3203)+hormone*(-0.8397)+target*(-0.4687)
|
||||
)
|
||||
}catch(e){console.log(e)};
|
||||
result['lpv_variable'] = {};
|
||||
result['lpv_variable']['lpv'] = lpv;
|
||||
result['lpv'] = lpv;
|
||||
result['lpv_variable']['lpv'] = result['lpv'];
|
||||
return result;
|
||||
};
|
||||
function calculate_and_change_result_value(obj){
|
||||
obj.servive_ratio_arr = [];
|
||||
for(var i = 0;i<obj.active_treatment.length;i++){
|
||||
var servive_ratio = round((1-(calculate_servive_ratio(obj.year,obj.lpv_real[i])))*100,2);
|
||||
var servive_ratio = round((1 - calculate_servive_ratio(obj.year,obj.lpv_real[i]))*100,2);
|
||||
var benefit = servive_ratio - obj.servive_ratio_arr[obj.servive_ratio_arr.length-1];
|
||||
obj.servive_ratio_arr.push(servive_ratio);
|
||||
$('tr.'+obj.active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(servive_ratio);
|
||||
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
|
||||
if(i != 0){
|
||||
$('tr.'+obj.active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||
$('.'+obj.active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
|
||||
|
@ -730,19 +696,16 @@ function calculate_first_lpv(result_json){
|
|||
|
||||
function calculate_servive_ratio(year,obj){
|
||||
var servive_ratio;
|
||||
var A = obj['A'];
|
||||
var lpv = obj['lpv'];
|
||||
switch(year) {
|
||||
case '1':
|
||||
servive_ratio = 0.8095037**( Math.exp(A) );
|
||||
servive_ratio = Math.exp(-0.001476145)**( Math.exp(lpv) );
|
||||
break;
|
||||
case '1.5':
|
||||
servive_ratio = 0.729158**( Math.exp(A) );
|
||||
case '3':
|
||||
servive_ratio = Math.exp(-0.01261639)**( Math.exp(lpv) );
|
||||
break;
|
||||
case '2':
|
||||
servive_ratio = 0.6717211**( Math.exp(A) );
|
||||
break;
|
||||
case '2.5':
|
||||
servive_ratio = 0.6056773**( Math.exp(A) );
|
||||
case '5':
|
||||
servive_ratio = Math.exp(-0.02519608)**( Math.exp(lpv) );
|
||||
break;
|
||||
default:
|
||||
console.log('not found year.');
|
||||
|
|
|
@ -385,8 +385,6 @@ div.texts_show{
|
|||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
@media print {
|
||||
* {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
}
|
||||
.print_only{
|
||||
display: none;
|
||||
}
|
|
@ -60,7 +60,7 @@ div.num_group{
|
|||
.cencer_table_name{
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
color:#5d7ca2;
|
||||
color:#5d7ca2 !important;
|
||||
}
|
||||
#cancer_table .cencer_table_name{
|
||||
width: 16.25em;
|
||||
|
@ -68,10 +68,18 @@ div.num_group{
|
|||
#cancer_predict_result_block .cencer_table_name{
|
||||
width: 5em;
|
||||
}
|
||||
.cancer_help_btn{
|
||||
background-color: rgb(210, 106, 2) !important;
|
||||
border-color: rgb(210, 106, 2) !important;
|
||||
color: white !important;
|
||||
}
|
||||
.cancer_help_btn i:before {
|
||||
color: white !important;
|
||||
}
|
||||
.cancer_table_btn{
|
||||
margin-right: 0.5em;
|
||||
color:#5d7ca2;
|
||||
border-color: #5d7ca2;
|
||||
color:#5d7ca2 !important;
|
||||
border-color: #5d7ca2 !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
.cancer_table_btn::last-of-type{
|
||||
|
@ -81,6 +89,7 @@ div.num_group{
|
|||
font-size:0.825em;
|
||||
color:#5d7ca2;
|
||||
}
|
||||
@media print{
|
||||
#cancer_table_top{
|
||||
padding-bottom: 4em;
|
||||
}
|
||||
|
@ -120,7 +129,7 @@ input.num_only{
|
|||
border-left: 0.125em solid rgb(221, 221, 221);
|
||||
text-align: center;
|
||||
font-size: 0.875em;
|
||||
background-color: rgb(255, 255, 255);
|
||||
background-color: rgb(255, 255, 255) !important;
|
||||
height: 2.25em;
|
||||
position: absolute;
|
||||
left:0.625em;
|
||||
|
@ -137,8 +146,8 @@ input.float_num{
|
|||
#cancer_table_submit{
|
||||
margin-left: 1em;
|
||||
float: right;
|
||||
background-color: rgb(210, 105, 0);
|
||||
color: white;
|
||||
background-color: rgb(210, 105, 0) !important;
|
||||
color: white !important;
|
||||
border: 0em;
|
||||
padding: 0.125em 0.5em;
|
||||
border-radius: 0.5em;
|
||||
|
@ -146,8 +155,8 @@ input.float_num{
|
|||
}
|
||||
#cancer_table_reset{
|
||||
float: right;
|
||||
background-color: rgb(210, 105, 0);
|
||||
color: white;
|
||||
background-color: rgb(210, 105, 0) !important;
|
||||
color: white !important;
|
||||
border: 0em;
|
||||
padding: 0.125em 0.5em;
|
||||
border-radius: 0.5em;
|
||||
|
@ -186,9 +195,9 @@ input.float_num{
|
|||
border-color: #8c8c8c !important;
|
||||
}
|
||||
.cancer_table_btn.active{
|
||||
color: #5d7ca2;
|
||||
background-color: #9dc3e6;
|
||||
border-color: #8c8c8c;
|
||||
color: #5d7ca2 !important;
|
||||
background-color: #9dc3e6 !important;
|
||||
border-color: #8c8c8c !important;
|
||||
}
|
||||
.cancertable_empty{
|
||||
border: 0.25em solid pink !important;
|
||||
|
@ -196,8 +205,8 @@ input.float_num{
|
|||
padding: 0.125em !important;
|
||||
}
|
||||
.result_title{
|
||||
background-color: rgb(210, 105, 0);
|
||||
color: white;
|
||||
background-color: rgb(210, 105, 0) !important;
|
||||
color: white !important;
|
||||
border: 0em;
|
||||
padding: 0.125em 0.5em;
|
||||
border-radius: 0.5em;
|
||||
|
@ -205,8 +214,8 @@ input.float_num{
|
|||
float: left;
|
||||
}
|
||||
.result_tab{
|
||||
background: #023d79;
|
||||
background: linear-gradient(135deg, transparent 0.3em, #023d79 0);
|
||||
background: #023d79 !important;
|
||||
background: linear-gradient(135deg, transparent 0.3em, #023d79 0) !important;
|
||||
border: none;
|
||||
float:right;
|
||||
padding: 0.5em 0.125em 0.5em 0.5em;
|
||||
|
@ -230,30 +239,28 @@ input.float_num{
|
|||
margin-left: -0.5em;
|
||||
}
|
||||
.result_tab.active{
|
||||
background: #d16801;
|
||||
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
|
||||
background: #d16801 !important;
|
||||
background: linear-gradient(135deg, transparent 0.3em, #d16801 0) !important;
|
||||
padding: 0.8em 0.125em 0.5em 1em;
|
||||
margin-left: -0.5em;
|
||||
}
|
||||
.result_tab > a{
|
||||
writing-mode: vertical-lr;
|
||||
-webkit-writing-mode: vertical-lr;
|
||||
color: white;
|
||||
writing-mode: vertical-lr !important;
|
||||
-webkit-writing-mode: vertical-lr !important;
|
||||
color: white !important;
|
||||
}
|
||||
.result_tab_group{
|
||||
width: 15%;
|
||||
margin: 0;
|
||||
float: left;
|
||||
display: none;
|
||||
}
|
||||
.result_content_group{
|
||||
width: 85%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
float: right;
|
||||
float: none;
|
||||
}
|
||||
.result_content{
|
||||
display: none;
|
||||
display: block;
|
||||
min-height: 25em;
|
||||
border: 0.125em solid #c0cbdd;
|
||||
border: 0.125em solid #c0cbdd !important;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.result_content:first-of-type{
|
||||
|
@ -315,13 +322,13 @@ input.float_num{
|
|||
color:white;
|
||||
}
|
||||
.cancer_th{
|
||||
color: white;
|
||||
background-color: #003d79;
|
||||
color: white !important;
|
||||
background-color: #003d79 !important;
|
||||
border-right: 0.375em solid white;
|
||||
border-top: 0.375em solid white;
|
||||
}
|
||||
.cancer_td {
|
||||
background-color: #e9eaf5;
|
||||
background-color: #e9eaf5 !important;
|
||||
border-right: 0.375em solid white;
|
||||
border-top: 0.375em solid white;
|
||||
}
|
||||
|
@ -362,30 +369,32 @@ div.texts_show{
|
|||
width: 80%;
|
||||
}
|
||||
#cancer_table_right{
|
||||
float:right;
|
||||
width:50%;
|
||||
float:right;
|
||||
width:50%;
|
||||
}
|
||||
#cancer_table_left{
|
||||
float:left;
|
||||
width:50%;
|
||||
float:left;
|
||||
width:50%;
|
||||
}
|
||||
#cancer_table_right_result{
|
||||
width: 50%;
|
||||
float: right;
|
||||
width: 50%;
|
||||
float: right;
|
||||
}
|
||||
#cancer_table_left_result{
|
||||
width: 50%;
|
||||
float: left;
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
#cancer_predict_result{
|
||||
width: 50%;
|
||||
float: left;
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
.result_title{
|
||||
margin-top: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
* {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
}
|
||||
.layout-content{
|
||||
background: #fff !important;
|
||||
}
|
||||
@media print {
|
||||
* {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
}
|
||||
}
|
|
@ -27,11 +27,11 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@title_images_id.each{|image_id| @title_images.push Headimages.find_by(:id=>image_id.to_s)} rescue nil
|
||||
@head_new_image = Headimages.new(:cancerpredictfields_id => @form_to_show.id)
|
||||
end
|
||||
def edit
|
||||
other_in_use_locales = Site.first.in_use_locales.map{|l| l.to_s}
|
||||
other_in_use_locales.delete(params[:locale])
|
||||
if !(params["cancerpredictfields"].nil?)
|
||||
org_nums = @form_to_show.form_show_was.keys
|
||||
def edit
|
||||
other_in_use_locales = Site.first.in_use_locales.map{|l| l.to_s}
|
||||
other_in_use_locales.delete(params[:locale])
|
||||
if !(params["cancerpredictfields"].nil?)
|
||||
org_nums = @form_to_show.form_show_was.keys
|
||||
remain_org_nums = params["cancerpredictfields"]["form_show"].values.map{|property| property["old_num"]}.select{|n| n.present?}
|
||||
delete_nums = org_nums - remain_org_nums
|
||||
if !delete_nums.blank?
|
||||
|
@ -59,41 +59,57 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
end
|
||||
next if key.include?("_file")
|
||||
if (key != "old_num")
|
||||
if value != "0" && value != "1"
|
||||
if key != params[:locale]
|
||||
@form_to_show.form_show[num.to_s] = {} if @form_to_show.form_show[num.to_s].nil?
|
||||
type = Cancerpredictfields::FIELDINFO[key.to_s].constantize rescue String
|
||||
if @form_to_show.form_show[num.to_s][key.to_s].class != Array && type != Array
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = value
|
||||
if key != params[:locale]
|
||||
@form_to_show.form_show[num.to_s] = {} if @form_to_show.form_show[num.to_s].nil?
|
||||
type = Cancerpredictfields::FIELDINFO[key.to_s]
|
||||
if type && Cancerpredictfields::Field_relations[type]
|
||||
type = Cancerpredictfields::Field_relations[type]
|
||||
end
|
||||
type = type.constantize rescue String
|
||||
if @form_to_show.form_show[num.to_s][key.to_s].class != Array && type != Array
|
||||
if type == Fixnum
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = value.to_i rescue 0
|
||||
elsif type == Float
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = value.to_f rescue 0.0
|
||||
else
|
||||
if value.length > 2
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = YAML.load(value)
|
||||
else
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = []
|
||||
end
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = value
|
||||
end
|
||||
else
|
||||
value.each do |sub_property,sub_value|
|
||||
type = Cancerpredictfields::FIELDINFO[sub_property.to_s].constantize rescue String
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ] = {} if @form_to_show.form_show[num.to_s][ sub_property ].nil?
|
||||
if @form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s].class != Array && type != Array
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value
|
||||
else
|
||||
if sub_value.length > 2
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = YAML.load(sub_value)
|
||||
else
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = []
|
||||
end
|
||||
end
|
||||
if(property["old_num"].present? && property["old_num"] != num.to_s)
|
||||
other_in_use_locales.each do |locale|
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][locale] = @form_to_show.form_show_was[ property["old_num"] ][ sub_property ][locale]
|
||||
end
|
||||
end
|
||||
if value.length > 2
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = YAML.load(value)
|
||||
else
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = []
|
||||
end
|
||||
end
|
||||
else
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = value.to_i
|
||||
value.each do |sub_property,sub_value|
|
||||
type = Cancerpredictfields::FIELDINFO[sub_property.to_s]
|
||||
if type && Cancerpredictfields::Field_relations[type]
|
||||
type = Cancerpredictfields::Field_relations[type]
|
||||
end
|
||||
type = type.constantize rescue String
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ] = {} if @form_to_show.form_show[num.to_s][ sub_property ].nil?
|
||||
if @form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s].class != Array && type != Array
|
||||
if type == Fixnum
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value.to_i rescue 0
|
||||
elsif type == Float
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value.to_f rescue 0.0
|
||||
else
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value
|
||||
end
|
||||
else
|
||||
if sub_value.length > 2
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = YAML.load(sub_value)
|
||||
else
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][params[:locale].to_s] = []
|
||||
end
|
||||
end
|
||||
if(property["old_num"] != nil && property["old_num"] != num.to_s)
|
||||
other_in_use_locales.each do |locale|
|
||||
@form_to_show.form_show[ num.to_s ][ sub_property ][locale] = @form_to_show.form_show_was[ property["old_num"] ][ sub_property ][locale]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -128,42 +144,62 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
if value[:_destroy] == "1"
|
||||
mapping_file = CancerPredictMappingFile.find(value[:id])
|
||||
mapping_file.destroy
|
||||
@form_to_show.form_show[num.to_s][key.to_s] = ""
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = ""
|
||||
end
|
||||
end
|
||||
next if key.include?("_file")
|
||||
if (key != "old_num")
|
||||
if value != "0" && value != "1"
|
||||
if key != params[:locale]
|
||||
if @form_to_show.form_show_in_result[num.to_s][key.to_s].class != Array
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value
|
||||
if key != params[:locale]
|
||||
@form_to_show.form_show_in_result[num.to_s] = {} if @form_to_show.form_show_in_result[num.to_s].nil?
|
||||
type = Cancerpredictfields::FIELDINFO[key.to_s]
|
||||
if type && Cancerpredictfields::Field_relations[type]
|
||||
type = Cancerpredictfields::Field_relations[type]
|
||||
end
|
||||
type = type.constantize rescue String
|
||||
if @form_to_show.form_show_in_result[num.to_s][key.to_s].class != Array && type != Array
|
||||
if type == Fixnum
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_i rescue 0
|
||||
elsif type == Float
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_f rescue 0.0
|
||||
else
|
||||
if value.length > 2
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = YAML.load(value)
|
||||
else
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = []
|
||||
end
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value
|
||||
end
|
||||
else
|
||||
value.each do |sub_property,sub_value|
|
||||
if @form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s].class != Array
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value
|
||||
else
|
||||
if sub_value.length > 2
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = YAML.load(sub_value)
|
||||
else
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = []
|
||||
end
|
||||
end
|
||||
if(property["old_num"] != nil && property["old_num"] != num.to_s)
|
||||
other_in_use_locales.each do |locale|
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][locale] = @form_to_show.form_show_in_result_was[ property["old_num"] ][ sub_property ][locale]
|
||||
end
|
||||
end
|
||||
if value.length > 2
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = YAML.load(value)
|
||||
else
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = []
|
||||
end
|
||||
end
|
||||
else
|
||||
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_i
|
||||
value.each do |sub_property,sub_value|
|
||||
type = Cancerpredictfields::FIELDINFO[sub_property.to_s]
|
||||
if type && Cancerpredictfields::Field_relations[type]
|
||||
type = Cancerpredictfields::Field_relations[type]
|
||||
end
|
||||
type = type.constantize rescue String
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ] = {} if @form_to_show.form_show[num.to_s][ sub_property ].nil?
|
||||
if @form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s].class != Array && type != Array
|
||||
if type == Fixnum
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value.to_i rescue 0
|
||||
elsif type == Float
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value.to_f rescue 0.0
|
||||
else
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = sub_value
|
||||
end
|
||||
else
|
||||
if sub_value.length > 2
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = YAML.load(sub_value)
|
||||
else
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][params[:locale].to_s] = []
|
||||
end
|
||||
end
|
||||
if(property["old_num"] != nil && property["old_num"] != num.to_s)
|
||||
other_in_use_locales.each do |locale|
|
||||
@form_to_show.form_show_in_result[ num.to_s ][ sub_property ][locale] = @form_to_show.form_show_was[ property["old_num"] ][ sub_property ][locale]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -175,7 +211,7 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
end
|
||||
end
|
||||
end
|
||||
@create_items = ['title_texts','form_result_is_right','text_descibe','years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block','prediction_formula']
|
||||
@create_items = ['title_texts','form_result_is_right','text_descibe','years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block','prediction_formula','hidden_variables','advance_mode']
|
||||
params_cancer = params.require("cancerpredictfields").permit!
|
||||
@create_items.each do |item|
|
||||
if (@form_to_show[item].class == BSON::Document) || (@form_to_show.send(item).class == Hash)
|
||||
|
@ -269,7 +305,7 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
Headimages.find_by(:id => @image_id ).destroy rescue next
|
||||
@form_to_show.title_images_id.delete(@image_id)
|
||||
end
|
||||
file_ids = @form_to_show.form_show.values.map{|property| [property[:variable],property[:cancer_predict_mapping_file]]}.select{|k,f| f.present?}.to_h
|
||||
file_ids = (@form_to_show.form_show.values + @form_to_show.form_show_in_result.values).map{|property| [property[:variable],property[:cancer_predict_mapping_file]]}.select{|k,f| f.present?}.to_h
|
||||
mapping_data_from_csv = {}
|
||||
if !file_ids.blank?
|
||||
file_ids.each do |k,v|
|
||||
|
@ -342,14 +378,14 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@table_str_left += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
|
||||
@table_str_left += @field_property["name"]
|
||||
@table_str_left += '</label>'
|
||||
if @field_property["comment_text"] != ""
|
||||
if @field_property["comment_text"].present?
|
||||
@table_str_left += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||
@table_str_left += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
|
||||
else
|
||||
@site_locales = current_site.in_use_locales
|
||||
@site_locales.delete(current_locale)
|
||||
@site_locales.each do |locale|
|
||||
next if property["comment_text"][locale.to_s] == ""
|
||||
next if property["comment_text"][locale.to_s].blank?
|
||||
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||
break
|
||||
end
|
||||
|
@ -370,7 +406,6 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@table_str_left += '<div class="num_group"><form class="for_num">'
|
||||
@table_str_left += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>'
|
||||
@table_str_left += '<input class="num_only_value" type="hidden" value="0"/>'
|
||||
|
||||
@please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice"
|
||||
@table_str_left += '<select class="select_num"><option value="">'+@please_choice+'</option>'
|
||||
if @field_property["choice_fields"] != []
|
||||
|
@ -402,14 +437,14 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@table_str_right += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
|
||||
@table_str_right += @field_property["name"]
|
||||
@table_str_right += '</label>'
|
||||
if @field_property["comment_text"] != ""
|
||||
if @field_property["comment_text"].present?
|
||||
@table_str_right += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||
@table_str_right += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
|
||||
else
|
||||
@site_locales = current_site.in_use_locales
|
||||
@site_locales.delete(current_locale)
|
||||
@site_locales.each do |locale|
|
||||
next if property["comment_text"][locale.to_s] == ""
|
||||
next if property["comment_text"][locale.to_s].blank?
|
||||
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||
break
|
||||
end
|
||||
|
@ -493,18 +528,18 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@table_result_choice_fileds += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
|
||||
@table_result_choice_fileds += @field_property["name"]
|
||||
@table_result_choice_fileds += '</label>'
|
||||
if @field_property["comment_text"] != ""
|
||||
if @field_property["comment_text"].present?
|
||||
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'></input>'
|
||||
else
|
||||
@site_locales = current_site.in_use_locales
|
||||
@site_locales.delete(current_locale)
|
||||
@site_locales.each do |locale|
|
||||
next if property["comment_text"][locale.to_s] == ""
|
||||
next if property["comment_text"][locale.to_s].blank?
|
||||
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||
break
|
||||
end
|
||||
if @field_property["comment_text"] != ""
|
||||
if @field_property["comment_text"].present?
|
||||
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
|
||||
else
|
||||
|
@ -587,7 +622,7 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@pagination = create_pagination(@page_num.to_i)
|
||||
end
|
||||
def export_cancer_tool_record
|
||||
@cancer_records = Cancerpredictrecord.where("title"=>@app_title).asc(:id)
|
||||
@cancer_records = Cancerpredictrecord.where("title"=>@app_title).desc(:id)
|
||||
dir_path = 'tmp/cancer_tool/'
|
||||
#FileUtils.rm_r(dir_path, :force => true) if Dir.exist?(dir_path)
|
||||
FileUtils.mkdir dir_path if !Dir.exist?(dir_path) #create dir for storing tmp_file if dir doesn't exist
|
||||
|
@ -662,21 +697,21 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
end
|
||||
pagination += (((page==all_page_num) ? '<li>['+I18n.t('cancerpredict.next_page')+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+(page+1).to_s+'"> ['+I18n.t('cancerpredict.next_page')+'] </a></li>')+'</ol></div>')
|
||||
end
|
||||
def read_mapping_file(mapping_file_id)
|
||||
mapping_file = CancerPredictMappingFile.find(mapping_file_id) rescue nil
|
||||
if !mapping_file.nil?
|
||||
csv_rows = CSV.read(mapping_file.temp_file.file.path)
|
||||
titles = csv_rows[0]
|
||||
infos = {}
|
||||
titles.each_with_index do |title,i|
|
||||
infos[title] = []
|
||||
csv_rows[1..-1].each do |row|
|
||||
infos[title] << row[i].to_f
|
||||
end
|
||||
end
|
||||
return infos
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
def read_mapping_file(mapping_file_id)
|
||||
mapping_file = CancerPredictMappingFile.find(mapping_file_id) rescue nil
|
||||
if !mapping_file.nil?
|
||||
csv_rows = CSV.read(mapping_file.temp_file.file.path)
|
||||
titles = csv_rows[0]
|
||||
infos = {}
|
||||
titles.each_with_index do |title,i|
|
||||
infos[title] = []
|
||||
csv_rows[1..-1].each do |row|
|
||||
infos[title] << row[i].to_f
|
||||
end
|
||||
end
|
||||
return infos
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -8,7 +8,6 @@ class CancerpredictsController < ApplicationController
|
|||
end
|
||||
def calculate
|
||||
create_first_field
|
||||
#begin
|
||||
if params['header'].to_i == 1
|
||||
locale = params['locale'].to_s rescue 'zh_tw'
|
||||
locale = 'zh_tw' if locale == 'zh_cn'
|
||||
|
@ -41,7 +40,7 @@ class CancerpredictsController < ApplicationController
|
|||
@choice_values = []
|
||||
@choice_names = []
|
||||
@form_to_show.form_show.values.each{|choice| @choice_keys.push choice[:variable]}
|
||||
@form_to_show.form_show.values.each{|choice| @choice_values.push choice[:choice_fields]}
|
||||
@form_to_show.form_show.values.each{|choice| @choice_values.push ((choice[:is_num] == 1) ? [] : choice[:choice_fields])}
|
||||
@form_to_show.form_show.values.each{|choice| @choice_names.push choice[:name]}
|
||||
@choice_keys.each_with_index{|key,i| @record.names[key] = @choice_names[i]}
|
||||
@choice_keys.each_with_index{|key,i| @record.values[key] = @choice_values[i]}
|
||||
|
@ -53,14 +52,10 @@ class CancerpredictsController < ApplicationController
|
|||
locale = params['data']['locale'].to_s rescue 'zh_tw'
|
||||
locale = 'zh_tw' if locale == 'zh_cn'
|
||||
result = {}
|
||||
# result['sex_value'] = params['data']['sex'].to_i - 1
|
||||
# result['Age_value'] = params['data']['age'].to_i
|
||||
# if params['data']['calcification_score'].to_i < 1400
|
||||
# result['cal_value'] = 0
|
||||
# else
|
||||
# result['cal_value'] = 1
|
||||
# end
|
||||
mapping_data_from_csv = JSON.parse(@form_to_show.mapping_data_from_csv) rescue {}
|
||||
@form_to_show.all_variables.each do |v|
|
||||
result[v] = 0
|
||||
end
|
||||
@form_to_show.form_show.each do |num,property|
|
||||
@variable = property[:variable]
|
||||
if @variable.present?
|
||||
|
@ -71,17 +66,21 @@ class CancerpredictsController < ApplicationController
|
|||
result[@variable] = params['data'][@variable].to_i rescue 0
|
||||
end
|
||||
elsif property[:choice_fields].present?
|
||||
if property[:map_values].class == Array && property[:choice_fields].class == Array && property[:map_values].length == property[:choice_fields].length
|
||||
result[@variable] = property[:map_values][params['data'][@variable].to_i - 1]
|
||||
if !(@form_to_show.advance_mode)
|
||||
result[@variable] = params['data'][@variable].to_i rescue 0
|
||||
else
|
||||
if property[:revert_value].to_i != 1
|
||||
result[@variable] = params['data'][@variable].to_i - 1
|
||||
if property[:need_map_values] == 1
|
||||
result[@variable] = property[:map_values][params['data'][@variable].to_i - 1]
|
||||
else
|
||||
result[@variable] = ((property[:choice_fields].length - params['data'][@variable].to_i) rescue params['data'][@variable].to_i)
|
||||
if property[:revert_value] != 1
|
||||
result[@variable] = params['data'][@variable].to_i - 1
|
||||
else
|
||||
result[@variable] = ((property[:choice_fields].length - params['data'][@variable].to_i) rescue params['data'][@variable].to_i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if property[:cancer_predict_mapping_file].present?
|
||||
if @form_to_show.advance_mode && property[:cancer_predict_mapping_file].present?
|
||||
if (mapping_data_from_csv != {})
|
||||
mapping_hash = mapping_data_from_csv[@variable]
|
||||
temp_index = 0
|
||||
|
@ -102,43 +101,32 @@ class CancerpredictsController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
#result['lpv'] = -0.51427548* (result['sex_value']- 0.508312) + 0.05764604* (result['Age_value'] - 61.894501) + 0.49138819*(result['cal_value'] - 0.334399) rescue 'error'
|
||||
formula_variables = @form_to_show.tmp_lpv_variables
|
||||
formula_variables = @form_to_show.tmp_lpv_variables
|
||||
begin
|
||||
eval_hidden_variables(result)
|
||||
rescue => e
|
||||
@form_to_show.generate_eval_formula
|
||||
eval_hidden_variables(result)
|
||||
end
|
||||
begin
|
||||
eval_formula(result)
|
||||
rescue => e
|
||||
@form_to_show.generate_eval_formula
|
||||
eval_formula(result)
|
||||
end
|
||||
result['lpv'] = instance_variable_get(formula_variables.last)
|
||||
result['lpv'] = result[formula_variables.last]
|
||||
result['lpv_variable'] = {}
|
||||
formula_variables.each do |variable_name|
|
||||
result['lpv_variable']["#{variable_name[1..-1]}"] = instance_variable_get(variable_name)
|
||||
result['lpv_variable']["#{variable_name}"] = result[variable_name]
|
||||
end
|
||||
@years = @form_to_show.years
|
||||
result['table'] = '<input id="current_year" type="hidden" value="'+@years[0].to_s+'" index="0"/><p id="cancer_table_texts">'+@form_to_show.table_above_texts[locale].to_s+'</p>'
|
||||
result['table'] += ('<a style="display: inline-block;">'+(locale == 'zh_tw' ? '第' : '')+'</a><a style="display: inline-block;">')
|
||||
result['years'] = @years
|
||||
@years.each{|year| result['table'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year.to_s+'</button>')}
|
||||
result['table'] += ('</a><a style="display: inline-block;">'+(locale == 'zh_tw' ? '年' : '')+'</a>')
|
||||
#@head_name = ['Treatment','Additional_Benefit','Overall_Survival']
|
||||
@head_name = ['Treatment','Overall_Survival']
|
||||
@table_head = @head_name.map{|name| I18n.t('cancerpredict.table.'+name)}
|
||||
@therapy_choices = [I18n.t('cancerpredict.table.Surgeryonly')]
|
||||
@form_to_show.form_show_in_result.values.each{|choice| @therapy_choices.push choice["name"][locale]}
|
||||
@therapy_names = ['Surgery_only']
|
||||
@form_to_show.form_show_in_result.values.each{|choice| @therapy_names.push choice["variable"]}
|
||||
result['treatmeny_method'] = @therapy_names
|
||||
result['table'] += '<table><thead><tr>'
|
||||
@table_head.each_with_index{|head,index| result['table'] += ('<th class="cancer_th '+@head_name[index]+'">' + head + '</th>')}
|
||||
result['table'] += '</tr></thead><tbody>'
|
||||
@therapy_choices.each_with_index do |choice,i|
|
||||
result['table'] += '<tr class="'+@therapy_names[i].to_s+'">'
|
||||
@table_head.each_with_index do |head,index|
|
||||
result['table'] += ('<td class="cancer_td '+ @head_name[index]+'">' + ((index == 0) ? (((i==0)? '' : '+') + choice) : '-') + '</td>')
|
||||
end
|
||||
result['table'] += '</tr>'
|
||||
end
|
||||
@therapy_names = @form_to_show.treatment_method
|
||||
result['treatment_method'] = @therapy_names
|
||||
result['treatment_method_active_indices'] = @form_to_show.treatment_method_active_indices
|
||||
result['table'] = @form_to_show.result_table_translations[locale]
|
||||
year = params['data']['year'] rescue nil
|
||||
if year.nil?
|
||||
year = @years.first.to_f
|
||||
|
@ -148,35 +136,12 @@ class CancerpredictsController < ApplicationController
|
|||
year_index = @years.index(year)
|
||||
@servive_ratio = eval(@form_to_show.tmp_years_settings_for_ruby[year_index])
|
||||
@servive_ratio = ((1 - @servive_ratio) * 100).round(2)
|
||||
@texts = @form_to_show.text_above_texts[locale].to_s.gsub('<br/>','</span><br/><span>').gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round(2).to_s+'</span>')
|
||||
@texts = @texts.split('{{years}}')
|
||||
@texts.delete('')
|
||||
result['texts'] = '<span>'+@texts[0]
|
||||
@years.each{|year| result['texts'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm" style="float:none;">'+year.to_s+'</button>')}
|
||||
if @texts.count > 1
|
||||
result['texts'] += (@texts[1]+'</span>') if @texts.count > 1
|
||||
else
|
||||
result['texts'] += '</span>'
|
||||
end
|
||||
if !@form_to_show.surgery_only_texts[locale].blank?
|
||||
@surgery_only_texts = @form_to_show.surgery_only_texts[locale]
|
||||
@surgery_only_texts.insert(0,'<p class="show"><span>')
|
||||
@surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round.to_s+'</span><span>')
|
||||
@surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}','</span><span class="surgery_year">'+@years[-1].to_s+'</span><span>')
|
||||
@surgery_only_texts += '</span>'
|
||||
else
|
||||
@surgery_only_texts = ''
|
||||
end
|
||||
result['texts'] += @surgery_only_texts
|
||||
result['texts'] += '<span class="addition">'+@form_to_show.extra_texts[locale]+'</span><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div></div></p>'
|
||||
result['texts'] = @form_to_show.result_text_translations[locale]
|
||||
result['extra_therapy_texts'] = @form_to_show.extra_therapy_texts[locale] rescue @form_to_show.extra_therapy_texts['zh_tw']
|
||||
result['servive_ratio'] = @servive_ratio
|
||||
end
|
||||
result = result.merge(params)
|
||||
render :json=> result
|
||||
# rescue
|
||||
# render :json=> params
|
||||
#end
|
||||
end
|
||||
def index
|
||||
uid = OrbitHelper.params[:uid] rescue ""
|
||||
|
|
|
@ -1,107 +1,133 @@
|
|||
class Cancerpredictfields
|
||||
require 'pathname'
|
||||
require "pathname"
|
||||
require 'json'
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include OrbitModel::Impression
|
||||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
FIELDINFO = {"variable"=>"String","name"=>"String","is_num"=>"Fixnum","hint"=>"String","comment_text"=>"String","choice_fields"=>"Array","range"=>"Array","right"=>"Fixnum","is_float"=>"Fixnum","revert_value"=>"Fixnum","map_values"=>"Array","cancer_predict_mapping_file"=>"String"}
|
||||
NonLoclaized = ["variable","is_num","range","right","is_float","revert_value","map_values","cancer_predict_mapping_file"]
|
||||
Field_relations = {"number_field"=>"Fixnum","text_area"=>"String"}
|
||||
FIELDINFO = {"variable"=>"String","name"=>"String","is_num"=>"Fixnum","hint"=>"String","comment_text"=>"String","choice_fields"=>"Array","range"=>"Array","right"=>"Fixnum","is_float"=>"Fixnum","revert_value"=>"Fixnum","map_values"=>"Array","cancer_predict_mapping_file"=>"String","lpv_impact"=>"Float","active_choice"=>"number_field","disable_condition"=>"text_area"}
|
||||
NonLoclaized = ["variable","is_num","range","right","is_float","revert_value","map_values","cancer_predict_mapping_file","lpv_impact","active_choice","disable_condition"]
|
||||
AdvanceFields = ["revert_value","map_values","cancer_predict_mapping_file"]
|
||||
TherapyFields = ["variable","name","hint","comment_text","choice_fields","lpv_impact","active_choice","disable_condition"]
|
||||
TherapyOnly = ["lpv_impact","active_choice","disable_condition"]
|
||||
field :title ,type:String ,default:""
|
||||
field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>0, :hint=>{'zh_tw'=>'','en'=>''} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0,:revert_value=>0,:map_values=>[],:cancer_predict_mapping_file=>""},
|
||||
1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 20 歲(含)開始至 98 歲','en'=>'Age must be between 20 and 98'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[20,98],:right=>0,:is_float=>0,:revert_value=>0,:map_values=>[],:cancer_predict_mapping_file=>""},
|
||||
2=>{:variable=>"calcification_score",:name=>{"zh_tw"=>"鈣化指數<br/>(Calcification score)","en"=>"Calcification score"},:is_num=>1,:hint=>{'zh_tw'=>'請輸入0到5000的數字','en'=>'Please enter a number between 0 and 5000'}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,5000],:right=>0,:is_float=>1,:revert_value=>0,:map_values=>[],:cancer_predict_mapping_file=>""}
|
||||
}
|
||||
field :form_show_in_result , :type=> Hash ,default:{}#{0=>{:variable=>"hormone_therapy",:name=>{"zh_tw"=>"賀爾蒙治療","en"=>"Hormone/Steroid therapy"},:is_num=>0, :hint=>{'zh_tw'=>'適用賀爾蒙受體陽性病人','en'=>'Hormone/ steroid therapy is available when ER status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
|
||||
#1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
|
||||
#2=>{:variable=>"Radiotherapy",:name=>{"zh_tw"=>"放射治療","en"=>"Radiotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
|
||||
#3=>{:variable=>"Targeted_therapy",:name=>{"zh_tw"=>"標靶治療","en"=>"Targeted therapy"},:is_num=>0,:hint=>{'zh_tw'=>'抗HER2治療','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}
|
||||
#}
|
||||
field :advance_mode, type: Boolean, default: true
|
||||
field :form_show , :type=> Hash ,default:{
|
||||
"0"=>{"variable"=>"sex_value", "name"=>{"zh_tw"=>"性別<br/>(Sex)", "en"=>"Sex"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["男", "女"], "en"=>["Male", "Female"]}, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"1"=>{"variable"=>"age", "name"=>{"zh_tw"=>"年齡<br/>(Age)", "en"=>"Age"}, "is_num"=>1, "hint"=>{"zh_tw"=>"從 20 歲(含)開始至 98 歲", "en"=>"Age must be between 20 and 98"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "range"=>[20, 98], "right"=>0, "is_float"=>0, "revert_value"=>0, "map_values"=>[], "cancer_predict_mapping_file"=>BSON::ObjectId('5f8e60441d41c801f600011a'), "need_map_values"=>0},
|
||||
"2"=>{"variable"=>"calH", "name"=>{"zh_tw"=>"心臟鈣化分數<br/>(Heart Calcification score)", "en"=>"Heart Calcification score"}, "is_num"=>1, "hint"=>{"zh_tw"=>"請輸入0到5000的數字", "en"=>"Please enter a number between 0 and 5000"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "range"=>[0, 5000], "right"=>0, "is_float"=>1, "revert_value"=>0, "map_values"=>[], "cancer_predict_mapping_file"=>BSON::ObjectId('5f8e66c71d41c801f6000139'), "need_map_values"=>0},
|
||||
"3"=>{"variable"=>"calAH", "name"=>{"zh_tw"=>"升主動脈鈣化分數", "en"=>"Aorta ascendens Calcification score"}, "hint"=>{"zh_tw"=>"請輸入0到10000的數字", "en"=>"Please enter a number between 0 and 10000"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "is_num"=>1, "range"=>[0, 10000], "right"=>0, "is_float"=>1, "revert_value"=>0, "map_values"=>[], "cancer_predict_mapping_file"=>BSON::ObjectId('5f8e6ded1d41c801f600013d'), "need_map_values"=>0},
|
||||
"4"=>{"variable"=>"calDH", "name"=>{"zh_tw"=>"降主動脈鈣化分數", "en"=>"Aorta descendens Calcification score"}, "hint"=>{"zh_tw"=>"請輸 入0到10000的數字", "en"=>"Please enter a number between 0 and 10000"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "is_num"=>1, "range"=>[0, 10000], "right"=>0, "is_float"=>1, "revert_value"=>0, "map_values"=>[], "cancer_predict_mapping_file"=>BSON::ObjectId('5f8e6ded1d41c801f600013e'), "need_map_values"=>0},
|
||||
"5"=>{"variable"=>"fat", "name"=>{"zh_tw"=>"脂肪分數", "en"=>"Fat"}, "hint"=>{"zh_tw"=>"請輸入20到408的數字", "en"=>"Please enter a number between 20 and 408"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "is_num"=>1, "range"=>[20, 408], "right"=>0, "is_float"=>1, "revert_value"=>0, "map_values"=>[], "cancer_predict_mapping_file"=>BSON::ObjectId('5f8e6ded1d41c801f600013f'), "need_map_values"=>0},
|
||||
"6"=>{"variable"=>"N4", "name"=>{"zh_tw"=>"腫瘤", "en"=>"Neoplasia"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"7"=>{"variable"=>"N12", "name"=>{"zh_tw"=>"癡呆症", "en"=>"Dementias"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"8"=>{"variable"=>"N20", "name"=>{"zh_tw"=>"慢性肝炎", "en"=>" Chronic hepatitis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"9"=>{"variable"=>"N31", "name"=>{"zh_tw"=>"垂體侏儒症", "en"=>" Pituitary dwarfism"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"10"=>{"variable"=>"O6", "name"=>{"zh_tw"=>"慢性腎病", "en"=>" Chronic Kidney Disease"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"11"=>{"variable"=>"N34", "name"=>{"zh_tw"=>"克羅恩病和潰瘍性結腸炎", "en"=>"Crohn's disease and ulcerative colitis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"12"=>{"variable"=>"N14", "name"=>{"zh_tw"=>"帕金森氏", "en"=>"Parkinson's disease"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"13"=>{"variable"=>"N26", "name"=>{"zh_tw"=>"多發性硬化症", "en"=>"Multiple sclerosis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>[" 有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"14"=>{"variable"=>"O3", "name"=>{"zh_tw"=>"高血壓", "en"=>"Multiple sclerosis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"15"=>{"variable"=>"O20", "name"=>{"zh_tw"=>"嚴重精神疾病", "en"=>"Severe mental illness"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"16"=>{"variable"=>"O18", "name"=>{"zh_tw"=>"類風溼關節炎", "en"=>"Rheumatoid arthritis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "cancer_predict_mapping_file"=>"", "need_map_values"=>0},
|
||||
"17"=>{"variable"=>"O11", "name"=>{"zh_tw"=>"非出血性腦血管疾病", "en"=>"Non-Hemorrhagic Cerebrovascular Disease"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"18"=>{"variable"=>"N29", "name"=>{"zh_tw"=>"強直性脊柱炎", "en"=>"Ankylosing spondylitis"}, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"19"=>{"variable"=>"N6", "name"=>{"zh_tw"=>"動脈血管", "en"=>"Arterial vasculopathy"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>["yes", "no"]}, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"20"=>{"variable"=>"O14", "name"=>{"zh_tw"=>"葡萄糖不耐症", "en"=>nil}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>nil}, "comment_text"=>{"zh_tw"=>"", "en"=>nil}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>nil}, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"21"=>{"variable"=>"N43", "name"=>{"zh_tw"=>"Basedow's disease", "en"=>nil}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>nil}, "comment_text"=>{"zh_tw"=>"", "en"=>nil}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>nil}, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"22"=>{"variable"=>"O17", "name"=>{"zh_tw"=>"偏頭痛", "en"=>nil}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>nil}, "comment_text"=>{"zh_tw"=>"", "en"=>nil}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>nil}, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0},
|
||||
"23"=>{"variable"=>"O9", "name"=>{"zh_tw"=>"心臟衰竭", "en"=>nil}, "hint"=>{"zh_tw"=>"", "en"=>nil}, "comment_text"=>{"zh_tw"=>"", "en"=>nil}, "choice_fields"=>{"zh_tw"=>["有", "沒有"], "en"=>nil}, "is_num"=>0, "range"=>[], "right"=>1, "is_float"=>0, "revert_value"=>1, "map_values"=>[], "need_map_values"=>0}
|
||||
}
|
||||
field :form_show_in_result , :type=> Hash ,default: {}
|
||||
field :form_result_is_right , :type=> Integer ,default: 0
|
||||
field :text_descibe ,type:Hash ,default:{"zh_tw"=>"歡迎使用台灣心血管疾病預後預測系統<br />本預測系統由全民健保資料庫2017年~2020年間共1964位病人電腦斷層影像所建立之預測模型<br />請在下方填入相關資訊","en"=>"Welcome to the Taiwan Breast Cancer Prediction System!<br/>The prediction system is constructed using clinical data from 90,841 breast cancer patients in the Taiwan Cancer Registry database between 2011 to 2015, and validated using clinical data from 49,374 breast cancer patients in the U.S.-based Surveillance, Epidemiology and End Results (SEER) database. <br/>To start, please select the information below."}
|
||||
field :text_descibe ,type:Hash ,default: {
|
||||
"zh_tw"=>"歡迎使用台灣心血管 疾病預後預測系統<br />\r\n本預測系統由全民健保資料庫2017年~2020年間共1700位病人電腦斷層影像所建立之預測模型<br />\r\n請 在下方填入相關資訊",
|
||||
"en"=>"Welcome to the Taiwan cardiovascular disease prognosis prediction System!<br />\r\nThe prediction system is a prediction model established by CT images of 1,700 patients form the National Health Insurance Database between 2017 to 2020.<br />\r\nTo start, please select the information below."
|
||||
}
|
||||
field :small ,type:Hash ,default:{'font_size'=>"0.825em",'active'=>0}
|
||||
field :medium ,type:Hash ,default:{'font_size'=>"1em",'active'=>1}
|
||||
field :large ,type:Hash ,default:{'font_size'=>"1.25em",'active'=>0}
|
||||
field :head_images_id ,type:Array , default: []
|
||||
field :title_images_id ,type:Array , default: []
|
||||
field :title_texts ,type:Hash ,default:{'zh_tw'=>'臺灣心血管疾病存活預測','en'=>'Cardiovascular Disease Survival Forecast in Taiwan'}
|
||||
field :table_above_texts ,type:Hash ,default:{'zh_tw'=>"下表之分析為針對手術後病人,根據選定的術後治療,分別估計在半年、一年及一年半的再住院或死亡機率。",'en'=>'The analysis is for women who had undergone surgery.The table shows the 0.5-, 1- and 1.5-year survival rates,based on the treatment you have selected.'}
|
||||
field :text_above_texts ,type:Hash ,default:{'zh_tw'=>"此研究分析來自於照射胸部電腦斷層所得之結果,根據您所輸入的資訊,在第{{years}}年內,有2.69%的機率可能再住院或死亡{{Surgery_only}}%。",'en'=>'此研究分析來自於照射胸部電腦斷層所得之結果,根據您所輸入的資訊,在第{{years}}年內,有2.69%的機率可能再住院或死亡{{Surgery_only}}%。'}
|
||||
field :surgery_only_texts ,type:Hash ,default:{'zh_tw'=>'','en'=>''}
|
||||
field :extra_texts ,type:Hash ,default:{'zh_tw'=>',此外','en'=>''}
|
||||
field :extra_therapy_texts ,type:Hash ,default:{'zh_tw'=>'100 位在術後有接受{{extra_therapy}}的婦女中,有{{survival_num}}位婦女,術後{{surgery_year}}年仍為存活(多了{{Additional_Benefit}}位)','en'=>'{{survival_num}} out of 100 women treated with {{extra_therapy}} are alive (an extra {{Additional_Benefit}})'}
|
||||
field :danger_texts ,type:Hash ,default:{'zh_tw'=>'請注意紅框的輸入資料是否符合要求!','en'=>'Please check whether input data in red blocks are correct!'}
|
||||
field :years ,type:Array ,default:[1,1.5,2,2.5]
|
||||
field :texts_between_Result_and_result_block ,type:Hash ,default:{'zh_tw'=>'如果欲將預測結果應用於臨床上,請務必與您的主治醫師討論後再做最後決定。','en'=>'Please note that the patients need to consult with their medical doctors before making any decision.'}
|
||||
field :title_texts ,type:Hash ,default: {"zh_tw"=>"臺灣心血管疾病存活預測", "en"=>"Cardiovascular Disease Survival Forecast in Taiwan"}
|
||||
field :table_above_texts ,type:Hash ,default: {"zh_tw"=>"下表之分析為針對手術後病人,根據選定的術後治療,分別估計在一年、一年半、兩年及兩年半的心血管疾病住院或死亡機率。", "en"=>"The analysis is for women who had undergone surgery.The table shows the 1,1.5, 2 and 2.5 year survival rates,based on the treatment you have selected."}
|
||||
field :text_above_texts ,type:Hash ,default: {"zh_tw"=>"此研究分析來自於照射胸部電腦斷層所得之結果,根據您所輸入的資訊,在第{{years}}年內,有{{Surgery_only}}%的 機率可能心血管疾病住院或死亡。", "en"=>"This research comes from the results obtained by irradiating the chest CT. According to the information you entered that you have the {{Surgery_only}}% of hospitalization or death for cardiovascular disease within {{years}} years."}
|
||||
field :surgery_only_texts ,type:Hash ,default: {"zh_tw"=>"", "en"=>""}
|
||||
field :extra_texts ,type:Hash ,default: {"zh_tw"=>",此外", "en"=>""}
|
||||
field :extra_therapy_texts ,type:Hash ,default: {"zh_tw"=>"100 位在術後有接受{{extra_therapy}}的婦女中,有{{survival_num}}位婦女,術後{{surgery_year}}年仍為存活(多了{{Additional_Benefit}}位)", "en"=>"{{survival_num}} out of 100 women treated with {{extra_therapy}} are alive (an extra {{Additional_Benefit}})"}
|
||||
field :danger_texts ,type:Hash ,default: {"zh_tw"=>"請注意紅框的輸入資料是否符合要求!", "en"=>"Please check whether input data in red blocks are correct!"}
|
||||
field :years ,type:Array ,default:[1, 1.5, 2, 2.5]
|
||||
field :texts_between_Result_and_result_block ,type:Hash ,default: {"zh_tw"=>"如果欲將預測結果應用於臨床上,請務必與您的主治醫師討論後再做最後決定。", "en"=>"Please note that the patients need to consult with their medical doctors before making any decision."}
|
||||
#field :image_uploader ,type:Object
|
||||
field :prediction_formula , type: String ,default: "A = 0.1327868* (sex_value- 0.4858824)
|
||||
|
||||
+ 0.0371720* (age_test1 - 61.56000) -0.07447278* (age_test2 - 13.10152)
|
||||
+ 0.0371720* (age_test1 - 61.56000) -0.07447278* (age_test2 - 13.10152)
|
||||
|
||||
+ 0.4315686* (age_test3 - 0.9844332)
|
||||
+ 0.4315686* (age_test3 - 0.9844332)
|
||||
|
||||
+ 0.0009163615*( calH_test1 - 182.9347)
|
||||
+ 0.0009163615*( calH_test1 - 182.9347)
|
||||
|
||||
-0.0007536899*( calH_test2 - 124.8706) -0.00004697183*( calH_test3 -80.75636)
|
||||
-0.0007536899*( calH_test2 - 124.8706) -0.00004697183*( calH_test3 -80.75636)
|
||||
|
||||
+ 0.0001401325*( calAH_test1 - 700.7824)
|
||||
+ 0.0001401325*( calAH_test1 - 700.7824)
|
||||
|
||||
-0.001349783*( calAH_test2 - 634.2167) +0.001753832*( calAH_test3 -419.3361)
|
||||
|
||||
-0.001349783*( calAH_test2 - 634.2167) +0.001753832*( calAH_test3 -419.3361)
|
||||
+ 0.0001906046*( calDH_test1 -835.2894) -0.000251567*( calDH_test2 - 213.1630)
|
||||
|
||||
+ 0.0001906046*( calDH_test1 -835.2894) -0.000251567*( calDH_test2 - 213.1630)
|
||||
-0.002173942*( fat_test1 -108.4149)+0.003066541*( fat_test2 - 28.33497)
|
||||
|
||||
+0.6700708*(N4-0.3241176)
|
||||
|
||||
-0.002173942*( fat_test1 -108.4149)+0.003066541*( fat_test2 - 28.33497)
|
||||
+0.3336162*(O3-0.4994118)
|
||||
|
||||
+0.6700708*(N4-0.3241176)
|
||||
+0.1322476*(O20-0.1741176)
|
||||
|
||||
+0.3336162*(O3-0.4994118)
|
||||
+0.9084972*(O18-0.008823529)
|
||||
|
||||
+0.1322476*(O20-0.1741176)
|
||||
+0.2978388*(N12-0.1152941)
|
||||
|
||||
+0.9084972*(O18-0.008823529)
|
||||
+0.1777935*(N20-0.3582353)
|
||||
|
||||
+0.2978388*(N12-0.1152941)
|
||||
+1.588042*(N31-0.002352941)
|
||||
|
||||
+0.1777935*(N20-0.3582353)
|
||||
+0.2197419*(O6-0.07823529)
|
||||
|
||||
+1.588042*(N31-0.002352941)
|
||||
+1.791159*(N34-0.001176471)
|
||||
|
||||
+0.2197419*(O6-0.07823529)
|
||||
+0.4305973*(N14-0.02176471)
|
||||
|
||||
+1.791159*(N34-0.001176471)
|
||||
-0.4472885*(N29-0.02411765)
|
||||
|
||||
+0.4305973*(N14-0.02176471)
|
||||
+0.2601319*(N26-0.04941176)
|
||||
|
||||
-0.4472885*(N29-0.02411765)
|
||||
-0.2364269*(O11-0.1164706)
|
||||
|
||||
+0.2601319*(N26-0.04941176)
|
||||
+0.1784179*(N6-0.1070588)
|
||||
|
||||
-0.2364269*(O11-0.1164706)
|
||||
+0.6023170*(O14-0.01294118)
|
||||
|
||||
+0.1784179*(N6-0.1070588)
|
||||
-1.031959*(N43-0.007058824)
|
||||
|
||||
+0.4257809*(O17-0.01823529)
|
||||
|
||||
+0.6023170*(O14-0.01294118)
|
||||
|
||||
-1.031959*(N43-0.007058824)
|
||||
|
||||
+0.4257809*(O17-0.01823529)
|
||||
|
||||
+0.2002546*(O9-0.06176471)"
|
||||
field :years_settings , type: Array , default: ["0.8095037^( exp(A) )","0.729158^( exp(A) )","0.6717211^( exp(A) )","0.6056773^( exp(A) )"]
|
||||
+0.2002546*(O9-0.06176471)"
|
||||
field :years_settings , type: Array , default: ["0.8095037^( exp(A) )", "0.729158^( exp(A) )", "0.6717211^( exp(A) )", "0.6056773^( exp(A) )"]
|
||||
field :tmp_years_settings , type: Array , default: []
|
||||
field :tmp_years_settings_for_ruby , type: Array , default: []
|
||||
field :hidden_variables, type: String, default: ""
|
||||
field :fix_hidden_variables, type: Array, default: []
|
||||
field :tmp_hidden_variables_for_ruby, type: String, default: ""
|
||||
field :tmp_hidden_variables_for_js, type: String, default: ""
|
||||
field :lpv_calc, type: Hash, default: {} #for js code
|
||||
field :tmp_lpv_ruby_code, type: String, default: ""
|
||||
field :tmp_lpv_variables, type: Array, default: []
|
||||
field :mapping_data_from_csv , type: String ,default: ""
|
||||
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
||||
scope :is_approved, ->{where(:approved => true)}
|
||||
field :all_variables, type: Array, default: []
|
||||
field :treatment_method, type: Array, default: ['Surgery_only']
|
||||
field :treatment_method_active_indices, type: Array, default: [1]
|
||||
field :result_table, type: String, default: "", localize: true
|
||||
field :result_text, type: String, default: "", localize: true
|
||||
field :therapy_lpv, type: Array, default: [0]
|
||||
#before_create :set_expire
|
||||
before_save do
|
||||
self.form_show.each do |num,property|
|
||||
|
@ -114,104 +140,174 @@ class Cancerpredictfields
|
|||
result_keys << variable_name
|
||||
end
|
||||
end
|
||||
self.form_show_in_result.each do |num,property|
|
||||
variable_name = property[:variable]
|
||||
if variable_name.present?
|
||||
result_keys << variable_name
|
||||
end
|
||||
end
|
||||
mapping_data = JSON.parse(self.mapping_data_from_csv) rescue {}
|
||||
if mapping_data.present?
|
||||
if self.advance_mode && mapping_data.present?
|
||||
mapping_data.each do |k,v|
|
||||
result_keys += (v.keys rescue [])
|
||||
end
|
||||
end
|
||||
formula = self.prediction_formula.gsub("\r\n"," ").gsub("^","**")
|
||||
result_keys = result_keys.uniq
|
||||
self.all_variables = result_keys
|
||||
formula = text_to_math(self.prediction_formula)
|
||||
tmp_hidden_variables = text_to_math(self.hidden_variables)
|
||||
result_keys.each do |k|
|
||||
formula = formula.gsub(/#{k}?(-|\+|\*|\/|\s|\=)/){ "result[\"#{k}\"]#{$1}" }
|
||||
formula = formula.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
|
||||
tmp_hidden_variables = tmp_hidden_variables.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
|
||||
end
|
||||
formula = formula.split(/^([^=]+)=([^=])/).select{|s| s.present?}.each_slice(2).map do |a,b|
|
||||
self.tmp_hidden_variables_for_js = tmp_hidden_variables.rstrip.gsub(/\n\s+/,"\n ").gsub("\n",";\n") + ";"
|
||||
self.fix_hidden_variables = []
|
||||
self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
|
||||
a = a.strip
|
||||
self.fix_hidden_variables << a
|
||||
if b
|
||||
("@"+ a + "=" + b)
|
||||
("result[\"#{a}\"]=" + b.gsub("\n",""))
|
||||
else
|
||||
"@"+ a
|
||||
a
|
||||
end
|
||||
end.join("\n")
|
||||
self.fix_hidden_variables = self.fix_hidden_variables.uniq
|
||||
formula = formula.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
|
||||
a = a.strip
|
||||
if b
|
||||
("result[\"#{a}\"]=" + b.gsub("\n",""))
|
||||
else
|
||||
a
|
||||
end
|
||||
end.join("\n")
|
||||
self.fix_hidden_variables.each do |v|
|
||||
formula = formula.gsub(/(\A|[^\w\"])#{v}($|[^\w])/){|f| "#{$1}result[\"#{v.strip}\"]#{$2}"}
|
||||
self.tmp_hidden_variables_for_ruby = self.tmp_hidden_variables_for_ruby.gsub(/(\A|[^\w\"])#{v}($|[^\w])/){|f| "#{$1}result[\"#{v.strip}\"]#{$2}"}
|
||||
end
|
||||
self.tmp_lpv_ruby_code = formula
|
||||
formula_variables = formula.enum_for(:scan,/([^\=\(\)]+)?=[^=]/).map {|x| x[-1] }.compact.map{|s| s.strip}
|
||||
formula_variables = formula.enum_for(:scan,/([^\=\(\)]+)?=[^=]/).map {|x| x[-1] }.compact.map{|s| s.strip[8..-3]}
|
||||
self.tmp_lpv_variables = formula_variables
|
||||
self.tmp_years_settings = self.years_settings.map do |s|
|
||||
s.gsub('^','**').gsub('exp','Math.exp')
|
||||
text_to_math(s)
|
||||
end
|
||||
self.tmp_years_settings_for_ruby = self.tmp_years_settings.clone
|
||||
formula_variables.each do |variable_name|
|
||||
self.tmp_years_settings_for_ruby = self.tmp_years_settings_for_ruby.map do |y|
|
||||
y.gsub(variable_name[1..-1],variable_name)
|
||||
y.gsub(variable_name,"result[\"#{variable_name}\"]")
|
||||
end
|
||||
end
|
||||
self.treatment_method = ['Surgery_only']
|
||||
self.form_show_in_result.values.each do |choice|
|
||||
variable = choice["variable"]
|
||||
if variable.present?
|
||||
self.treatment_method << variable
|
||||
end
|
||||
end
|
||||
tmp_table_translations = {}
|
||||
tmp_text_translations = {}
|
||||
@years = self.years
|
||||
# @head_name = ['Treatment','Additional_Benefit','Overall_Survival']
|
||||
@head_name = ['Treatment','Overall_Survival']
|
||||
@table_head = @head_name.map{|name| I18n.t('cancerpredict.table.'+name)}
|
||||
@therapy_names = self.treatment_method
|
||||
I18n.available_locales.each do |locale|
|
||||
I18n.with_locale(locale) do
|
||||
@therapy_choices = [I18n.t('cancerpredict.table.Surgeryonly')]
|
||||
self.form_show_in_result.values.each{|choice| @therapy_choices.push choice["name"][locale]}
|
||||
tmp_table = "<span class=\"result_title print_only\">#{I18n.t("cancerpredict.table.table")}</span><div style=\"clear: both\"></div>"
|
||||
tmp_table += '<input id="current_year" type="hidden" value="'+@years[0].to_s+'" index="0"/><p id="cancer_table_texts">'+self.table_above_texts[locale].to_s+'</p>'
|
||||
tmp_table += ('<a style="display: inline-block;">'+(locale.to_s == 'zh_tw' ? '第' : '')+'</a><a style="display: inline-block;">')
|
||||
@years.each{|year| tmp_table += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year.to_s+'</button>')}
|
||||
tmp_table += ('</a><a style="display: inline-block;">'+(locale == 'zh_tw' ? '年' : '')+'</a>')
|
||||
tmp_table += '<table><thead><tr>'
|
||||
@table_head.each_with_index{|head,index| tmp_table += ('<th class="cancer_th '+@head_name[index]+'">' + head + '</th>')}
|
||||
tmp_table += '</tr></thead><tbody>'
|
||||
@therapy_choices.each_with_index do |choice,i|
|
||||
tmp_table += '<tr class="'+@therapy_names[i].to_s+'">'
|
||||
@table_head.each_with_index do |head,index|
|
||||
tmp_table += ('<td class="cancer_td '+ @head_name[index]+'">' + ((index == 0) ? (((i==0)? '' : '+') + choice) : '-') + '</td>')
|
||||
end
|
||||
tmp_table += '</tr>'
|
||||
end
|
||||
tmp_table_translations[locale] = tmp_table
|
||||
@texts = self.text_above_texts[locale].to_s.gsub('<br/>','</span><br/><span>').gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival"></span>')
|
||||
@texts = @texts.split('{{years}}')
|
||||
@texts.delete('')
|
||||
tmp_text = "<span class=\"result_title print_only\">#{I18n.t("cancerpredict.table.text")}</span><div style=\"clear: both\"></div>"
|
||||
tmp_text += ('<span>'+@texts[0])
|
||||
@years.each{|year| tmp_text += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm" style="float:none;">'+year.to_s+'</button>')}
|
||||
if @texts.count > 1
|
||||
tmp_text += (@texts[1]+'</span>') if @texts.count > 1
|
||||
else
|
||||
tmp_text += '</span>'
|
||||
end
|
||||
if !self.surgery_only_texts[locale].blank?
|
||||
@surgery_only_texts = self.surgery_only_texts[locale]
|
||||
@surgery_only_texts.insert(0,'<p class="show"><span>')
|
||||
@surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival"></span><span>')
|
||||
@surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}','</span><span class="surgery_year">'+@years[-1].to_s+'</span><span>')
|
||||
@surgery_only_texts += '</span>'
|
||||
else
|
||||
@surgery_only_texts = ''
|
||||
end
|
||||
tmp_text += @surgery_only_texts
|
||||
tmp_text += '<span class="addition">'+self.extra_texts[locale]+'</span><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div></div></p>'
|
||||
tmp_text_translations[locale] = tmp_text
|
||||
end
|
||||
end
|
||||
self.result_table_translations = tmp_table_translations
|
||||
self.result_text_translations = tmp_text_translations
|
||||
self.treatment_method_active_indices = [1]
|
||||
self.form_show_in_result.each do |num, property|
|
||||
v = property[:active_choice]
|
||||
if v.present?
|
||||
self.treatment_method_active_indices << (v - 1)
|
||||
else
|
||||
self.treatment_method_active_indices << 1
|
||||
end
|
||||
end
|
||||
self.lpv_calc = get_years_settings_dict
|
||||
self.generate_eval_formula
|
||||
end
|
||||
def generate_eval_formula
|
||||
eval_hidden_variables = "def eval_hidden_variables(result); #{self.tmp_hidden_variables_for_ruby}; end"
|
||||
CancerpredictsController.module_eval(eval_hidden_variables)
|
||||
eval_formula = "def eval_formula(result); #{self.tmp_lpv_ruby_code}; end"
|
||||
CancerpredictsController.module_eval(eval_formula)
|
||||
end
|
||||
def update_user
|
||||
User.find(update_user_id) rescue nil
|
||||
end
|
||||
def update_user=(user)
|
||||
self.update_user_id = user.id
|
||||
end
|
||||
def email_members
|
||||
MemberProfile.find(self.email_member_ids) rescue []
|
||||
end
|
||||
def email_addresses
|
||||
addresses = self.email_members.collect{|member| member.email} rescue []
|
||||
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
|
||||
addresses.flatten
|
||||
end
|
||||
def email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
end
|
||||
def expired?
|
||||
(self.deadline < Time.now) rescue false
|
||||
end
|
||||
def destroy_email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
mail.destroy if !mail.nil?
|
||||
end
|
||||
def self.remove_expired_status
|
||||
self.where(:is_top => true, :top_end_date.ne => nil, :top_end_date.lt => Time.now).each do |b|
|
||||
b.is_top = false
|
||||
b.top_end_date = nil
|
||||
b.save
|
||||
end
|
||||
end
|
||||
def generate_jscode
|
||||
js_code = "var map_values , mapping_hash , temp_index ,temp_value , index , closest_value;\r\n"
|
||||
mapping_data_from_csv = YAML.load(self.mapping_data_from_csv) rescue {}
|
||||
variable_keys = []
|
||||
self.form_show.each do |num,property|
|
||||
mapping_data_from_csv = JSON.parse(self.mapping_data_from_csv) rescue {}
|
||||
tmp_hash = self.form_show.values + self.form_show_in_result.values
|
||||
tmp_hash.each do |property|
|
||||
@variable = property[:variable]
|
||||
if @variable.present?
|
||||
if property[:is_num] == 1
|
||||
js_code += "\t\t\t\tresult['#{@variable}'] = Number(result_json['#{@variable}']);\r\n"
|
||||
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']);\r\n"
|
||||
elsif property[:choice_fields].present?
|
||||
if property[:need_map_values] == 1
|
||||
js_code += "\t\t\t\tmap_values = #{property[:map_values]};\r\n"
|
||||
js_code += "\t\t\t\tresult['#{@variable}'] = map_values[Number(result_json['#{@variable}'']) - 1];\r\n"
|
||||
if !(self.advance_mode)
|
||||
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']);\r\n"
|
||||
else
|
||||
if property[:revert_value] != 1
|
||||
js_code += "\t\t\t\tresult['#{@variable}'] = Number(result_json['#{@variable}']) - 1;\r\n"
|
||||
if property[:need_map_values] == 1
|
||||
js_code += " map_values = #{property[:map_values]};\r\n"
|
||||
js_code += " result['#{@variable}'] = map_values[Number(result_json['#{@variable}'']) - 1];\r\n"
|
||||
else
|
||||
js_code += "\t\t\t\tresult['#{@variable}'] = (#{property[:choice_fields].length} - Number(result_json['#{@variable}']));\r\n"
|
||||
if property[:revert_value] != 1
|
||||
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']) - 1;\r\n"
|
||||
else
|
||||
js_code += " result['#{@variable}'] = (#{property[:choice_fields].length} - Number(result_json['#{@variable}']));\r\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
variable_keys.push(@variable)
|
||||
if property[:cancer_predict_mapping_file].present?
|
||||
if self.advance_mode && property[:cancer_predict_mapping_file].present?
|
||||
if (mapping_data_from_csv != {} && !mapping_data_from_csv[@variable].blank?)
|
||||
variable_keys.concat(mapping_data_from_csv[@variable].keys)
|
||||
js_code += "\t\t\t\tmapping_hash = mapping_data_from_csv['#{@variable}'];\r\n"
|
||||
js_code += "\t\t\t\ttemp_index = 0;\r\n"
|
||||
js_code += "\t\t\t\ttemp_value = result[#{@variable}];\r\n"
|
||||
js_code += "\t\t\t\tindex = 0;
|
||||
js_code += " mapping_hash = mapping_data_from_csv['#{@variable}'];\r\n"
|
||||
js_code += " temp_index = 0;\r\n"
|
||||
js_code += " temp_value = result['#{@variable}'];\r\n"
|
||||
js_code += " index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( i == 0 ){
|
||||
if( index == 0 ){
|
||||
var index_val = v.indexOf(temp_value);
|
||||
if( index_val != -1 ){
|
||||
temp_index = index_val;
|
||||
|
@ -227,29 +323,37 @@ class Cancerpredictfields
|
|||
end
|
||||
end
|
||||
end
|
||||
formula = self.prediction_formula.gsub("\r\n"," ").gsub("^","**")
|
||||
variable_keys.each do |k|
|
||||
formula = formula.gsub(/#{k}?(-|\+|\*|\s|\=)/){ "result[\"#{k}\"]#{$1}" }
|
||||
js_code += "\n Object.keys(result).forEach(function(k){
|
||||
if(Number.isNaN(result[k])){
|
||||
result[k] = 0;
|
||||
}
|
||||
})"
|
||||
js_code += "\n #{self.tmp_hidden_variables_for_js}"
|
||||
formula = text_to_math(self.prediction_formula)
|
||||
self.all_variables.each do |k|
|
||||
formula = formula.gsub(/#{k}?(-|\+|\*|\s|\=)/){ "result[\"#{k.strip}\"]#{$1}" }
|
||||
end
|
||||
formula_variables = formula.enum_for(:scan,/([^\=]*)?=/).map { ::Regexp.last_match[1] }.map{|s| s.strip.split(/(\s*|;\r\n)/).last}
|
||||
js_code = "function calculate_first_lpv(result_json){
|
||||
formula_variables = self.tmp_lpv_variables.map{|v| v}
|
||||
js_code = "\n function calculate_first_lpv(result_json){
|
||||
result = {};
|
||||
#{js_code}
|
||||
try{
|
||||
result['lpv'] = (#{formula.gsub(/\s{2,10}/," ")});
|
||||
}catch(e){result['lpv'] = \"error\"};
|
||||
console.log(result['lpv']);
|
||||
#{formula_variables.map{|v| "result['lpv_variable']['#{v}'] = #{v};"}.join("\r\n\t\t\t\t") }
|
||||
#{formula.gsub(/\s{2,10}/," ").gsub("\n","\n ")}
|
||||
}catch(e){console.log(e)};
|
||||
result['lpv_variable'] = {};
|
||||
#{formula_variables.map{|v| "result['lpv_variable']['#{v}'] = #{v};"}.join("\n ") }
|
||||
result['lpv'] = #{formula_variables.count == 0 ? 0 : formula_variables.last};
|
||||
result['lpv_variable']['lpv'] = result['lpv'];
|
||||
return result;
|
||||
};
|
||||
function calculate_and_change_result_value(obj){
|
||||
obj.servive_ratio_arr = [];
|
||||
for(var i = 0;i<obj.active_treatment.length;i++){
|
||||
var servive_ratio = round((1-(calculate_servive_ratio(obj.year,obj.lpv_real[i])))*100,2);
|
||||
var servive_ratio = round((1 - calculate_servive_ratio(obj.year,obj.lpv_real[i]))*100,2);
|
||||
var benefit = servive_ratio - obj.servive_ratio_arr[obj.servive_ratio_arr.length-1];
|
||||
obj.servive_ratio_arr.push(servive_ratio);
|
||||
$('tr.'+obj.active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(servive_ratio);
|
||||
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
|
||||
if(i != 0){
|
||||
$('tr.'+obj.active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||
$('.'+obj.active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
|
||||
|
@ -266,7 +370,7 @@ class Cancerpredictfields
|
|||
switch_texts +=
|
||||
"
|
||||
case '#{year}':
|
||||
servive_ratio = #{self.tmp_years_settings[year_index]};
|
||||
servive_ratio = #{text_to_math(self.years_settings[year_index])};
|
||||
break;"
|
||||
end
|
||||
switch_texts += "
|
||||
|
@ -282,22 +386,79 @@ class Cancerpredictfields
|
|||
"
|
||||
return js_code
|
||||
end
|
||||
def text_to_math(text)
|
||||
text.gsub("\r\n","\n").gsub('^','**').gsub('exp','Math.exp').gsub('log','Math.log')
|
||||
end
|
||||
def replace_str_with_idx(org_str,st, ed, replace_str)
|
||||
org_str.slice!(st, ed - st + 1)
|
||||
org_str.insert(st, replace_str)
|
||||
org_str
|
||||
end
|
||||
def auto_write_predict_js
|
||||
js_codes = generate_jscode
|
||||
module_app_path = Pathname.new(File.expand_path(__dir__)).dirname.dirname.to_s
|
||||
save_path = module_app_path + '/app/assets/javascripts/cancer_predict.js'
|
||||
file_texts = File.read(save_path)
|
||||
need_write = false
|
||||
str1 = "/* auto add start */"
|
||||
index1 = file_texts.index(str1)
|
||||
str2 = "/* auto add end */"
|
||||
index2 = file_texts.index(str2)
|
||||
if (!index1.nil? && !index2.nil?)
|
||||
file_texts = replace_str_with_idx(file_texts, index1 + str1.length, index2 - 1, js_codes)
|
||||
need_write = true
|
||||
end
|
||||
str3 = "/*lpv_calc_formula_start*/"
|
||||
index3 = file_texts.index(str3)
|
||||
str4 = "/*lpv_calc_formula_end*/"
|
||||
index4 = file_texts.index(str4)
|
||||
file_texts = file_texts.sub(file_texts[(index1+str1.length+2) .. (index2 - 1)] , js_codes)
|
||||
file_texts = file_texts.sub(file_texts[(index3+str3.length) .. (index4 - 1)] , self.lpv_calc.to_json.gsub("@","."))
|
||||
if (!index1.nil? && !index2.nil?) || (!index3.nil? && !index4.nil?)
|
||||
if (!index3.nil? && !index4.nil?)
|
||||
file_texts = replace_str_with_idx(file_texts, index3 + str3.length, index4 - 1, self.lpv_calc.to_json.gsub("@",".") + ';')
|
||||
need_write = true
|
||||
end
|
||||
tmp_disable_jscodes = ""
|
||||
str5 = "/*disable_condition start*/"
|
||||
index5 = file_texts.index(str5)
|
||||
str6 = "/*disable_condition end*/"
|
||||
index6 = file_texts.index(str6)
|
||||
self.form_show_in_result.each do |num,property|
|
||||
if property[:disable_condition].present?
|
||||
tmp = property[:disable_condition].clone
|
||||
self.all_variables.each do |k|
|
||||
tmp = tmp.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}post_json[\"#{k}\"]#{$2}" }
|
||||
end
|
||||
variable = property[:variable]
|
||||
tmp_disable_jscodes += "\n if(#{tmp}){
|
||||
$('##{variable} .cancer_table_btn').attr('disabled','disabled');
|
||||
$('[for=\"#{variable}\"]').css('color','rgb(204, 204, 204)');
|
||||
}else{
|
||||
$('##{variable} .cancer_table_btn').removeAttr('disabled');
|
||||
$('[for=\"#{variable}\"]').css('color','');
|
||||
}"
|
||||
end
|
||||
end
|
||||
if (!index5.nil? && !index6.nil?)
|
||||
tmp_disable_jscodes += "\n\t\t\t"
|
||||
file_texts = replace_str_with_idx(file_texts, index5 + str5.length, index6 - 1, tmp_disable_jscodes)
|
||||
need_write = true
|
||||
end
|
||||
str7 = "/*therapy_lpv start*/"
|
||||
index7 = file_texts.index(str7)
|
||||
str8 = "/*therapy_lpv end*/"
|
||||
index8 = file_texts.index(str8)
|
||||
self.therapy_lpv = [0]
|
||||
self.form_show_in_result.each do |num,property|
|
||||
if property[:lpv_impact].present?
|
||||
self.therapy_lpv << property[:lpv_impact]
|
||||
else
|
||||
self.therapy_lpv << 0
|
||||
end
|
||||
end
|
||||
if (!index7.nil? && !index8.nil?)
|
||||
file_texts = replace_str_with_idx(file_texts, index7 + str7.length, index8 - 1, self.therapy_lpv.to_s + ';')
|
||||
need_write = true
|
||||
end
|
||||
if need_write
|
||||
File.write(save_path,file_texts)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,10 +17,11 @@ wb.add_worksheet(name: "school_class") do |sheet|
|
|||
temp_row << result.created_at.to_s
|
||||
result.result.each do |key,value|
|
||||
if key != "locale"
|
||||
if result.values[key][I18n.locale.to_s].length == 0
|
||||
if (result.values[key][I18n.locale.to_s].length == 0 rescue true)
|
||||
temp_row << value
|
||||
else
|
||||
temp_row << (result.values[key][I18n.locale.to_s][value.to_i-1] rescue value)
|
||||
v = result.values[key][I18n.locale.to_s][value.to_i-1] rescue nil
|
||||
temp_row << (v.nil? ? value : v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,38 +2,36 @@
|
|||
<td class="remove_div">❌</td>
|
||||
<td class="sort_div"></td>
|
||||
<% keys.each do |key| %>
|
||||
<td class="<%=key%>">
|
||||
<% if key.include? "_file" %>
|
||||
<td>
|
||||
<%= render :partial => 'form_file', :object => (CancerPredictMappingFile.where(:id=> property[key]).first rescue nil), :locals => {:f => make_fields, :key=>key} %>
|
||||
</td>
|
||||
<%= render :partial => 'form_file', :object => (CancerPredictMappingFile.where(:id=> property[key]).first rescue nil), :locals => {:f => make_fields, :key=>key} %>
|
||||
<% else %>
|
||||
<% value = property[key] %>
|
||||
<% if property == {} %>
|
||||
<% value_type = Cancerpredictfields::FIELDINFO[key].constantize rescue String %>
|
||||
<% value = "[]" if value_type == Array %>
|
||||
<% else %>
|
||||
<% value_type = value.class %>
|
||||
<% end %>
|
||||
<% value_type = Cancerpredictfields::FIELDINFO[key] %>
|
||||
<% value = "[]" if property == {} && value_type == 'Array' %>
|
||||
<% is_localized = Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||
<% @value= value %>
|
||||
<% if value_type == BSON::Document || value_type == Hash %>
|
||||
<% if is_localized %>
|
||||
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
|
||||
<%else%>
|
||||
<% @disp_value = @value %>
|
||||
<%end%>
|
||||
<% if value_type == Fixnum %>
|
||||
<% field_type = ((value_type == 'String' || value_type == 'Array' || value_type == 'Float') ? "text_field" : value_type) %>
|
||||
<% if value_type == 'Fixnum' %>
|
||||
<% if @value == 1%>
|
||||
<td><%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%>
|
||||
<% else%>
|
||||
<td><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%>
|
||||
<%end%>
|
||||
<% elsif Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||
<% elsif is_localized %>
|
||||
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
||||
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%= locale_fields.send(field_type, key,{:value=>@disp_value}) %>
|
||||
<%end%>
|
||||
<% else %>
|
||||
<td><%= make_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%= make_fields.send(field_type, key,{:value=>@disp_value})%>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</td>
|
||||
<%end%>
|
||||
<td><%= make_fields.hidden_field :old_num,:value=>num.to_s %></td>
|
||||
</tr>
|
|
@ -1,4 +1,5 @@
|
|||
<%= stylesheet_link_tag "lib/fileupload"%>
|
||||
<%= stylesheet_link_tag "lib/togglebox"%>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%#= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
|
@ -26,7 +27,53 @@
|
|||
.remove_div:hover{
|
||||
font-size: 1.3em;
|
||||
}
|
||||
<% Cancerpredictfields::AdvanceFields.each do |field| %>
|
||||
table .<%=field%>{
|
||||
display: none;
|
||||
}
|
||||
table.advance_mode .<%=field%>{
|
||||
display: block;
|
||||
}
|
||||
<% end%>
|
||||
.solid_line_hr{
|
||||
margin: 0.3em;
|
||||
border-top: 0.2em dashed;
|
||||
}
|
||||
.sort_table input, .sort_table textarea{
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.advance_mode_help_btn{
|
||||
float:left;
|
||||
cursor: pointer;
|
||||
padding: 0em 0.475em;
|
||||
font-size: 1.25em;
|
||||
border-radius: 1.5em;
|
||||
background-color: rgb(210, 106, 2);
|
||||
border-color: rgb(210, 106, 2);
|
||||
color: white;
|
||||
width: 1.8em;
|
||||
height: 1.8em;
|
||||
line-height: 1em;
|
||||
}
|
||||
</style>
|
||||
<div id="show_advance_mode_modal" class="modal fade">
|
||||
<div class='modal-dialog'>
|
||||
<div class='modal-content'>
|
||||
<div class='modal-header'>
|
||||
<button type='button' aria-hidden='true' class='close'>×</button>
|
||||
<h4 class='modal-title'>
|
||||
<%= t("cancerpredict.module_mode") %>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= t("cancerpredict.advance_mode_hint2").html_safe %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
|
||||
<span class="show_span"><%= t('cancerpredict.title') %></span>
|
||||
|
@ -181,17 +228,28 @@
|
|||
<%end%>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<span class="show_span"><%= t('cancerpredict.module_mode') %></span>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="advance_mode" style="float: left; line-height: 30px;margin-right: 1em;">
|
||||
<span style="float: left;"><%= t('cancerpredict.advance_mode') %></span>
|
||||
<button type="button" class="advance_mode_help_btn" data-target="#show_advance_mode_modal"><i aria-hidden="true" class="fa fa-question"></i></button>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input id="advance_mode" name="<%=form.object_name%>[advance_mode]" type="checkbox" class="toggle-check" data-disabled="<%=form.object.advance_mode == false%>">
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<span class="show_span"><%= t('cancerpredict.Input_fields') %></span>
|
||||
<div style="clear:both;"></div>
|
||||
<table id="fields_table" class="sort_table">
|
||||
<% keys = @form_to_show.form_show.values[0].keys rescue [] %>
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys if keys.blank? %>
|
||||
<table id="fields_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<% keys.each do |key|%>
|
||||
<th><%=t("cancerpredict.table.#{key}")%></th>
|
||||
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
||||
<%end%>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -228,15 +286,14 @@
|
|||
<% end %>
|
||||
<div style="clear:both;"></div>
|
||||
<% end %>
|
||||
<table id="therapies_table" class="sort_table">
|
||||
<table id="therapies_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<% keys = @form_to_show.form_show_in_result.values[0].keys rescue [] %>
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys if keys.blank? %>
|
||||
<% keys = Cancerpredictfields::TherapyFields %>
|
||||
<% keys.each do |key,vlaue|%>
|
||||
<th><%=t("cancerpredict.table.#{key}")%></th>
|
||||
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
||||
<%end%>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -244,38 +301,7 @@
|
|||
<%= form.fields_for :form_show_in_result do |formfield|%>
|
||||
<% @form_to_show.form_show_in_result.each do |num,property| %>
|
||||
<%=formfield.fields_for num.to_s do |make_fields|%>
|
||||
<tr>
|
||||
<td class="remove_div">❌</td>
|
||||
<td class="sort_div"></td>
|
||||
<% property.each do |key,value|%>
|
||||
<% if key.include? "_file" %>
|
||||
<td>
|
||||
<%= render :partial => 'form_file', :object => (CancerPredictMappingFile.where(:id=> property[key]).first rescue nil), :locals => {:f => make_fields, :key=>key} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<% @value= value %>
|
||||
<% if @value.class == BSON::Document || @value.class == Hash %>
|
||||
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
|
||||
<%else%>
|
||||
<% @disp_value = @value %>
|
||||
<%end%>
|
||||
<% if Cancerpredictfields::FIELDINFO[key] == "Fixnum" %>
|
||||
<% if @value == 1%>
|
||||
<td><%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<% else%>
|
||||
<td><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<%end%>
|
||||
<% elsif Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
||||
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%end%>
|
||||
<% else %>
|
||||
<td><%= make_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<td><%= make_fields.hidden_field :old_num,:value=>num.to_s %></td>
|
||||
</tr>
|
||||
<%= render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>property,:num=>num,:keys => Cancerpredictfields::TherapyFields} %>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<%end%>
|
||||
|
@ -285,23 +311,32 @@
|
|||
<div style="clear:both;"></div>
|
||||
<span class="show_span"><%=t('cancerpredict.table.calculate_settings')%></span>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="control-group">
|
||||
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
||||
<label><%= t('cancerpredict.hidden_variables') %></label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<%= form.text_area :hidden_variables, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="control-group">
|
||||
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
||||
<label><%= t('cancerpredict.table.prediction_formula') %></label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<%= form.text_area :prediction_formula, :rows=>"5", :style=> 'width: calc(100% - 12em);' %>
|
||||
<%= form.text_area :prediction_formula, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="years_settings">
|
||||
<% years = @form_to_show.years %>
|
||||
<% years.each_with_index do |year,i| %>
|
||||
<div data-year="<%= year.to_s.strip %>">
|
||||
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
||||
<label>P(t=<%=year%>) <%=year%> Year</label>
|
||||
<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">
|
||||
<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t=<%=year%> Year)</label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<textarea name="<%= form.object_name %>[years_settings][]" style= "width: calc(100% - 12em);" value="<%= @form_to_show.years_settings[i] rescue '' %>"><%= @form_to_show.years_settings[i] rescue '' %></textarea>
|
||||
<textarea name="<%= form.object_name %>[years_settings][]" style= "width: calc(100% - 16em);" value="<%= @form_to_show.years_settings[i] rescue '' %>"><%= @form_to_show.years_settings[i] rescue '' %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -310,6 +345,19 @@
|
|||
<%end%>
|
||||
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
|
||||
<script>
|
||||
$(".advance_mode_help_btn").click(function(){
|
||||
$("#show_advance_mode_modal").modal();
|
||||
})
|
||||
$("#show_advance_mode_modal button").click(function(){
|
||||
$("#show_advance_mode_modal").modal("hide");
|
||||
})
|
||||
$("#advance_mode").click(function(){
|
||||
if(window.confirm("<%=t('cancerpredict.advance_mode_hint1').gsub("\n","\\n")%>")){
|
||||
$("#fields_table,#therapies_table").toggleClass("advance_mode");
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
})
|
||||
$('.text_choice').click(function(){
|
||||
$('.text_choice').prop('checked' , false);
|
||||
$(this).prop('checked' , true);
|
||||
|
@ -319,8 +367,7 @@
|
|||
<%= fields_for :cancerpredictfields do |form|%>
|
||||
<%= form.fields_for :form_show do |formfield|%>
|
||||
<%=formfield.fields_for :new_index do |make_fields|%>
|
||||
<% keys = @form_to_show.form_show.values[0].keys rescue [] %>
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys if keys.blank? %>
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
||||
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
||||
$("#fields_table tbody").append(html.replaceAll('new_index',index));
|
||||
<% end %>
|
||||
|
@ -337,8 +384,7 @@
|
|||
<%= fields_for :cancerpredictfields do |form|%>
|
||||
<%= form.fields_for :form_show_in_result do |formfield|%>
|
||||
<%=formfield.fields_for :new_index do |make_fields|%>
|
||||
<% keys = @form_to_show.form_show_in_result.values[0].keys rescue [] %>
|
||||
<% keys = Cancerpredictfields::FIELDINFO.keys if keys.blank? %>
|
||||
<% keys = Cancerpredictfields::TherapyFields %>
|
||||
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
||||
$("#therapies_table tbody").append(html.replaceAll('new_index',index));
|
||||
<% end %>
|
||||
|
@ -401,11 +447,11 @@
|
|||
years.forEach(function(year){
|
||||
if($("#years_settings [data-year='"+year+"']").length == 0){
|
||||
var year_text = ('<div data-year="'+year+'">'+
|
||||
'<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">'+
|
||||
'<label> P(t='+year+') '+year+' Year</label>'+
|
||||
'<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">'+
|
||||
'<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t='+year+' Year)</label>'+
|
||||
'</div>'+
|
||||
'<div class="controls">'+
|
||||
'<textarea name="cancerpredictfields[years_settings][]" style= "width: calc(100% - 12em);"></textarea>'+
|
||||
'<textarea name="cancerpredictfields[years_settings][]" style= "width: calc(100% - 16em);"></textarea>'+
|
||||
'</div>'+
|
||||
'</div>');
|
||||
if(index != 0){
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<% if result.values[key][I18n.locale.to_s].length == 0 %>
|
||||
<td><%= value.to_s %></td>
|
||||
<% else %>
|
||||
<td><%= result.values[key][I18n.locale.to_s][value.to_i-1] rescue value %></td>
|
||||
<td><% v = result.values[key][I18n.locale.to_s][value.to_i-1] rescue nil %><%= v.nil? ? value : v %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%end%>
|
||||
|
|
|
@ -1,37 +1,40 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: cancerpredict 0.0.1 ruby lib
|
||||
insert_flag = 0
|
||||
app_path = File.expand_path(__dir__)
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
puts 'copying module'
|
||||
check_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"%>'
|
||||
edit_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%>'
|
||||
all_template.each do |folder|
|
||||
if !folder.include?('mobile')
|
||||
begin
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
system ('cp -r '+ app_path + '/modules/. ' + folder+'/modules/.')
|
||||
puts "finish copy module cancerpredict to #{folder}"
|
||||
rescue
|
||||
puts 'error copy'
|
||||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||
if bundle_update_flag
|
||||
insert_flag = 0
|
||||
app_path = File.expand_path(__dir__)
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
puts 'copying module'
|
||||
check_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"%>'
|
||||
edit_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%>'
|
||||
all_template.each do |folder|
|
||||
if !folder.include?('mobile')
|
||||
begin
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
system ('cp -r '+ app_path + '/modules/. ' + folder+'/modules/.')
|
||||
puts "finish copy module cancerpredict to #{folder}"
|
||||
rescue
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
texts = File.read(folder+'partial/_head.html.erb')
|
||||
insert_flag = 0
|
||||
if texts.include?(check_texts)
|
||||
texts = texts.gsub(check_texts,edit_texts)
|
||||
insert_flag = 1
|
||||
end
|
||||
if insert_flag == 1
|
||||
puts 'editing _head.html.erb'
|
||||
f = File.open(folder+'partial/_head.html.erb','w')
|
||||
f.write(texts)
|
||||
f.close
|
||||
end
|
||||
rescue
|
||||
puts "not found _head.html.erb in #{folder}"
|
||||
end
|
||||
texts = File.read(folder+'partial/_head.html.erb')
|
||||
insert_flag = 0
|
||||
if texts.include?(check_texts)
|
||||
texts = texts.gsub(check_texts,edit_texts)
|
||||
insert_flag = 1
|
||||
end
|
||||
if insert_flag == 1
|
||||
puts 'editing _head.html.erb'
|
||||
f = File.open(folder+'partial/_head.html.erb','w')
|
||||
f.write(texts)
|
||||
f.close
|
||||
end
|
||||
rescue
|
||||
puts "not found _head.html.erb in #{folder}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,12 @@ en:
|
|||
module_name:
|
||||
cancerpredict: Cardiovascular Disease Survival Forecast in Taiwan Tool
|
||||
cancerpredict:
|
||||
hidden_variables: "Hidden Variables"
|
||||
advance_mode_hint1: "After opening advance mode,calculation will change!\nAre you sure switch to advance mode?"
|
||||
advance_mode_hint2: "一般模式: 選項設定在計算時對應到的值由1開始。(例如: 選項設定為[\"是\",\"否\"],則\"是\"在計算時對應到1,而\"否\"在計算時對應到2)。<br><hr class=\"solid_line_hr\">進階模式: 選項設定在計算時對應到的值由0開始。<br>而若開啟選項值從大到小,則0對應到選項設定中的最後一項。<br>選項對應到的值的意思為當前述的計算值為0時,則對應到定義的Array的第1個元素的值,以此類推。<br>欄位對應檔案可上傳一個csv檔案,在計算時,會先依照csv中的第1直行,找到對應的變數1(生成的變數名稱為csv中的第1列)的值,其餘生成的變數值則為對應之後的同一橫列的值。"
|
||||
module_mode: Module Mode
|
||||
advance_mode: Advance Mode
|
||||
Overall_Survival: Probability
|
||||
cancerpredict: Adjust Cardiovascular Disease Survival Forecast in Taiwan Tool
|
||||
submitResult: see submit results of the users
|
||||
result_is_right: Is therapy choices in the right hand side of result block?
|
||||
|
@ -58,4 +64,6 @@ en:
|
|||
curve: Curves
|
||||
text: Texts
|
||||
Therapy_choice: Treatment options
|
||||
|
||||
lpv_impact: "lpv Impact(Input: Float)"
|
||||
active_choice: "Active choice(input 1 present choice 1 is regarded as therapy enable)"
|
||||
disable_condition: "Disable Condition"
|
|
@ -2,6 +2,12 @@ zh_tw:
|
|||
module_name:
|
||||
cancerpredict: 臺灣心血管疾病存活預測工具
|
||||
cancerpredict:
|
||||
hidden_variables: "隱藏的變數"
|
||||
advance_mode_hint1: "開啟進階模式後,計算方式有差異。\n您確定要開啟進階模式?"
|
||||
advance_mode_hint2: "一般模式: 選項設定在計算時對應到的值由1開始。(例如: 選項設定為[\"是\",\"否\"],則\"是\"在計算時對應到1,而\"否\"在計算時對應到2)。<br><hr class=\"solid_line_hr\">進階模式: 選項設定在計算時對應到的值由0開始。<br>而若開啟選項值從大到小,則0對應到選項設定中的最後一項。<br>選項對應到的值的意思為當前述的計算值為0時,則對應到定義的Array的第1個元素的值,以此類推。<br>欄位對應檔案可上傳一個csv檔案,在計算時,會先依照csv中的第1直行,找到對應的變數1(生成的變數名稱為csv中的第1列)的值,其餘生成的變數值則為對應之後的同一橫列的值。"
|
||||
module_mode: 模組模式
|
||||
advance_mode: 進階模式
|
||||
Overall_Survival: Probability
|
||||
cancerpredict: 臺灣心血管疾病存活預測工具調整
|
||||
submitResult: 查看用戶繳交表單結果
|
||||
result_is_right: 治療選項在結果的右邊?
|
||||
|
@ -49,7 +55,7 @@ zh_tw:
|
|||
Treatment: Event(事件)
|
||||
Additional_Benefit: 額外治療效益
|
||||
Overall_Survival: Probability(機率)(%)
|
||||
Surgeryonly: 心血管疾病住院或死亡
|
||||
Surgeryonly: 純手術
|
||||
Hormonetherapy: 賀爾蒙治療
|
||||
Chemotherapy: 化學治療
|
||||
years: 年
|
||||
|
@ -68,10 +74,12 @@ zh_tw:
|
|||
right: 顯示在右側
|
||||
is_float: 可輸入小數
|
||||
revert_value: 選項值從大到小(ex:有兩個選項,則選項值依序為1和0)
|
||||
map_values: 選項對應到的值(若無,則使用初始值)
|
||||
map_values: 選項對應到的值(若無,則會使用初始值)
|
||||
cancer_predict_mapping_file: 欄位對應檔案
|
||||
calculate_settings: 計算設定
|
||||
prediction_formula: 預測公式
|
||||
add_field: 新增填寫欄位
|
||||
add_therapy: 新增治療選項
|
||||
|
||||
lpv_impact: "lpv 影響(輸入浮點數)"
|
||||
active_choice: "啟用治療選項(輸入1代表第1個選項視為啟用治療)"
|
||||
disable_condition: "禁用條件"
|
|
@ -2,6 +2,7 @@ Rails.application.routes.draw do
|
|||
Thread.new do
|
||||
c = Cancerpredictfields.last
|
||||
if c
|
||||
sleep(5)
|
||||
c.save
|
||||
c.auto_write_predict_js
|
||||
end
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
<script type="text/javascript" src="/assets/cancer_predict.js"></script>
|
||||
{{table}}
|
||||
<link href="/assets/cancer_predict.scss" media="screen" rel="stylesheet">
|
||||
<link href="/assets/bootstrap.min.print.css" media="print" rel="stylesheet">
|
||||
<link href="/assets/cancer_predict_print.scss" media="print" rel="stylesheet">
|
||||
<%= stylesheet_link_tag "bootstrap.min.print", media: "print" %>
|
||||
<%= stylesheet_link_tag "cancer_predict_print", media: "print" %>
|
|
@ -3,8 +3,8 @@
|
|||
{
|
||||
"filename" : "cancer_predict_index",
|
||||
"name" : {
|
||||
"zh_tw" : "1. 乳癌預測工具",
|
||||
"en" : "1. Breast cancer predict tool"
|
||||
"zh_tw" : "1. 臺灣心血管疾病存活預測工具",
|
||||
"en" : "1. Cardiovascular Disease Survival Forecast Tool"
|
||||
},
|
||||
"thumbnail" : "thumb.png"
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
|||
{
|
||||
"filename" : "cancer_predict_widget",
|
||||
"name" : {
|
||||
"zh_tw" : "1. 乳癌預測工具",
|
||||
"en" : "1. Breast cancer predict tool"
|
||||
"zh_tw" : "1. 臺灣心血管疾病存活預測工具",
|
||||
"en" : "1. Cardiovascular Disease Survival Forecast Tool"
|
||||
},
|
||||
"thumbnail" : "thumb.png"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue