This repository has been archived by the owner on Nov 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlineup.html
69 lines (65 loc) · 2.39 KB
/
lineup.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
69
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>LineUp Patient Data</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href="https://unpkg.com/lineupjs@next/build/LineUpJS.css" rel="stylesheet">
<script src="https://unpkg.com/lineupjs@next"></script>
<script src="https://unpkg.com/papaparse"></script>
<style>
body {
margin: 0;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
}
#app {
flex: 1 1 0;
}
header {
padding: 0 1em;
display: flex;
align-items: center;
justify-content: space-between;
}
</style>
</head>
<body>
<header>
<h4>Covid 19 South Korea Patient Info</h4>
<p>Data from: <a href="https://www.kaggle.com/kimjihoo/coronavirusdataset#PatientInfo.csv">Kaggle</a></p>
</header>
<div id="app"></div>
<script>
async function main() {
const data = await new Promise((resolve) => Papa.parse('./data/PatientInfo.csv', {
download: true,
dynamicTyping: true,
header: true,
complete: resolve,
}));
const b = LineUpJS.builder(data.data);
b.deriveColumns(['state', 'sex', 'contact_number', 'infection_order', 'infection_case', 'city', 'province', 'country', 'age']);
b.column(LineUpJS.buildStringColumn('patient_id'));
b.column(LineUpJS.buildNumberColumn('birth_year', [1900, 2020]).numberFormat('d'));
// b.column(LineUpJS.buildCategoricalColumn('disease', ['true', 'false']));
b.column(LineUpJS.buildStringColumn('infected_by'));
b.column(LineUpJS.buildDateColumn('symptoms_onset_date').format('%Y-%m-%d'));
b.column(LineUpJS.buildDateColumn('confirmed_date').format('%Y-%m-%d'));
b.column(LineUpJS.buildDateColumn('released_date').format('%Y-%m-%d'));
b.column(LineUpJS.buildDateColumn('deceased_date').format('%Y-%m-%d'));
b.aggregationStrategy('group+top+item');
const r = LineUpJS.buildRanking().column('_*');
['patient_id', 'sex', 'age', 'birth_year', 'state', 'confirmed_date', 'released_date', 'deceased_date'].forEach((k) => r.column(k));
r.groupBy('sex')
r.sortBy('birth_year:desc')
b.ranking(r);
const taggle = b.buildTaggle(document.getElementById('app'));
}
main();
</script>
</body>
</html>