-
Notifications
You must be signed in to change notification settings - Fork 40
/
index.html
68 lines (64 loc) · 3.23 KB
/
index.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<!--
Original Design: David McCandless & Stefanie Posavec for Wired Magazine <http://informationisbeautiful.net>
Original Implementation: Arjun Sanyal <arjun.sanyal@childrens.harvard.edu>
Latest Implementation: Vladimir Ignatov <vladimir.ignatov@childrens.harvard.edu>
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Cardiology Risk Visualization - FHIR</title>
<style>
#errors {
font-size: 16px;
font-family: Calibri, "Helvetica Neue", Helvetica, Verdana, sans-serif;
color: #555;
}
</style>
<!-- <script src="node_modules/fhirclient/fhir-client.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/fhirclient@2.0.6/build/fhir-client.js"></script>
<script src='./lib/jquery.min.js'></script>
<script src='./lib/jquery.min.js'></script>
<script src='./lib/xdate.js'></script>
<script src='./lib/jsonselect.js'></script>
<script src='./load_data.js'></script>
<script src='./lib/raphael-min.js'></script>
<script src='./lib/g.raphael.js'></script>
<script src='./draw_visualization.js'></script>
<script>
extractData().then(function(p){
var missing_data_array = report_missing_data(p);
if (missing_data_array.length > 0) {
$('#errors').show().html(function() {
var out = '<h2>Can\'t Compute Cardiovascular Risk Score</h2><p>Can\'t compute cardiovascular risk score from available data because of the following issues:</p><ul>';
$.each(missing_data_array, function(i, v){ out += '<li>' + missing_data_array[i] + '</li>'; })
return out + '</ul>';
});
return; // abort script
} else {
$('#holder').show();
draw_visualization();
}
});
// checks for data needed to compute risk score. returns a possibly empty array of strings.
// if the array is empty everything's ok. TODO: separate missing and out of range criteria
var report_missing_data = function(p) {
var a = [];
if (p.gender.value != 'male' && p.gender.value != 'female') a.push('Gender is required')
if (p.sbp.value < 105 || p.sbp.value > 200) a.push('Systolic blood pressure must be between 105 and 200mm/Hg')
if (p.cholesterol.value < 140 || p.cholesterol.value > 400) a.push('Total cholesterol must be between 140 and 400mg/dL')
if (p.HDL.value < 30 || p.HDL.value > 150) a.push('HDL cholesterol must be between 30 and 150mg/dL')
if (p.hsCRP.value < 0.03 || p.hsCRP.value > 20) a.push('hsCRP must be between 0.03 and 20mg/L')
if (p.smoker_p.value === false || p.smoker_p.value === true) {} else { a.push('Current smoking status must be defined') }
if (p.fx_of_mi_p.value === false || p.fx_of_mi_p.value === true) {} else { a.push('Family history of heart attack before the age of 60 must be defined') }
return a;
};
</script>
</head>
<body style="margin: none;">
<div id='errors' style='display: none; width: 600px; margin: 100px auto;'></div>
<div id='holder' style='display: none; height: 1200px; width: 780px;'></div>
<div id='log'></div>
</body>
</html>