diff --git a/elcid/api.py b/elcid/api.py index 1919aff17..7d0042034 100644 --- a/elcid/api.py +++ b/elcid/api.py @@ -7,6 +7,7 @@ from operator import itemgetter from django.conf import settings +from django.utils.functional import cached_property from django.utils.text import slugify from django.http import HttpResponseBadRequest from rest_framework import viewsets, status @@ -70,6 +71,30 @@ class LabTestResultsView(LoginRequiredViewset): """ base_name = 'lab_test_results_view' + @cached_property + def starred_results_dict(self): + starred_obs = lab_test_models.StarredObservation.objects.filter( + patient_id=self.kwargs["pk"] + ) + result = {} + for starred_ob in starred_obs: + key = ( + starred_ob.test_name, + starred_ob.lab_number, + starred_ob.observation_name, + ) + result[key] = starred_ob.id + return result + + def get_starred_id(self, test, observation): + key = ( + test.test_name, + test.lab_number, + observation.observation_name, + ) + return self.starred_results_dict.get(key) + + def get_non_comments_for_patient(self, patient): """ Returns all non comments for a patient, ensuring they are @@ -203,8 +228,9 @@ def serialise_long_form_instance(self, instance): serialised_observations.append( { 'name' : o.observation_name.rstrip('.'), - 'value': o.observation_value, - 'units': o.units + 'value': o.observation_value.replace("~", "\n"), + 'units': o.units, + 'star': self.get_starred_id(instance, o), } ) @@ -300,6 +326,58 @@ class InfectionServiceTestSummaryApi(LoginRequiredViewset): NUM_RESULTS = 5 + @cached_property + def starred_results_dict(self): + """ + A cached property of test_name, lab_number, observation_name to StarredObservation.id + """ + starred_obs = lab_test_models.StarredObservation.objects.filter( + patient_id=self.kwargs["pk"] + ) + result = {} + for starred_ob in starred_obs: + key = ( + starred_ob.test_name, + starred_ob.lab_number, + starred_ob.observation_name, + ) + result[key] = starred_ob.id + return result + + def get_starred(self, patient, ticker): + """ + If a lab test has been starred and is not already + in the ticker add it + """ + result = [] + already_starred = {i["star"] for i in ticker} + others_starred = [ + key for key, starred_id in self.starred_results_dict.items() + if starred_id not in already_starred + ] + if not others_starred: + return [] + observations = lab_test_models.Observation.objects.filter( + test__patient=patient, + test__test_name__in=[i[0] for i in others_starred], + test__lab_number__in=[i[1] for i in others_starred], + observation_name__in=[i[2] for i in others_starred], + ).select_related('test') + for observation in observations: + test = observation.test + starred_id = self.starred_results_dict.get(( + test.test_name, test.lab_number, observation.observation_name + )) + if starred_id: + timestamp = observation.observation_datetime + result.append({ + 'date_str': observation.observation_datetime.strftime('%d/%m/%Y %H:%M'), + 'timestamp': timestamp, + 'name': observation.observation_name, + 'value': "\n".join(observation.observation_value.strip().split("~")), + 'star': starred_id, + }) + return result def _get_antifungal_ticker_dict(self, test): """ @@ -311,26 +389,30 @@ def _get_antifungal_ticker_dict(self, test): test_name = test.test_name result_string = '' + star_id = None for observation in observations: - if observation.observation_name in self.ANTIFUNGAL_TESTS[test_name]: result_string += ' {} {}'.format( self.ANTIFUNGAL_SHORT_NAMES[observation.observation_name], observation.observation_value.split('~')[0] ) + if not star_id: + star_id = self.starred_results_dict.get( + (test_name, test.lab_number, observation.observation_name,) + ) display_name = '{} {}'.format( self.ANTIFUNGAL_SHORT_NAMES[test_name], test.site.replace('&', ' ').split(' ')[0] ) - return { 'date_str' : timestamp.strftime('%d/%m/%Y %H:%M'), 'timestamp': timestamp, 'name' : display_name, - 'value' : result_string.strip() + 'value' : result_string.strip(), + 'star' : star_id, } def get_antifungal_observations(self, patient): @@ -369,16 +451,30 @@ def get_antifungal_observations(self, patient): return ticker + def get_covid_ticker(self, patient): + """ + Get the covid ticker, add the property + 'star' which points is the id of the StarredObservation + if its been starred, otherwise its None + """ + ticker = covid_lab.get_covid_result_ticker(patient) + for t in ticker: + star_id = self.starred_results_dict.get( + (t["test_name"], t["lab_number"], t["name"],) + ) + t["star"] = star_id + t["observation_name"] = t["name"] + return ticker def get_ticker_observations(self, patient): """ Some results are displayed as a ticker in chronological order. """ - ticker = covid_lab.get_covid_result_ticker(patient) + ticker = self.get_covid_ticker(patient) ticker += self.get_antifungal_observations(patient) + ticker += self.get_starred(patient, ticker) ticker = list(reversed(sorted(ticker, key=lambda i: i['timestamp']))) - return ticker def get_recent_dates_to_observations(self, qs): diff --git a/elcid/assets/css/elcid.css b/elcid/assets/css/elcid.css index a060e6a5b..0a840085f 100644 --- a/elcid/assets/css/elcid.css +++ b/elcid/assets/css/elcid.css @@ -55,12 +55,11 @@ body { border-color: #0091C9; } -.radio-vertical.radio input[type="radio"] { +.radio-vertical.radio input[type=radio] { opacity: 1; z-index: 0; margin-top: 2px; } - .radio-vertical.radio label::before { content: none; } @@ -123,8 +122,7 @@ h5 { /* ngProgress overrides */ .ngProgressLiteBar { background-color: #D36C08; - -webkit-box-shadow: 0 0 10px 0; - box-shadow: 0 0 10px 0; + box-shadow: 0 0 10px 0; /* Inherits the font color */ } @@ -137,7 +135,6 @@ a.list-group-item:hover, a.list-group-item:focus { background-color: #4d5051; color: #FFF; } - a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.active:focus { background-color: #343637; } @@ -155,7 +152,6 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti display: inline-block; padding-top: 4px; } - .patient-row .label-danger { margin-top: 5px; display: inline-block; @@ -175,6 +171,8 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti padding-left: 8px; font-size: 1.1em; } + +/*# sourceMappingURL=elcid.css.map */ .label-warning { background-color: #A03110; } @@ -197,15 +195,9 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti * the same height whether the ext is on 2 lines or not * and to vertically/horizontally centre the text */ - display: -webkit-box; - display: -ms-flexbox; display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + justify-content: center; + align-items: center; width: 100%; min-height: 64px; } @@ -217,25 +209,20 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti .patient-timeline-discussion { min-height: 120px; } - .patient-timeline-discussion ul { padding-left: 40px; } - .patient-timeline-discussion ul li { list-style-type: disc; } - .patient-timeline-discussion i { color: #333; } - .patient-timeline-discussion ol li { list-style-type: decimal; } -.no-touchevents -.patient-timeline-discussion i.edit { +.no-touchevents .patient-timeline-discussion i.edit { display: none; } @@ -258,35 +245,28 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti margin-left: 10px; margin-right: 10px; } - .lab-tests .lab-test-row { padding-top: 10px; margin-left: 10px; margin-right: 10px; padding-bottom: 10px; } - .lab-tests .lab-test-row.selectable:hover { background-color: #f5f5f5; } - .lab-tests .observation-graph-pane { padding-top: 10px; padding-bottom: 10px; } - .lab-tests .c3-region.too-high { fill: rgba(224, 47, 3, 0.5); } - .lab-tests .c3-region.too-low { fill: rgba(224, 47, 3, 0.5); } - .lab-tests .too-high { color: #E02F03; } - .lab-tests .too-low { color: #E02F03; } @@ -308,7 +288,6 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti .trends-panel { min-height: 395px; } - .trends-panel .no-results { padding-top: 120px; } @@ -329,7 +308,6 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti border-color: #006c96; border-width: 3px; } - .central-info-alert.alert.alert-info .btn { padding-left: 50px; padding-right: 50px; @@ -338,11 +316,9 @@ a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.acti .panel tr.table-edit td { vertical-align: middle; } - .panel tr.table-edit i.edit { visibility: hidden; } - .panel tr.table-edit:hover i.edit { visibility: visible; } @@ -355,7 +331,6 @@ i.blood-culture-edit { div.blood-culture-edit:hover { background-color: #f4f8fc; } - div.blood-culture-edit:hover i { display: inline-block; font-size: 28px; @@ -383,11 +358,9 @@ div.add-isolate:hover { font-size: 18px; margin-left: -20px; } - .form-hint .success { color: #0091C9; } - .form-hint .failure { color: #f76c51; } @@ -438,18 +411,15 @@ div.add-isolate:hover { min-height: calc(100vh - 50px); padding-left: 1%; } - .left-menu h3 { padding-top: 18px; } - .left-menu a { width: 100%; display: block; padding: 2px; color: #FFF; } - .left-menu a:hover { background: #343637; text-decoration: none; @@ -467,12 +437,10 @@ div.add-isolate:hover { .ward-name-list .row { border-bottom: 1px solid #343637; } - .ward-name-list a { padding: 12px 6px 12px 6px; display: block; } - .ward-name-list a:hover { background: #343637; } @@ -516,23 +484,19 @@ div.add-isolate:hover { .tb-clinic-list { background-color: #FFF; } - .tb-clinic-list .date-header { padding-left: 10px; padding-bottom: 3px; border-bottom: 3px solid #D36C08; margin-bottom: 0; } - .tb-clinic-list .date-header .date-header-link { display: none; color: #999; } - .tb-clinic-list .date-header .date-header-link:hover { text-decoration: none; } - .tb-clinic-list .date-header:hover .date-header-link { display: inline; } @@ -566,4 +530,24 @@ div.add-isolate:hover { .nowrap { white-space: nowrap; } -/*# sourceMappingURL=elcid.css.map */ \ No newline at end of file + +.long-form-results-row .fa-star { + color: #9cc96b; +} +.long-form-results-row .star-obs-container { + display: inline-block; + width: 20px; +} +.long-form-results-row .star-obs { + visibility: hidden; + display: none; +} +.long-form-results-row:hover, .long-form-results-row.starred { + background-color: #f3f2f2; +} +.long-form-results-row:hover .star-obs, .long-form-results-row.starred .star-obs { + visibility: visible; + display: inline-block; +} + +/*# sourceMappingURL=elcid.css.map */ diff --git a/elcid/assets/css/elcid.css.map b/elcid/assets/css/elcid.css.map index d7375611a..a94d50f88 100644 --- a/elcid/assets/css/elcid.css.map +++ b/elcid/assets/css/elcid.css.map @@ -1,9 +1 @@ -{ - "version": 3, - "mappings": "AAoBA,AAAA,IAAI,CAAA;EACA,gBAAgB,EAdf,IAAI;EAeL,MAAM,EAAE,UAAU;CACrB;;AAED,AAAA,MAAM,CAAC;EACH,KAAK,EAbD,OAAO;CAcd;;AAED,AAAA,gBAAgB,CAAC,gBAAgB,CAAC;EAC9B,YAAY,EAAE,GAAG;EACjB,aAAa,EAAE,GAAG;CACrB;;AACD,AAAA,gBAAgB,CAAC,UAAU,AAAA,eAAe;AAC1C,gBAAgB,CAAC,gBAAgB,AAAA,eAAe,CAAC;EAC7C,UAAU,EAAE,IAAI;CACnB;;AAED,AAAA,iBAAiB,CAAA;EACb,UAAU,EAAE,GAAG;CAClB;;AAED,AAAA,uBAAuB,CAAA;EACnB,aAAa,EAAE,CAAC;CACnB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c,EAAE,GAAG;EACnB,aAAa,EAAE,iBAAiB;EAChC,aAAa,EAAE,CAAC;CAcnB;;AApBL,AAQO,eARQ,CAEX,YAAY,CAMT,iBAAiB,CAAA;EACf,OAAO,EAAE,IAAI;EACb,KAAK,EAAE,IAAI;CAKZ;;AAfR,AAYS,eAZM,CAEX,YAAY,CAMT,iBAAiB,AAId,MAAM,CAAA;EACL,eAAe,EAAE,IAAI;CACtB;;AAdV,AAiBO,eAjBQ,CAEX,YAAY,AAeR,MAAM,CAAC,iBAAiB,CAAA;EACxB,OAAO,EAAE,MAAM;CACf;;AAKR,AACE,WADS,CACT,CAAC,CAAA;EACC,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,CAAC;CACjB;;AAIH,AAAA,WAAW,AAAA,mBAAmB,CAAA;EAC5B,gBAAgB,EAAE,OAAO;EACzB,cAAc,EAAE,IAAI;CACrB;;AAED,AAAA,aAAa,AAAA,mBAAmB,CAAA;EAC9B,UAAU,EAAE,CAAC;CACd;;AAGD,AAAA,cAAc,AAAA,uBAAuB,CAAA;EAClC,QAAQ,EAAE,KAAK;EACf,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,EAAE;CACb;;AAED,AACE,uBADqB,AAAA,SAAS,CAC9B,EAAE,CAAA;EACA,SAAS,EAAE,IAAI;EACf,UAAU,EAAE,GAAG;EACf,aAAa,EAAE,GAAG;CACnB;;AAGH,AAAA,OAAO,CAAA;EACL,WAAW,EAAE,MAAM;CACpB", - "sources": [ - "elcid.scss" - ], - "names": [], - "file": "elcid.css" -} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["elcid.scss"],"names":[],"mappings":"AAoBA;EACI,kBAdC;EAeD;;;AAGJ;EACI,OAbI;;;AAgBR;EACI;EACA;;;AAEJ;AAAA;EAEI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACE;;;AAGF;EACI;;;AAGJ;EAAc,kBAtDJ;;;AAuDV;EAAe,kBApDH;;;AAsDZ;EACE,OA1DQ;;;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;EAGE;;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAKF;EACE;;AAGF;EACE;;AAIA;EACE;;;AAON;AAAA;EAEE;;;AAGF;EACI;;AACA;EACI;EACA;EACA;;;AAIR;EACE;;;AAGF;EACI;;;AAGJ;EACE;;;AAGF;EACE;;;AAGF;EACI;EACA;EACA;;AAEA;EACI,OA5ZE;;AA+ZN;EACI,OAvZA;;;AA2ZR;EACI;;;AAGJ;EACI;;;AAEJ;EACI;;;AAEJ;EACI;;;AAIJ;EACI,OAtaO;;;AAyaX;EACI;EACA;;;AAEJ;EACI;;;AAGJ;EACI;EACA;EACA;;;AAGJ;EACI,kBA1bK;EA2bL,OAlcI;EAocJ;EACA;EACA;EACA;EACA;EACA;EAEA;;AAEA;EACI;;AAGJ;EACI;EACA;EACA;EACA,OArdA;;AAwdJ;EACI,YAhdG;EAidH;;;AAKR;EACI;EACA;EACA;EACA;EACA;EACA;;;AAIA;EACI;;AAEJ;EACI;EACA;;AAEJ;EACI,YAxeG;;;AA2eX;EACI,kBAxee;;;AA2enB;EACI;EACA;EACA;;;AAOJ;EACI;;;AAGJ;EACI,kBAhgBK;;;AAmgBT;EACI;EACA;;;AAGJ;EACI,kBAzgBK;;;AA4gBT;EACI;EACA;;;AAGJ;EACI;;;AAGJ;EACI,kBA7hBI;;AA8hBJ;EACI;EACA;EACA;EACA;;AAED;EACE;EACA;;AAEA;EACE;;AAIJ;EACC;;;AAON;EACE;EACA;;;AAKJ;EACE;EACA;;;AAGF;EACE;;;AAIF;EACG;EACA;EACA;;;AAID;EACE;EACA;EACA;;;AAIJ;EACE;;;AAIE;EACI,OAllBA;;AAolBN;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACI;;AAEF;EACE;EACA","file":"elcid.css"} \ No newline at end of file diff --git a/elcid/assets/css/elcid.scss b/elcid/assets/css/elcid.scss index 778dfc8ac..6872ed906 100644 --- a/elcid/assets/css/elcid.scss +++ b/elcid/assets/css/elcid.scss @@ -602,3 +602,25 @@ div.add-isolate:hover{ .nowrap{ white-space: nowrap; } + +.long-form-results-row{ + .fa-star{ + color: $green; + } + .star-obs-container{ + display: inline-block; + width: 20px; + } + .star-obs{ + visibility: hidden; + display: none; + } + &:hover, &.starred{ + background-color: lighten($obsidian-light, 16%); + + .star-obs{ + visibility: visible; + display: inline-block; + } + } +} diff --git a/elcid/assets/js/elcid/controllers/result_view.js b/elcid/assets/js/elcid/controllers/result_view.js index 0d3e929e0..187c24258 100644 --- a/elcid/assets/js/elcid/controllers/result_view.js +++ b/elcid/assets/js/elcid/controllers/result_view.js @@ -1,11 +1,12 @@ angular.module('opal.controllers').controller('ResultView', function( - $scope, LabTestResults, ngProgressLite + $scope, LabTestResults, ngProgressLite, StarObservation ){ "use strict"; var vm = this; this.labTests = []; this.showAll = {}; + this.starObservation = StarObservation; this.parseFloat = parseFloat; this.Math = window.Math; @@ -55,5 +56,15 @@ angular.module('opal.controllers').controller('ResultView', function( vm.showAll[what] = true; } - vm.getLabTests($scope.patient); + /* + * If the view is the result page and the tests have not + * loaded then load the results. + * + * After we've loaded them, cache them. + */ + $scope.$watch('view', function(){ + if(!_.size(vm.lab_tests) && $scope.view === "test_results"){ + vm.getLabTests($scope.patient); + } + }) }); diff --git a/elcid/assets/js/elcid/directives.js b/elcid/assets/js/elcid/directives.js index a85444389..3d8454b47 100644 --- a/elcid/assets/js/elcid/directives.js +++ b/elcid/assets/js/elcid/directives.js @@ -105,19 +105,25 @@ directives.directive("populateLabTests", function(InitialPatientTestLoadStatus, episode ); - // make sure we are using the correct - // js object scope(ie this) patientLoadStatus.load(); scope.patientLoadStatus = patientLoadStatus; - - if(!scope.patientLoadStatus.isAbsent()){ - scope.patientLoadStatus.promise.then(function(){ - // success - LabTestSummaryLoader.load(patientId).then(function(result){ - scope.data = result; - }); - }); + var loadData = function(){ + if(!scope.patientLoadStatus.isAbsent()){ + scope.patientLoadStatus.promise.then(function(){ + // success + LabTestSummaryLoader.load(patientId).then(function(result){ + scope.data = result; + }); + }); + } } + scope.$watch('episode.category_name', function(){ + loadData(); + }); + scope.$watch('view', function(){ + loadData(); + }); + loadData(); } }; }); diff --git a/elcid/assets/js/elcid/services/lab_test_summary_loader.js b/elcid/assets/js/elcid/services/lab_test_summary_loader.js index 59ca15b54..57e801cf0 100644 --- a/elcid/assets/js/elcid/services/lab_test_summary_loader.js +++ b/elcid/assets/js/elcid/services/lab_test_summary_loader.js @@ -7,7 +7,7 @@ angular.module('opal.services').factory('LabTestSummaryLoader', function($q, $ht var load = function(patientId){ var deferred = $q.defer(); var patientUrl = url + '' + patientId + '/'; - $http({ cache: true, url: patientUrl, method: 'GET'}).then(function(response) { + $http.get(patientUrl).then(function(response) { deferred.resolve(response.data); }, function() { console.error("unable to load in the infection_service_summary_api"); diff --git a/elcid/templates/detail/infection_service.html b/elcid/templates/detail/infection_service.html index 7df310287..bd2671a6a 100644 --- a/elcid/templates/detail/infection_service.html +++ b/elcid/templates/detail/infection_service.html @@ -1,42 +1,44 @@ {% load panels %} {% load forms %} -
- [[ par_obs ]] -
+ - - -- | - | - - [[ date | displayDate ]] - - | -- | - -
---|---|---|---|
[[ observation_name ]] | -- [[ resultView.lab_tests[test_name].instances.observation_ranges[observation_name] ]] - [[ resultView.lab_tests[test_name].instances.observation_units[observation_name] ]] - | - -
-
- - [[ par_obs ]] - - - |
- - | - -
+ | + | + + [[ date | displayDate ]] + + | ++ | + +
---|---|---|---|
[[ observation_name ]] | ++ [[ resultView.lab_tests[test_name].instances.observation_ranges[observation_name] ]] + [[ resultView.lab_tests[test_name].instances.observation_units[observation_name] ]] + | + +
+
+ + [[ par_obs ]] + + + |
+ + | + +