Wardrounds not populating

7 views
Skip to first unread message

timd...@gmail.com

unread,
May 3, 2020, 3:51:32 PM5/3/20
to OHC-OPAL
Hi there

I'm trying to set up an Opal site for use in a clinical ward, and I'm trying to get the wardround plugin operating. I'm fairly new to web development, so apologies if this is a stupid question.

I've installed the plugin, wardrounds show up on my Opal site, and I've created a test wardround in wardrounds.py (below), which returns all episodes. However, when I attempt to view the wardround, the page does not populate (see attached), and the site produces errors if I click "Next" or "Previous".

Could you possibly assist me with guidelines on how to set up the wardround plugin?

Screenshot 2020-05-03 at 21.49.37.png

Thanks!




Wardrounds.py:

class testToday(WardRound):
    display_name = 'Current'
    description  = 'Test ward round'
    
    def episodes(self):
        return Episode.objects.all()





Fred Kingham

unread,
May 4, 2020, 12:22:44 PM5/4/20
to timd...@gmail.com, OHC-OPAL
That is a fair question. The opal-wardrounds plugin is no longer actively supported.

This is because opal-wardrounds is really functionally equivalent to a patient list

We have found that actually users are generally happier using a patient list that wardrounds and would recommend something like https://github.com/fredkingham/wardround_test

which is just a patient list of the card list variety.

Does that help?

 Thanks,

 Fred



--
You received this message because you are subscribed to the Google Groups "OHC-OPAL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ohc-opal+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/ohc-opal/99fc7cf8-c7eb-4ba0-a668-a96d6be89377%40googlegroups.com.


--
Fred Kingham
Open Health Care

Timothy de Wet

unread,
May 4, 2020, 12:40:20 PM5/4/20
to Fred Kingham, OHC-OPAL
Thanks Fred, that's definitely useful! And thanks for the prompt reply.

One other query, if you don't mind:

I'm trying to get a discharge button functioning. So far I have:
- Added the a discharge.js file to my static folder, containing:

controllers.controller(
    'DischargeCtrl',
    function($scope, $modalInstance, episode){
        $scope.episode = episode;

        $scope.dischargePatient = function(){
                var ep = $scope.episode.makeCopy();
                ep.end = new Date();
                to_save.push($scope.episode.save(ep));
        }

        $scope.cancel = function() {
            $modalInstance.close('cancel');
        };
 });

- Edited _init_.py to include my JS file
- Added a button to my inpatient.html file, with an ng_click call to my dischargePatient function

 <button ng-click="dischargePatient()" class="btn btn-primary btn-lg"> 
       <i class="fa fa-home"></i> 
       <span ng-show="episode.end">Confirm</span> 
       Discharge 
     </button> 

However, the button doesn't seem to respond, or produce even an error message. This makes me think my JS file is not being recognised - could you possibly tell me what I am missing here?

Thanks again

--
Timothy de Wet | MBChB / PhD Candidate
Molecular Mycobacteriology Research Unit and Mhlanga Lab
University of Cape Town
E-mail: timd...@gmail.comt...@mhlangalab.org | Cell: +27741958395

Fred Kingham

unread,
May 4, 2020, 12:54:25 PM5/4/20
to Timothy de Wet, OHC-OPAL
Hi Tim,
 Gotcha, you need to add static files to your application.py javascripts, ie this file https://github.com/fredkingham/wardround_test/blob/master/wardtest/__init__.py

I think you might be missing an initialisation and saving of "to_save", but I'm guessing this is not the whole file!

If you want to require the collection of information on save (which is another common paradigm), it may be worth creating a discharge pathway in a similar way to the AddPatient pathway (in pathways.py) that is created with start project.

 Hope that helps,

 Fred


Timothy de Wet

unread,
May 4, 2020, 1:57:26 PM5/4/20
to Fred Kingham, OHC-OPAL
Thanks Fred

I've added the static file to the application.py, but still don't seem to manage to generate any response.

I'm trying with a simple function to try call an alert when clicked (below is the entire contents of the JS file):

controllers.controller('alertCtrl', function($scope) {
        $scope.ngFn = function () {
        alert("ngFn123 is triggered!");
        };
});

When the button below is clicked.

<button ng_click="ngFn()"
 class="btn btn-primary btn-lg"> Alert
 </button> 

I feel like there must be something obvious here I'm missing...

I will look into creating a discharge pathway, thanks!

Fred Kingham

unread,
May 4, 2020, 2:51:42 PM5/4/20
to Timothy de Wet, OHC-OPAL
Gotcha, so you need to link the controller to the page, so the episode detail has its own controller, but you can declare yours inline. Something like the below should work... (I haven't tested it). 


// Markup

<div class="btn btn-default" ng-controller="StopEpisode" ng-click="stop()">Close</div>

// controller
angular.module("opal.controllers").controller("StopEpisode", function($scope) {
    "use strict"; $scope.stop= function(){ scope.episode.end = new moment(); episode.save().then(function(){ $scope.refresh() }) } // explanation
so we're declaring a child controller that has access to the episode on the parent scope. Updating and saving it, and then reloading the episode to update the parent scope. As I say, I haven't tested it but it should work.

Thanks,

 Fred

Timothy de Wet

unread,
May 4, 2020, 3:11:21 PM5/4/20
to Fred Kingham, OHC-OPAL
Hmm. It seems to disrupt the normal population of the detail page  - would this be because it is disrupting the controller that normally populates this? 

That said, I implemented a pathway-based discharge function, which works fantastically. Thanks for the advice!
Reply all
Reply to author
Forward
0 new messages