-
-
Notifications
You must be signed in to change notification settings - Fork 209
-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate Z-Score within app workflow form #2915
Comments
Prioritising as this should be included in 2.9 |
To get this to work... Charts docAdd a doc to the couchdb which stores the raw data. Here's one I generated for the WHO data provided above: doc.zip Update the formExample: <?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>PNC Visit Report</h:title>
<model>
<instance>
<data id="PNCV" version="2015-06-05">
<contact>
<_id />
</contact>
<zscore>
<sex />
<weight />
<height />
<age />
<wfa />
<hfa />
<wfh />
</zscore>
</data>
</instance>
<bind nodeset="/data/contact/_id" type="db:person" />
<bind nodeset="/data/zscore/weight" type="decimal" />
<bind nodeset="/data/zscore/height" type="decimal" />
<bind nodeset="/data/zscore/age" type="integer" />
<bind nodeset="/data/zscore/sex" type="string" />
<bind nodeset="/data/zscore/wfa" type="decimal" />
<bind nodeset="/data/zscore/hfa" type="decimal" />
<bind nodeset="/data/zscore/wfh" type="decimal" />
</model>
</h:head>
<h:body>
<input appearance="db-object" ref="/data/contact/_id">
<label>Who is the patient?</label>
<hint>Select a person from list</hint>
</input>
<group appearance="zscore" ref="/data/zscore">
<select1 ref="sex" appearance="zscore-sex">
<label>Sex</label>
<item>
<label>Female</label>
<value>female</value>
</item>
<item>
<label>Male</label>
<value>male</value>
</item>
</select1>
<input ref="weight" appearance="zscore-weight">
<label>Weight (kg)</label>
</input>
<input ref="height" appearance="zscore-height">
<label>Height (cm)</label>
</input>
<input ref="age" appearance="zscore-age">
<label>Age (days)</label>
</input>
<input ref="wfa" appearance="zscore-weight-for-age">
<label>Weight for age z-score</label>
</input>
<input ref="hfa" appearance="zscore-height-for-age">
<label>Height for age z-score</label>
</input>
<input ref="wfh" appearance="zscore-weight-for-height">
<label>Weight for height z-score</label>
</input>
</group>
</h:body>
</h:html> The |
LGTM, merging. |
Allow replication of zscore charts doc. Issue: medic/cht-core#2915
Add Enketo zscore widget and service. Issue: #2915
I did some acceptance testing for this issue on the alpha instance that @abbyad shared with me: https://v2-alpha.app.medicmobile.org/ I randomly tested ~50 cases from a dataset of 1400 measurements that CiC's promotoras collected this month. The calculator is working really well for the most part. I did notice that it produces a z-score of -4 for any combination of gender, weight, height, and age that should give a result of -3.x. This is the only issue we've been able to identify. As an example, a boy with a weight of 11.704545 kg, a height of 83 cm, and an age of 1072 days should have a HFA of -3.4. The calculator returns -4. See case 1003 or 1008 in the dataset above for more examples. |
@guptasanchay You're absolutely right. There was a bug where any zscore between -3.0 and -3.9 was returning as -4. This is now patched and I've added that CIC case as a unit test. @abbyad Can you please deploy on the right instance so testing can resume? |
Updated to |
It may be a good idea to rename The chart is typically the visual graph, whereas table refers to the list of values used to generate the chart. On the WHO site they split these up ChartTable
|
Okay, retested and everything looks great! Thanks all @abbayad, next steps before we can get this onto the CiC instance? |
@guptasanchay I think you are all set, so moving to Ready. |
@garethbowen is there an existing XLS Form for the above example? |
@derickl check the CIC Guatemala project in medic-projects |
@sglangevin, Derick and I were looking at the xml that Gareth shared and thought it would be easier to implement for cic-guatemala if we could view it as an xls form. |
Should be pretty straightforward to translate from XML to XLS. Looks like all you have to do is make sure to list the correct |
@sglangevin that's what we tried. We have a group in the malnutrition_visit_test.xls form with appearance of zscore containing the sex, age in days, weight, height, wfa, hfa, and wfh fields (with the same types and appearances as outlined above). The calculations aren't happening. What are we missing from Gareth's XML form? Is there something that needs to be added to the input or contact group? Our zscore group is lower down in the form embedded within the assessment. |
@garethbowen, @ranjuts was going over designs for a similar project in Indonesia and an interesting question came up: there are other partners who might be using variations on the z-score reference tables we used for this feature. I imagine it wouldn't be too challenging for you to implement the same feature with a different set of tables, but is there a better way for us to support future variations without creating a new request every time? |
@guptasanchay What's different in the variation - is the format or the values or... something else? |
@guptasanchay I recommend starting simple. Instead of adding to a complex form, try to get the simplest case working, then add. |
@garethbowen, the difference would just be in the values I believe. Format would stay the same. Also, @derickl and I tried implementing this feature in an assessment form and in a separate form with only the calculator and everything else removed. We're not having any luck. Could you take a look at our xls and see what we're doing wrong? The form is titled "malnutrition_zscore_calculator" and you can find it in the cic-guatemala folder (cc @garethbowen @abbyad). Really running on crunch time now |
Moving this conversation to private channel since the feature is tested and complete. We can open new issues if there are any problems with this feature, although we have yet to identify any. |
@guptasanchay The values are stored in a doc in the database (id: |
Hey @abbyad . I am trying to implement We tried to do an We have the form uploaded the form |
I just tested this and managed to get it to work. See https://github.com/medic/medic-projects/commit/7919c945c13f9846b06be121fa9911b461ea0304. Any further config issues should be opened in medic-projects. |
From https://github.com/medic/medic-projects/issues/810, emphasis mine:
The z-score tables for this first project are based on WHO tables, but these may change between projects and also over time.
The text was updated successfully, but these errors were encountered: