Skip to content

Commit

Permalink
Generator testnih podatkov nedokoncan
Browse files Browse the repository at this point in the history
  • Loading branch information
NaumGj committed Dec 19, 2014
1 parent 5f6ec35 commit 720b80f
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 45 deletions.
117 changes: 104 additions & 13 deletions demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function dodajMeritveVitalnihZnakov() {
"ctx/time": datumInUra,
"vital_signs/height_length/any_event/body_height_length": telesnaVisina,
"vital_signs/body_weight/any_event/body_weight": telesnaTeza,
"vital_signs/body_mass_index/any_event/body_mass_index": (telesnaTeza/((telesnaVisina/100)*(telesnaVisina/100))),
"vital_signs/body_temperature/any_event/temperature|magnitude": telesnaTemperatura,
"vital_signs/body_temperature/any_event/temperature|unit": "°C",
"vital_signs/blood_pressure/any_event/systolic": sistolicniKrvniTlak,
Expand Down Expand Up @@ -165,9 +166,24 @@ function preberiMeritveVitalnihZnakov() {
var party = data.party;
$("#rezultatMeritveVitalnihZnakov").html("<br/><span>Pridobivanje podatkov za <b>'" + tip + "'</b> bolnika <b>'" + party.firstNames + " " + party.lastNames + "'</b>.</span><br/><br/>");
var AQL =
"select a_a/data[at0002]/events[at0003]/time/value as time, a_a/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/magnitude as Temperature_magnitude, a_b/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude as Systolic_magnitude, a_b/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude as Diastolic_magnitude, a_c/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/magnitude as Body_Mass_Index_magnitude, a_d/data[at0001]/events[at0002]/data[at0003]/items[at0006]/value/numerator as spO2_numerator from EHR e[e/ehr_id/value='" + ehrId + "']" + " contains COMPOSITION a contains (OBSERVATION a_a[openEHR-EHR-OBSERVATION.body_temperature.v1] or " +
"OBSERVATION a_b[openEHR-EHR-OBSERVATION.blood_pressure.v1] or OBSERVATION a_c[openEHR-EHR-OBSERVATION.body_mass_index.v1] or OBSERVATION a_d[openEHR-EHR-OBSERVATION.indirect_oximetry.v1]) " +
"where a_a/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/magnitude>37 or a_b/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude>120 or a_b/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude>80 or a_c/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/magnitude>25 or a_d/data[at0001]/events[at0002]/data[at0003]/items[at0006]/value/numerator<96 order by a_a/data[at0002]/events[at0003]/time/value desc offset 0 limit 5";
"select a_a/data[at0002]/events[at0003]/time/value as time, " +
"a_a/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/magnitude as Temperature_magnitude, " +
"a_b/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude as Systolic_magnitude, " +
"a_b/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude as Diastolic_magnitude, " +
"a_c/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/magnitude as Body_Mass_Index_magnitude, " +
"a_d/data[at0001]/events[at0002]/data[at0003]/items[at0006]/value/numerator as spO2_numerator " +
"from EHR e[e/ehr_id/value='" + ehrId + "'] " +
"contains COMPOSITION a contains (OBSERVATION a_a[openEHR-EHR-OBSERVATION.body_temperature.v1] or " +
"OBSERVATION a_b[openEHR-EHR-OBSERVATION.blood_pressure.v1] or " +
"OBSERVATION a_c[openEHR-EHR-OBSERVATION.body_mass_index.v1] or " +
"OBSERVATION a_d[openEHR-EHR-OBSERVATION.indirect_oximetry.v1]) " +
"where a_a/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/magnitude>37 or " +
"a_b/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude>120 or " +
"a_b/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude>80 or " +
"a_c/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/magnitude>25 or " +
"a_d/data[at0001]/events[at0002]/data[at0003]/items[at0006]/value/numerator<96 " +
"order by a_a/data[at0002]/events[at0003]/time/value desc " +
"offset 0 limit 5";
$.ajax({
url: baseUrl + "/query?" + $.param({"aql": AQL}),
type: 'GET',
Expand Down Expand Up @@ -464,13 +480,13 @@ function obravnavajVisinoInTezo(visina, teza){
}else if(indeksTelesneMase>17 && indeksTelesneMase<18.5){
$("#form-visina").attr("class", "has-warning");
$("#form-teza").attr("class", "has-warning");
$("#itm").text("Zvečana telesna masa");
$("#itm").text("Blaga nedohranjenost");
$("#itm").attr("class", "label label-warning warningspan");
$("#itm").show();
}else if(indeksTelesneMase>25 && indeksTelesneMase<=30){
$("#form-visina").attr("class", "has-warning");
$("#form-teza").attr("class", "has-warning");
$("#itm").text("Blaga nedohranjenost");
$("#itm").text("Zvečana telesna masa");
$("#itm").attr("class", "label label-warning warningspan");
$("#itm").show();
}else if(indeksTelesneMase>30 && indeksTelesneMase<=35){
Expand Down Expand Up @@ -635,6 +651,74 @@ function obravnavajNasicenost(nasicenost){
}
}

function generirajBolniki(){
sessionId = getSessionId();

var ehrIDs = ['3e7ad942-52ba-45cb-8888-a5bc8b36007c','0e296572-e26b-4f1a-8d12-548ae1eb889c','90ecf9af-45b2-4f7d-ba01-7c37f41d197a'];
var podatki1 = [['201','95','38','160','130','95'],['201','93','37','140','95','97'],['201','94','36.5','130','95','98']];
var podatki2 = [['201','95','38','160','130','95'],['201','93','37','140','95','97'],['201','94','36.5','130','95','98']];
var podatki3 = [['201','95','38','160','130','95'],['201','93','37','140','95','97'],['201','94','36.5','130','95','98']];

for(var i=0; i<3; i++) {
var ehrId = ehrIDs[i];
for(var j=0; j<3; j++) {
var currentdate = new Date();
var datum = (currentdate.getHours() < 10)?"0"+currentdate.getHours():currentdate.getHours();
var datumInUra = currentdate.getFullYear() + "-"
+ (currentdate.getMonth()+1) + "-"
+ currentdate.getDate() + "T"
+ datum + ":"
+ currentdate.getMinutes();
//console.log(datumInUra);
var telesnaVisina = podatki1[j][0];
var telesnaTeza = podatki1[j][1];
var telesnaTemperatura = podatki1[j][2];
var sistolicniKrvniTlak = podatki1[j][3];
var diastolicniKrvniTlak = podatki1[j][4];
var nasicenostKrviSKisikom = podatki1[j][5];
var merilec = "medicinska sestra JaVale McGee";

$.ajaxSetup({
headers: {"Ehr-Session": sessionId}
});
var podatki = {
// Preview Structure: https://rest.ehrscape.com/rest/v1/template/Vital%20Signs/example
"ctx/language": "en",
"ctx/territory": "SI",
"ctx/time": datumInUra,
"vital_signs/height_length/any_event/body_height_length": telesnaVisina,
"vital_signs/body_weight/any_event/body_weight": telesnaTeza,
"vital_signs/body_mass_index/any_event/body_mass_index": (telesnaTeza/((telesnaVisina/100)*(telesnaVisina/100))),
"vital_signs/body_temperature/any_event/temperature|magnitude": telesnaTemperatura,
"vital_signs/body_temperature/any_event/temperature|unit": "°C",
"vital_signs/blood_pressure/any_event/systolic": sistolicniKrvniTlak,
"vital_signs/blood_pressure/any_event/diastolic": diastolicniKrvniTlak,
"vital_signs/indirect_oximetry:0/spo2|numerator": nasicenostKrviSKisikom
};
var parametriZahteve = {
"ehrId": ehrId,
templateId: 'Vital Signs',
format: 'FLAT',
committer: merilec
};
$.ajax({
url: baseUrl + "/composition?" + $.param(parametriZahteve),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(podatki),
success: function (res) {
console.log(res.meta.href);
$("#dodajMeritveVitalnihZnakovSporocilo").html("<span class='obvestilo label label-success fade-in'>" + res.meta.href + ".</span>");
},
error: function (err) {
$("#dodajMeritveVitalnihZnakovSporocilo").html("<span class='obvestilo label label-danger fade-in'>Napaka '" + JSON.parse(err.responseText).userMessage + "'!");
console.log(JSON.parse(err.responseText).userMessage);
}
});
}
}
}

$(document).ready(function() {
oznaciNaMapi("","prvic");
$('#preberiObstojeciEHR').change(function() {
Expand All @@ -653,14 +737,21 @@ $(document).ready(function() {
$("#dodajMeritveVitalnihZnakovSporocilo").html("");
var podatki = $(this).val().split("|");
$("#dodajVitalnoEHR").val(podatki[0]);
$("#dodajVitalnoDatumInUra").val(podatki[1]);
$("#dodajVitalnoTelesnaVisina").val(podatki[2]);
$("#dodajVitalnoTelesnaTeza").val(podatki[3]);
$("#dodajVitalnoTelesnaTemperatura").val(podatki[4]);
$("#dodajVitalnoKrvniTlakSistolicni").val(podatki[5]);
$("#dodajVitalnoKrvniTlakDiastolicni").val(podatki[6]);
$("#dodajVitalnoNasicenostKrviSKisikom").val(podatki[7]);
$("#dodajVitalnoMerilec").val(podatki[8]);
var currentdate = new Date();
var datum = (currentdate.getHours() < 10)?"0"+currentdate.getHours():currentdate.getHours();
var datumInUra = currentdate.getFullYear() + "-"
+ (currentdate.getMonth()+1) + "-"
+ currentdate.getDate() + "T"
+ datum + ":"
+ currentdate.getMinutes();
$("#dodajVitalnoDatumInUra").val(datumInUra);
$("#dodajVitalnoTelesnaVisina").val(podatki[1]);
$("#dodajVitalnoTelesnaTeza").val(podatki[2]);
$("#dodajVitalnoTelesnaTemperatura").val(podatki[3]);
$("#dodajVitalnoKrvniTlakSistolicni").val(podatki[4]);
$("#dodajVitalnoKrvniTlakDiastolicni").val(podatki[5]);
$("#dodajVitalnoNasicenostKrviSKisikom").val(podatki[6]);
$("#dodajVitalnoMerilec").val(podatki[7]);
});
$('#preberiEhrIdZaVitalneZnake').change(function() {
$("#preberiMeritveVitalnihZnakovSporocilo").html("");
Expand Down
4 changes: 2 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ function vizualizacija(data) {
.append('svg')
.call(chart);


d3.selectAll("#chart4 path").on('mouseover', function () {
var d = d3.select(this).data()[0];
d3.select("#info").text(d.title + ' has value ' + data[parseInt(d.title)]);
d3.select("#info").text(d.title + ' ima vrednost ' + data[parseInt(d.title)]);
});
d3.selectAll("#chart4 svg").on('mouseout', function () {
d3.select("#info").text('');
Expand Down
66 changes: 36 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@
<div class="panel-heading">
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"><b>Kreiraj EHR zapis</b> za novega bolnika</div>
<div class="col-lg-4 col-md-4 col-sm-4"><select class="form-control input-sm" id="preberiPredlogoBolnika"><option value=""></option><option value="Pujsa,Pepa,1938-10-30T14:58">Pujsa Pepa</option></select></div>
</div>
</div>
<div class="panel-body">
<span class="label label-default">Ime</span><input id="kreirajIme" type="text" class="form-control input-mini" placeholder="Osama">
<span class="label label-default">Priimek</span><input id="kreirajPriimek" type="text" class="form-control" placeholder="Bin Laden">
<span class="label label-default">Datum rojstva</span><input id="kreirajDatumRojstva" type="text" class="form-control" placeholder="1957-03-10T09:08">
<button type="button" class="btn btn-primary btn-xs" onclick="kreirajEHRzaBolnika()">Dodaj osnovne podatke o bolniku</button><span id="kreirajSporocilo"></span><br><br>
<button type="button" class="btn btn-primary btn-lg">Generiraj bolnika</button><span id="generirajSporocilo"></span>
<button type="button" class="btn btn-primary btn-lg" onclick="generirajBolniki()">Generiraj bolniki</button><span id="generirajSporocilo"></span>
</div>
</div>
</div>
Expand All @@ -63,7 +62,7 @@
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6"><b>Pregled</b> meritev <b>vitalnih znakov</b> bolnika</div>
<div class="col-lg-3 col-md-3 col-sm-3"><select class="form-control input-sm" id="preberiTipZaVitalneZnake"><option value="AQL poizvedba">AQL vitalni znaki</option><option value="vizualiziraj podatke">Vizualiziraj podatke</option></select></div>
<div class="col-lg-3 col-md-3 col-sm-3"><select class="form-control input-sm" id="preberiEhrIdZaVitalneZnake"><option value=""></option><option value="b931580f-2b05-488b-985b-8d9ffb08ad02">Ata Smrk</option><option value="d564c6a3-5a43-4fcc-bfa7-9ac76e9673bd">Pujsa Pepa</option></select></div>
<div class="col-lg-3 col-md-3 col-sm-3"><select class="form-control input-sm" id="preberiEhrIdZaVitalneZnake"><option value=""></option><option value="3e7ad942-52ba-45cb-8888-a5bc8b36007c">Kyle Korver</option><option value="0e296572-e26b-4f1a-8d12-548ae1eb889c">Stephen Curry</option><option value="90ecf9af-45b2-4f7d-ba01-7c37f41d197a">Pero Antic</option><option value="b931580f-2b05-488b-985b-8d9ffb08ad02">Ata Smrk</option><option value="d564c6a3-5a43-4fcc-bfa7-9ac76e9673bd">Pujsa Pepa</option></select></div>
</div>
</div>
<div class="panel-body">
Expand All @@ -86,7 +85,7 @@
<div class="panel-heading">
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"><b>Vnos</b> meritve <b>vitalnih znakov</b> bolnika</div>
<div class="col-lg-4 col-md-4 col-sm-4"><select class="form-control input-sm" id="preberiObstojeciVitalniZnak"><option value=""></option><option value="b931580f-2b05-488b-985b-8d9ffb08ad02|2014-11-21T11:40Z|185|80.0|36.50|118|92|98|medicinska sestra Smrketa">Ata Smrk</option></select></div>
<div class="col-lg-4 col-md-4 col-sm-4"><select class="form-control input-sm" id="preberiObstojeciVitalniZnak"><option value=""></option><option value="3e7ad942-52ba-45cb-8888-a5bc8b36007c|201|96|36.50|118|92|97|medicinska sestra Shaq">Kyle Korver</option><option value="0e296572-e26b-4f1a-8d12-548ae1eb889c|190|90|37.50|130|90|99|medicinska sestra Shaq">Stephen Curry</option><option value="90ecf9af-45b2-4f7d-ba01-7c37f41d197a|212|120|36.70|120|80|96|medicinska sestra Shaq">Pero Antic</option></select></div>
</div>
</div>
<div class="panel-body">
Expand All @@ -105,34 +104,41 @@
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-default">
<div class="col-lg-6 col-md-6 col-sm-6">
<select class="form-control input" id="obmocje" style="width: 160px"><option value="nevrologija">Nevrologija</option><option value="otorinolaringologija">Otorinolaringologija</option></select><br>
</div>
<div id="zdravniki" class="col-lg-6 col-md-6 col-sm-6" style="display: none">
<a id="zdravnik1" class="seznam-zdravnikov"></a><br>
<option id="adresa1" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik2" class="seznam-zdravnikov"></a><br>
<option id="adresa2" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik3" class="seznam-zdravnikov"></a><br>
<option id="adresa3" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik4" class="seznam-zdravnikov"></a><br>
<option id="adresa4" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik5" class="seznam-zdravnikov"></a><br>
<option id="adresa5" value="" class="adrese-zdravnikov"></option>
<ul class="pager pull-left">
<li id="previous" class="disabled"><a onclick="najdiPreviousPage()">Previous</a></li>
<li id="next" class="enabled"><a onclick="najdiNextPage()">Next</a></li>
<option id="strana" style="display: none;" value="0"></option>
</ul>
<div class="panel-heading">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6"><b>Izbira</b> ustreznega <b>zdravnika</b></div>
<div class="col-lg-6 col-md-6 col-sm-6"><select class="form-control input" id="obmocje" style="width: 100%"><option value=""></option><option value="nevrologija">Nevrologija</option><option value="otorinolaringologija">Otorinolaringologija</option></select><br></div>
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12" id="kriticne" class="row">
<span id="itm" class="label label-warning warningspan"></span>
<span id="temperatura" class="label label-warning warningspan"></span>
<span id="sistolicni" class="label label-warning warningspan"></span>
<span id="diastolicni" class="label label-warning warningspan"></span>
<span id="nasicenost" class="label label-warning warningspan"></span>
<div class="panel-body">
<div class="row">
<div id="zdravniki" class="col-lg-5 col-md-5 col-sm-5" style="display: none">
<a id="zdravnik1" class="seznam-zdravnikov"></a><br>
<option id="adresa1" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik2" class="seznam-zdravnikov"></a><br>
<option id="adresa2" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik3" class="seznam-zdravnikov"></a><br>
<option id="adresa3" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik4" class="seznam-zdravnikov"></a><br>
<option id="adresa4" value="" class="adrese-zdravnikov"></option>
<a id="zdravnik5" class="seznam-zdravnikov"></a><br>
<option id="adresa5" value="" class="adrese-zdravnikov"></option>
<ul class="pager pull-left">
<li id="previous" class="disabled"><a onclick="najdiPreviousPage()">Previous</a></li>
<li id="next" class="enabled"><a onclick="najdiNextPage()">Next</a></li>
<option id="strana" style="display: none;" value="0"></option>
</ul>
</div>
<div class="col-lg-7 col-md-7 col-sm-7" id="kriticne" >
<span id="itm" class="label label-warning warningspan"></span>
<span id="temperatura" class="label label-warning warningspan"></span>
<span id="sistolicni" class="label label-warning warningspan"></span>
<span id="diastolicni" class="label label-warning warningspan"></span>
<span id="nasicenost" class="label label-warning warningspan"></span>
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12" id="map"></div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12" id="map"></div>
</div>
</div>
</div>
Expand Down

0 comments on commit 720b80f

Please sign in to comment.