Wow, two months gone just like that. This week, my focus was on implementing the pre-theater data collection as per our discussions over the previous weeks. If you followed along, you’d remember that we decided to use concepts and obs groups to record the collected data.
The first thing I did was getting the patient’s allergies and showing them alongside the surgery data. Documentation is scarce on this but I remembered that the new Reference Application contained Allergy module by default. So when I view a patient, his or her allergies are listed on the profile itself. Now I just had to see the corresponding code.
Well, that didn’t work out too well. I couldn’t find how the patient profile view was coded. Fret not, let’s explore the OpenMRS core. Rummaging through the core API, I came across the PatientService class and there I found a method to get all the allergies of a patient.
Then I wanted to see the source code of the Allergies, Allergy and Allergen classes (seriously, they’re modeled like that for reasons unknown to me). But GitHub doesn’t support Ctrl-click to view source (it should. It’s 2017!) so I downloaded it, revved up an IntelliJ instance and loaded it up. Ctrl-clicked away to my heart’s content. Ah.
The Allergies class allows us to manipulate allergy data as a whole. The Allergy class drills it down to a specific allergy. Allergens are what cause the allergy, and have a particular set of reactions for it. AllergyReaction class, you see where we’re going with this.
Anyway, so I needed to use all 4 classes to display the allergies of a particular patient. Maybe we should document that somewhere in the wiki. Huh…
Another thing I did was rearranging the Surgery page. Right now I’m using the Surgery Edit view to display its summary (reuse, reuse!) so it needed a bit of moving things around to accommodate the new stuff I was adding to it.
And we really need to have a standard guide with examples on UI development. Nobody knows how the existing fragments in the UI Commons library look or work. You have to go through the code and figure things out by trial and error to get it working. And adding icons is another mess. Maybe I missed an existing guide somewhere… I doubt it though.
That’s all for this week. In-theater data collection is the next step.