-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
42 lines (34 loc) · 2.16 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function calculateAPRI() {
var astLevel = parseFloat(document.getElementById('astLevel').value) || 0;
var upperLimitAST = parseFloat(document.getElementById('upperLimitAST').value) || 1;
var plateletCount = parseFloat(document.getElementById('plateletCount').value) || 1;
var apri = (astLevel / upperLimitAST) * (100 / plateletCount);
var resultElement = document.getElementById('result');
resultElement.innerHTML = "APRI Score: " + apri.toFixed(2);
}
function resetForm() {
document.getElementById('apriForm').reset();
document.getElementById('result').innerHTML = "";
document.getElementById('interpretation').innerHTML = "";
}
function showInterpretation() {
var interpretationElement = document.getElementById('interpretation');
interpretationElement.innerHTML = "";
var apri = parseFloat(document.getElementById('result').innerText.replace("APRI Score: ", ""));
var interpretationEn = document.createElement('div');
interpretationEn.className = 'en';
var interpretationFr = document.createElement('div');
interpretationFr.className = 'fr';
if (apri < 0.5) {
interpretationEn.innerHTML = "Interpretation (En): Low Fibrosis Risk (F0-F1) - Indicates minimal or no fibrosis.";
interpretationFr.innerHTML = "Interprétation (Fr) : Risque de fibrose faible (F0-F1) - Indique une fibrose minimale ou absente.";
} else if (apri >= 0.5 && apri <= 1.5) {
interpretationEn.innerHTML = "Interpretation (En): Intermediate Fibrosis Risk (F2-F3) - Suggests moderate to significant fibrosis.";
interpretationFr.innerHTML = "Interprétation (Fr) : Risque de fibrose intermédiaire (F2-F3) - Suggère une fibrose modérée à significative.";
} else {
interpretationEn.innerHTML = "Interpretation (En): Advanced Fibrosis or Cirrhosis (F4) - Indicates advanced fibrosis or cirrhosis.";
interpretationFr.innerHTML = "Interprétation (Fr) : Fibrose avancée ou cirrhose (F4) - Indique une fibrose avancée ou une cirrhose.";
}
interpretationElement.appendChild(interpretationEn);
interpretationElement.appendChild(interpretationFr);
}