-
Notifications
You must be signed in to change notification settings - Fork 6
/
breath_plot.html
600 lines (547 loc) · 23.5 KB
/
breath_plot.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
<!--
Breath Plot: COVID-19 Respiration Analysis Software
Copyright (C) 2021 Robert L. Read
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
-->
<link href="https://cdn.jsdelivr.net/gh/gitbrent/[email protected]/css/bootstrap4-toggle.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/standard.css" media="screen"/>
<title>Public Invention Respiration Analysis</title>
</head>
<body>
<template id="observable-xx">
<style>
.calcnum {
color: blue;
font-size: xx-large;
}
.fence {
width: 3em;
}
.value_and_fences {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.limit {
display: flex;
flex-direction: row;
}
.limit label {
width: 1em;
}
.alarmred {
background: red;
}
</style>
<div class="observable">
<label for="obs">
<slot name="obs-title">OBS-TITLE NEEDED</slot>
</label>
<div class="value_and_fences">
<div class="calcnum">
<label id="obs">
<slot name="obs-value">OBS-VALUE NEEDED</slot>
</label>
</div>
<div class="vertical_alarms">
<div class="limit max">
<label for="max_h">H:</label>
<slot name="obs-max">111</slot>
</input>
</div>
<div class="limit min">
<label for="max_l">L:</label>
<slot name="obs-min">222</slot>
</input>
</div>
</div>
</div>
</div>
</template>
<template id="observable-setter-xx">
<style>
.calcnum {
color: blue;
font-size: xx-large;
}
.fence {
font-size: 70%;
width: 60%;
}
.value_and_fences {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.limit {
display: flex;
flex-direction: row;
padding-top: 3em;
}
.limit label {
width: 1em;
}
.alarmred {
background: red;
}
</style>
<div id="observable-setter" class="observable-setter">
<label for="obs">
<slot name="obs-title">OBS-TITLE NEEDED</slot>
</label>
<div class="vertical_alarms">
<div class="limit max">
<label for="max_h">H:</label>
<slot name="obs-max">111</slot>
<input class="fence" type='text'>
</input>
</div>
<div class="limit min">
<label for="max_l">L:</label>
<slot name="obs-min">222</slot>
<input id="input" class="fence" type='text'>
</input>
</div>
</div>
</div>
</template>
<div class="container-fluid">
<div id="preamble">
<div class="jumbotron">
<h1 class="display-4">VentMon Respiration Analysis</h1>
<p class="lead">This is a work in progress of <a href="https://www.pubinv.org">Public Invention</a>. It can be attached to a data server to produce
an interactive or static analysis of a respiration. It's primary purpose is to test pandemic ventilators, but it is free software meant to be reused for other purposes.
</p>
</div>
<div class="input-group mb-3 livecon">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">PIRDS data server (or VentOS API) url:</span>
</div>
<input type="text" class="form-control" id="dserverurl" aria-describedby="basic-addon3">
<div class="input-group-append">
<span>
<label for="livetoggle livecon">Use VentOS API</label>
<label class="switch livecon">
<input type="checkbox" id="simulation" checked>
<span class="slider round"></span>
</label>
</span>
<a class="btn btn-outline-dark btn-sm" href="#" role="button" id="useofficial">Use Ventmon Data Lake: ventmon.coslabs.com</a>
</div>
</div>
<div class="input-group mb-3 livecon">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Trace ID:</span>
</div>
<input type="text" class="form-control" id="traceid" aria-describedby="basic-addon3">
</div>
<div class="input-group mb-3 livecon">
<div class="input-group-prepend">
<span class="input-group-text" for="samples_to_plot">Number of Samples (~10s per 15000 samples):</span>
</div>
<input type="text" class="form-control" id="samples_to_plot" aria-describedby="samples_to_plot">
</div>
<div class="input-group mb-3 raworks">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Respiraworks file url:</span>
</div>
<input type="text" class="form-control" id="raworksid" aria-describedby="basic-addon3">
</div>
</div>
<div>
<label for="livetoggle livecon">Plot Live</label>
<label class="switch livecon">
<input type="checkbox" id="livetoggle" checked>
<span class="slider round"></span>
</label>
<label for="livetoggle livecon">Use Clinical Display</label>
<label class="switch livecon">
<input type="checkbox" id="clinical_display" checked>
<span class="slider round"></span>
</label>
<div class="btn-group livecon" role="group" aria-label="Basic example">
<button type="button" class="btn btn-primary" id="5s_btn">5s</button>
<button type="button" class="btn btn-primary" id="10s_btn">10s</button>
<button type="button" class="btn btn-primary" id="15s_btn">15s</button>
<button type="button" class="btn btn-primary" id="30s_btn">30s</button>
<button type="button" class="btn btn-primary" id="60s_btn">60s</button>
<button type="button" class="btn btn-primary" id="120s_btn">120s</button>
<button type="button" class="btn btn-primary" id="180s_btn">180s</button>
<button type="button" class="btn btn-primary" id="300s_btn">300s</button>
</div>
<div id="collapsingleftsidebar" >
<div id="leftsidebar" style="display: none">
<observable-setter id="pipmax-setter">
<span slot="obs-title">PIP (max):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="pipavg-setter" class="engineering_only">
<span slot="obs-title">P. Mean:</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="pipmin-setter">
<span slot="obs-title">PEEP (min):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="mv-setter">
<span slot="obs-title">MVs (l/min):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-setter>
<observable-setter id="bpm-setter">
<span slot="obs-title">RR</span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-setter>
<observable-setter id="inhalationtoexhalation-setter">
<span slot="obs-title">I:E ratio: </span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-setter>
<observable-setter id="tidalvolume-setter">
<span slot="obs-title">VTd (ml): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">1000</span>
<span slot="obs-min">200</span>
</observable-setter>
<observable-setter id="fioxygen2-setter" class="engineering_only">
<span slot="obs-title">FiO2 Mean (%): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">100</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="timeachieveip-setter" class="engineering_only">
<span slot="obs-title">Rise Time (ms): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">2000</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="timereleaseinspiratorypressure-setter" class="engineering_only">
<span slot="obs-title">Fall Time (ms): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">2000</span>
<span slot="obs-min">0</span>
</observable-setter>
<observable-setter id="workofbreathing-setter" class="engineering_only">
<span slot="obs-title">W. of B. (J/L): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">100</span>
<span slot="obs-min">0</span>
</observable-setter>
<div id="mode-setter" class="controllable-setter">
<label for="controllable-mode">Mode:</label>
<br />
<input type="text" placeholder="Enter Value"></input>
<span>
<label for="livetoggle livecon" style="font-size: 20px; float: left;">--PCV------VCV--</label>
<label class="switch livecon">
<input type="checkbox" id="simulation" checked>
<span class="slider round" style="height:35px;"></span>
</label>
</span>
<span>
<label for="livetoggle livecon" style="font-size: 20px; margin-top: 200px;"></label>
<label class="switch livecon">
<input type="checkbox" id="simulation" checked>
<span class="slider round" style="height:35px"></span>
</label>
</span>
<!-- <label for="dcv" style="font-size: 15px;">DCV</label>
<input id="controllable-mode" type='text'>-->
<button id="controllable-mode-dismiss" type='button'>Done</input>
</div>
<div id="pimax-setter" class="controllable-setter">
<label for="controllable-pimax">PIMAX:</label>
<input id="controllable-pimax" type='text'>
<button id="controllable-pimax-dismiss" type='button'>dismiss</input>
</div>
<div id="TV-setter" class="controllable-setter">
<label for="controllable-TV">Tidal Volume (ml):</label>
<input id="controllable-TV" type='text'>
<button id="controllable-TV-dismiss" type='button'>dismiss</input>
</div>
<div id="RR-setter" class="controllable-setter">
<label for="controllable-RR">RR (bpm):</label>
<input id="controllable-RR" type='text'>
<button id="controllable-RR-dismiss" type='button'>dismiss</input>
</div>
<div id="IE-setter" class="controllable-setter">
<label for="controllable-IE">IE</label>
<input id="controllable-IE" type='text'>
<button id="controllable-IE-dismiss" type='button'>dismiss</input>
</div>
<div id="PEEP-setter" class="controllable-setter">
<label for="controllable-PEEP">PEEP (cm H2O)</label>
<input id="controllable-PEEP" type='text'>
<button id="controllable-PEEP-dismiss" type='button'>dismiss</input>
</div>
</div>
<div id="data-area" class="container-fluid">
<div class="row">
<div class="col-9">
<div id="timetop">
<div class="alert alert-info" role="alert" id="time_start">
Time of first sample
</div>
<div class="alert alert-info" role="alert" id="time_finish">
Time of last sample
</div>
</div>
<div id='PFGraph'><!-- Pressure and Flow Graph --></div>
<div id='EventsGraph'><!-- Events --></div>
</div>
<div class="col-3">
<div class="alert alert-danger" role="alert" id="main_alert">
Danger! Flow limits exceeded; volumes will be incorrect.
</div>
<div class="container" id="calcarea">
<observable-x id="pipmax">
<span slot="obs-title">PIP (max):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="pipavg" class="engineering_only">
<span slot="obs-title">P. Mean:</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="pipmin">
<span slot="obs-title">PEEP (min):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">40</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="mv">
<span slot="obs-title">MVs (l/min):</span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-x>
<observable-x id="bpm">
<span slot="obs-title">RR</span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-x>
<observable-x id="inhalationtoexhalation">
<span slot="obs-title">I:E ratio: </span>
<span slot="obs-value">0</span>
<span slot="obs-max">10</span>
<span slot="obs-min">1</span>
</observable-x>
<observable-x id="tidalvolume">
<span slot="obs-title">VTd (ml): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">1000</span>
<span slot="obs-min">200</span>
</observable-x>
<observable-x id="fioxygen2" class="engineering_only">
<span slot="obs-title">FiO2 Mean (%): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">100</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="timeachieve-ip" class="engineering_only">
<span slot="obs-title">Rise Time (ms): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">2000</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="timereleaseinspiratory-pressure" class="engineering_only">
<span slot="obs-title">Fall Time (ms): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">2000</span>
<span slot="obs-min">0</span>
</observable-x>
<observable-x id="workofbreathing" class="engineering_only">
<span slot="obs-title">W. of B. (J/L): </span>
<span slot="obs-value">0</span>
<span slot="obs-max">100</span>
<span slot="obs-min">0</span>
</observable-x>
</div>
</div>
</div>
</div>
</div>
</div> <!-- collapsing side-bar -->
</div> <!-- end main area -->
</div>
<div class="flex settings_area">
<button id="setting_mode" class="settings_button">
Mode<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_mode-value"> 35.7 </label>
</div>
</div>
</button>
<button id="setting_pimax" class="settings_button">
Pimax<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_pimax-value"> 35.7 </label>
</div>
</div>
</button>
<button id="setting_TV" class="settings_button">
TV<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_TV-value"> 35.7 </label>
</div>
</div>
</button>
<button id="setting_RR" class="settings_button">
RR<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_RR-value"> 35.7 </label>
</div>
</div>
</button>
<button id="setting_IE" class="settings_button">
IE<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_IE-value"> 35.7 </label>
</div>
</div>
</button>
<button id="setting_PEEP" class="settings_button">
PEEP<br></br>
<div class="setting_value">
<div class="setting">
<label id="setting_PEEP-value"> 35.7 </label>
</div>
</div>
</button>
</div>
</div>
</div>
<!-- CONTROL PANEL START -->
<div class="container-fluid" id="control-area">
<button id="show_controls" type="button" class="btn btn-primary">EXPAND/COLLAPSE CONTROLS</button>
<div id="control-slot">
<p>Note: This is an experimental feature designed to be used with serialserver.js, specifially with a VentOS-powered device. If those words mean nothing to you, this feature is probably not for you!</p>
<div class="row">
<div class="col-6">
<div class="control-wrapper row">
<label class="col-2" for="control-mode">Mode:</label>
<input class="col-9" type="range" id="control-mode" name="control-mode" min="0" max="2" value="0"/>
<label class="col-1" id="control-mode-val">PCV</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-rr">RR:</label>
<input class="col-9" type="range" id="control-rr" name="control-rr" min="1" max="30" value="12"/>
<label class="col-1" id="control-rr-val">12</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-ie">EI (x10) :</label>
<input class="col-9" type="range" id="control-ie" name="control-ie" min="5" max="50" step="1" value="30"/>
<label class="col-1" id="control-ie-val">30</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-pinsp">Pinsp (cmH20):</label>
<input class="col-9" type="range" id="control-pinsp" name="control-pinsp" min="10" max="50" value="35"/>
<label class="col-1" id="control-pinsp-val">35</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-vinsp">Vinsp:</label>
<input class="col-9" type="range" id="control-vinsp" name="control-vinsp" min="200" max="800" step="20" value="500"/>
<label class="col-1" id="control-vinsp-val">500</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-peep">PEEP (cmH20):</label>
<input class="col-9" type="range" id="control-peep" name="control-peep" min="0" max="15" value="5"/>
<label class="col-1" id="control-peep-val">5</label>
</div>
<button id="control-start" type="button" class="btn btn-primary">START</button>
</div>
</div>
<div class="col-6">
<div>
<b>Status:</b> no device connected
</div>
<div>
<b>Log:</b> some log info
</div>
</div>
</div>
</div>
<!-- CONTROL PANEL END -->
<div class="container-fluid" id="control-area">
<button id="show_parameters" type="button" class="btn btn-primary">EXPAND/COLLAPSE PARAMETERS</button>
<div id="parameter-slot">
<div>
Parameters:
<div>
<label for="tarip_h">Rise/Fall High Pressure (cm H2O):</label>
<input class="fence" id="tarip_h" type='text'> </input>
</div>
<div>
<label for="tarip_l">Rise/Fall Low Pressure (cm H2O):</label>
<input class="fence" id="tarip_l" type='text'> </input>
</div>
</div>
<div>
<button id="import">Import Trace</button>
<button id="export">Export Trace</button>
</div>
<div>
<textarea id="json_trace" rows="30" cols="80"></textarea>
</div>
<p>
This is a work in progress of <a href="https://www.pubinv.org">Public Invention</a>.
<p>
This is a tester tool for open-source ventilators.
It uses the <a href="https://github.com/PubInv/respiration-data-standard">PIRDS data format</a>.
<p>
The basic operation is receive data from web server specified in the URL above.
Probably for now that will be the VentMon Python web server that
listens on a serial port for the VentMon device or any other
device that streams PIRDS events.
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/gitbrent/[email protected]/js/bootstrap4-toggle.min.js"></script>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
<script>
const SEVENINCHEL14TS = false;
</script>
<script src='js/respiraworks_to_PIRDS.js'></script>
<script src='js/respiration_math.js'></script>
<script src='js/PIRDS_utilities.js'></script>
<script src='js/breath_plot_ctl.js'></script>
</body>