← Back to team overview

dhis2-users team mailing list archive

Re: API: dataSets.dataElements

 

The reason why there isn't a backward compatible api is because the
underlying model has changed to support overriding the categorycombo per
dataset.  So a dataset no longer has dataElements, but dataSetElements.
The dataSetElement is a compound object consisting of both a dataelement
reference and (possibly) an overridden categoryCombo.  Where you haven't
overriden anything you don't see the latter.

I am sure this has broken a few things out there.

I wonder if a non-breaking solution would be to support the same behaviour
as before with the dereferencing being done behind the scenes.  With the
possible surprise that the response might also include a sibling
categorycombo with the dataelement.  And the risk that if legacy api users
ignore that fact (which almost by definition they will) they will report
the wrong categorycombo for the dataelement.

Or, even more transparently, any overriden categorycombo could be used to
replace the categorycombo in the returned dataelement.  In which case
everything would look exactly as before.  But users should be warned to not
make any assumption about categorycombo and *always* return that field as
part of the query.  I can see that becomes a pretty ugly constraint
though.  Possibly the previous suggestion is safer.

Lars and/or Morten would know best the reasons for taking the plunge and
doing it the way that it is done.  I wasn't in on the design discussion.
Possibly over the longer term it is a cleaner implementation to have the
api reflect the actual underlying changed model.  Not sure.





On 3 November 2016 at 14:21, Michael Mwebaze <michael.mwebaze@xxxxxxxxx>
wrote:

> Thanks Uwe,
>
> I have been trying to figure this out as well.
>
>
>
> On 3 November 2016 at 04:04, Uwe Wahser <uwe@xxxxxxxxx> wrote:
>
>> just found the answer myself: it has to be
>> https://play.dhis2.org/demo/api/dataSets/N4fIX1HL3TQ.json?pa
>> ging=false&fields=dataSetElements[dataElement[id,code,name]]
>>
>> the other question remains: why cant I use the old syntax by adding 24 or
>> 23 to
>> the url?
>>
>> Regards,
>>
>> Uwe
>>
>> ---
>> > Uwe Wahser <uwe@xxxxxxxxx> hat am 3. November 2016 um 09:52
>> geschrieben:
>> >
>> >
>> > Dear all,
>> >
>> > I am a bit confused about the api in 2.25. Before, I was able to list
>> > dataElements of a given dataSet via
>> > https://play.dhis2.org/demo/api/dataSets/N4fIX1HL3TQ.json?pa
>> ging=false&fields=dataElements[id,code,name]
>> >
>> > As I understand from the manual, this has changed to
>> > https://play.dhis2.org/demo/api/dataSets/N4fIX1HL3TQ.json?pa
>> ging=false&fields=dataSetElements[id,code,name]
>> >
>> > Two issues in this context:
>> > 1 - I would have expected to be able to use the old syntax by adding 24
>> or 23
>> > into the url - that doesn't work.
>> > 2 - the new syntax only works for the id of a dataSetElement and
>> doesn't bring
>> > up code nor name. fields=dataSetElements[:all] only brings up a few
>> attribute,
>> > but not neither code nor name.
>> >
>> > Am I missing something? Haven't tested with other sub-ressources, yet.
>> >
>> > Thanks,
>> >
>> > Uwe
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~dhis2-users
>> > Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~dhis2-users
>> > More help   : https://help.launchpad.net/ListHelp
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References