dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41384
Re: Current Dis-aggregation vs Historical via API
Hi Tim,
I think the short answer to your question is there is no API to tell you
this directly. The database does not version category option combos, so
there is no real way to know what is historical versus what is current. In
your particular case, you might be able to leverage the "created" time
stamp, which differs between the two sets of dis-aggregations, but again,
you might have to make some assumptions there.
I think the design, as it is at the moment, is not how the category option
combos are intended to be used, because you have overlapping options,
namely 12-59m contains "12-59m, Male" and "12-59m Female". If all three of
these are reported (which they should be from the data entry form looking
at the design), you will end up with duplicates in the analytics. Category
option combos should be exclusive, and not overlap.
So, I think what should have been done in this case, is to create a totally
new category combo, and then change the data element's disaggregation to
the new combo. Changing category combos after the fact usually leads to all
sorts of problems, but creating new ones is pretty easy. DHIS2 will not
track this change, but you could implement a trigger function on
"dataelement" to audit when a category combo changes for a given data
element, to give you a historical view of the data element, and how its
disaggregations may have changed over time. But, there is no API in DHIS2
which would do this for you.
Regards,
Jason
On Mon, Nov 16, 2015 at 8:17 PM, Timothy Harding <tharding@xxxxxxxxxxxxxx>
wrote:
> Hello DHIS2 Devs!
>
> API question for the API Gurus:
>
> During configuration on a recent project, maybe dis-aggregation groups
> were changed and updated after their Category Option Combos were initially
> generated. They do not have data associated with them, but I think that is
> beside the point for my question. Even if they did have data, I'm asking
> for a why to get the "current" CatOptCombos, rather than "every"
> CatOptCombo that has ever been assigned to this Catcombo.
>
> Using the demo server, say I change:
> Morbidity Cases
> to
> Morbidity Cases + Gender
>
> https://apps.dhis2.org/demo/api/categoryCombos/t3aNCvHsoSn
>
> The API response for this one will go from:
> <categoryOptionCombos>
> <categoryOptionCombo id="S34ULMcHMca" code="COC_358963"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/S34ULMcHMca">
> <name>0-11m</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="jOkIbJVhECg" code="COC_358966"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/jOkIbJVhECg">
> <name>15y+</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="wHBMVthqIX4" code="COC_358964"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/wHBMVthqIX4">
> <name>12-59m</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="SdOUI2yT46H" code="COC_358965"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/SdOUI2yT46H">
> <name>5-14y</name>
> </categoryOptionCombo>
> </categoryOptionCombos>
>
>
> To:
> <categoryOptionCombos>
> <categoryOptionCombo id="Q1wnnh5N6xV"
> created="2015-11-16T19:07:02.228+0000"
> lastUpdated="2015-11-16T19:07:02.228+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/Q1wnnh5N6xV">
> <name>0-11m, Female</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="wHBMVthqIX4" code="COC_358964"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/wHBMVthqIX4">
> <name>*12-59m*</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="uTaBiwZwiPL"
> created="2015-11-16T19:07:02.230+0000"
> lastUpdated="2015-11-16T19:07:02.230+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/uTaBiwZwiPL">
> <name>0-11m, Male</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="Up9OdlykfWA"
> created="2015-11-16T19:07:02.233+0000"
> lastUpdated="2015-11-16T19:07:02.233+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/Up9OdlykfWA">
> <name>5-14y, Female</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="iKsHpNDzlwC"
> created="2015-11-16T19:07:02.237+0000"
> lastUpdated="2015-11-16T19:07:02.238+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/iKsHpNDzlwC">
> <name>15y+, Female</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="OvNfjvOJCoK"
> created="2015-11-16T19:07:02.231+0000"
> lastUpdated="2015-11-16T19:07:02.231+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/OvNfjvOJCoK">
> <name>12-59m, Female</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="wIZ6pgCauQZ"
> created="2015-11-16T19:07:02.232+0000"
> lastUpdated="2015-11-16T19:07:02.232+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/wIZ6pgCauQZ">
> <name>12-59m, Male</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="SdOUI2yT46H" code="COC_358965"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/SdOUI2yT46H">
> <name>*5-14y*</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="S34ULMcHMca" code="COC_358963"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/S34ULMcHMca">
> <name>*0-11m*</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="jOkIbJVhECg" code="COC_358966"
> created="2011-12-24T12:24:25.319+0000"
> lastUpdated="2011-12-24T12:24:25.319+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/jOkIbJVhECg">
> <name>*15y+*</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="YfbYe5fnM0M"
> created="2015-11-16T19:07:02.234+0000"
> lastUpdated="2015-11-16T19:07:02.235+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/YfbYe5fnM0M">
> <name>5-14y, Male</name>
> </categoryOptionCombo>
> <categoryOptionCombo id="wSlHZb6eO6B"
> created="2015-11-16T19:07:02.239+0000"
> lastUpdated="2015-11-16T19:07:02.239+0000" href="
> https://apps.dhis2.org/demo/api/categoryOptionCombos/wSlHZb6eO6B">
> <name>15y+, Male</name>
> </categoryOptionCombo>
> </categoryOptionCombos>
>
>
>
> So *rightly*, it retains its older CatOptCombos, because of course there
> might be data associated with those in the datavalue table. So I'm not
> looking to prune these. Without writing something to crawl through the api
> to figure out the "current" state, is there an existing API call that can
> do this? I know there must be, or someone has done it in JAVA because the
> data entry forms all can tell the "current" dis-aggregations without issue.
> Thanks and let me know if I can clarify my ask any better.
>
> Cheers!
>
> *Timothy Harding*
> Sr. Systems Analyst, BAO Systems
> +1 202-536-1541 | tharding@xxxxxxxxxxxxxx | http://www.baosystems.com | Skype:
> hardingt@xxxxxxxxx | 2900 K Street, Suite 404, Washington D.C. 20007
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
--
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049
Follow ups
References