Update cancer_predict.js.
This commit is contained in:
parent
b8e6e80d81
commit
05f913f513
|
@ -323,20 +323,6 @@ $(document).ready(function(){
|
|||
$('[for="hormone_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{
|
||||
|
@ -401,9 +387,9 @@ $(document).ready(function(){
|
|||
$('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 = /*therapy_lpv start*/[0, -0.8397, -0.4147, -0.3203, -0.4687];/*therapy_lpv end*/;
|
||||
var lpv = /*therapy_lpv start*/[0];/*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*/
|
||||
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*/
|
||||
active_treatment.push = function() {
|
||||
if(arguments.length == 1){
|
||||
var year = $('#current_year').attr('value');
|
||||
|
@ -613,68 +599,128 @@ $(document).ready(function(){
|
|||
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']);
|
||||
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']);
|
||||
mapping_hash = mapping_data_from_csv['age'];
|
||||
temp_index = 0;
|
||||
temp_value = result['age'];
|
||||
index = 0;
|
||||
$.each(mapping_hash,function(k,v){
|
||||
if( index == 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( index == 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( index == 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( index == 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( index == 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']));
|
||||
|
||||
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{
|
||||
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)
|
||||
)
|
||||
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){console.log(e)};
|
||||
result['lpv_variable'] = {};
|
||||
result['lpv_variable']['lpv'] = lpv;
|
||||
result['lpv'] = lpv;
|
||||
result['lpv_variable']['A'] = A;
|
||||
result['lpv'] = A;
|
||||
result['lpv_variable']['lpv'] = result['lpv'];
|
||||
return result;
|
||||
};
|
||||
|
@ -696,16 +742,19 @@ $(document).ready(function(){
|
|||
|
||||
function calculate_servive_ratio(year,obj){
|
||||
var servive_ratio;
|
||||
var lpv = obj['lpv'];
|
||||
var A = obj['A'];
|
||||
switch(year) {
|
||||
case '1':
|
||||
servive_ratio = Math.exp(-0.001476145)**( Math.exp(lpv) );
|
||||
servive_ratio = 0.8095037**( Math.exp(A) );
|
||||
break;
|
||||
case '3':
|
||||
servive_ratio = Math.exp(-0.01261639)**( Math.exp(lpv) );
|
||||
case '1.5':
|
||||
servive_ratio = 0.729158**( Math.exp(A) );
|
||||
break;
|
||||
case '5':
|
||||
servive_ratio = Math.exp(-0.02519608)**( Math.exp(lpv) );
|
||||
case '2':
|
||||
servive_ratio = 0.6717211**( Math.exp(A) );
|
||||
break;
|
||||
case '2.5':
|
||||
servive_ratio = 0.6056773**( Math.exp(A) );
|
||||
break;
|
||||
default:
|
||||
console.log('not found year.');
|
||||
|
|
Loading…
Reference in New Issue