WHO Weight Graph Template Specification

Background

The JavaRosa code currently contains a widget which retrieves a set of records for a patient, and displays a graph with the date of the measurements scaled on the X axis, and the value of the measurements scaled on the Y axis. We also have the ability to display a 'template' set of lines on the same graph, to give context for the measurement. We want to be able to display the WHO's weight-for-age chart for the ages of 0-5 years old, with the proper lines for girls and boys.

Technical Background of Existing Work

org.javarosa.polish.chatterbox.extensions project

  • LineChart - The actual CustomItem that displays the lines. A Bit rough around the edges. Plots inputted points into a line, until the item is told to begin a new line.
  • GraphWidget - Takes in a vector of DateValueTuples and generates a graph of the measurements. Currently draws in two phases. First it draws the line from the records, then the line from the Template.
  • IGraphTemplate - Takes in the vector of DateValueTuples from the GraphWidget, and produces a set of Lines to be drawn on a graph.
  • WHOWeightTemplate - Currently non-functional. Contains the appropriate data references, and a reference to a Patient.

org.javarosa.patient

  • Patient - The representation of the current patient. Contains the birthdate of the patient.

org.javarosa.core.model project. util namespace

  • DateUtils - Contains a method that can be used to obtain the difference in days between two dates, allowing the scaling of measurements that are passed in (which are absolute dates) into the 0->5 year timeline that should be the length of the X axis.

other

Instructions for setting up this project can be found here.

Rough Technical Outline

The general framework for chatterbox is configured, and the modifications should take place only to the polish.chatterbox.extensions project. The following elements comprise the specification for this Task.

  1. Modify GraphWidget to draw two different ways. One is the default, which displays all of the available data points taking up as much of the graph's drawing space as possible. This style is mostly finished and in the current code base, it should be drawn when the Graph's template is null. The other manner is to pass the data to the template, and rely on the template alone to produce lines. When this style is drawn, when a template is available and non-null, the graph widget should not independently generate any lines beyond those generated by the template
  2. Configure the WHOWeightTemplate to draw lines which contains a 0->5 year scale on the X axis, and contains the data in the link given in the technical background section This template should draw three lines in total. The first is the Median. The other two are the the positive and negative versions of the (1/2/3) standard deviation lines. We only need to be able to display one set of positive and negative deviations at a time, but we don't know which set of lines will be most useful yet, so we'd like to be able to choose later. There are two different graphs for girls and boys. The gender of the child should be obtained from the Patient object, and used to determine which to use.
  3. Configure the WHOWeightTemplate to also draw the data line that is passed in from the GraphWidget along with the ->5 year scale. All of this line should be visible in the 0->5 year range that is covered.