GSoC — Week 5
This week I worked on adding charts to the patient dashboard of the android client.
Various vitals of a patient like respiration rate, pulse, body temperature etc are recorded during a visit. Currently, all the past data was displayed as a simple list to the user. A better representation was to use graphs so that proper variation in the patient’s vitals data can be easily visualised.
I intended to use William Charts as the graph library but later on found that the documentation was not proper and then I did little more digging and found MPAndroidChart. It is far better than William Chart because the graphs were more responsive and more features are included in it. Also the documentation was more user friendly so I used MPAndroidChart as the graph library and added graphs for the patients vitals.
Below are some of the screenshots after addition of the Graphs.
The main challenge I faced while working on the graphs was putting dates on the x-axis. The problem was that the entry object of the chart took only floats as input for x and y co-ordinates. So, I created a custom value formatter and sent my date value array list of strings to the formatter and set x co-ordinate as the index in the adapter and then mapped them in the formatter.
Also, the devtest04 server was down and the JSON forms were not added on the qa-refapp server so I made a dummy patient on the qa-refapp.openmrs.org server and then downloaded the patient on the android client for testing.
According the discussion on the Openmrs talk thread and issue no. AC-423, it was decided that the form should not be created on the manually on the server, rather it should be auto-created by the Android Client if missing. So, I also started working on it.