← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] API: dataSets.dataElements

 

Hi Uwe,

like you have observed, the Web API versioning applies to query parameters,
responses and most things, but not the metadata model entirely. This
because we currently do not have a "data transfer object" layer between the
DHIS 2 metadata model and what we render in the API. As a consequence you
might see breaking changes in the metadata model, such as for associations
between objects.

We are working on this long-term, and trying to keep the changes to a
minimum. Note that we do not rename fields or make unnecessary model
changes, and that we documented such changes in the upgrade notes (see Web
API):

https://www.dhis2.org/225-upgrade



regards,

Lars





On Thu, Nov 3, 2016 at 6:21 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:

> 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
>>
>>
>
> _______________________________________________
> 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
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
lars@xxxxxxxxx
http://www.dhis2.org <https://www.dhis2.org/>

References