Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected a mistake in the example of how zcore was references, from either 'zscores' or 'zscores_list' to 'zscore' or 'zscore_list'

...

First, upload the following z-score table using the Manage Lookup Tables page.  This table covers children between 0 and 60 months of age, but you can modify the table as needed for your project. 

zscoreszscore.xlsx

Including Lookup Table Information in the Form

Once we've defined a zscore lookup table, we need to reference it in our form.  Edit the form XML and add an "instance" line that references the name of the table.  You can place this above any existing instance tags in your form.  

<instance id="zscoreszscore" src="jr://fixture/item-list:zscore"></instance>

...

Then add a hidden value (zscore) to calculate the approximate z-score from the table.  Assuming the name of your lookup table is "zscoreszscore" the calculation for this hidden value should be:

if(/data/weight < instance('zscoreszscore')/zscoreszscore_list/zscoreszscore[gender = /data/gender][month = /data/age]/sd3neg, -3, if(/data/weight < instance('zscoreszscore')/zscoreszscore_list/zscoreszscore[gender = /data/gender][month = /data/age]/sd2neg, -2, if(/data/weight < instance('zscoreszscore')/zscoreszscore_list/zscoreszscore[gender = /data/gender][month = /data/age]/sd1neg, -1,0)))

...

This hidden value will be -3, -2, -1, or 0 which corresponds to the child being more than -3, -2, and -1 standard deviations from the mean.  You can then use this hidden value for further calculations or display it back to the user.