dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37834
Re: How to determine if a dataset has any data values in it
This has been backported to 2.19 now.
On Tue, Jun 9, 2015 at 11:07 AM, Lars Helge Øverland <larshelge@xxxxxxxxx>
wrote:
> Hi Lorill,
>
> I think you have found the best approach to the problem.
>
> I have added support in trunk now for a "limit" query parameter that puts
> a limit on the number of records to return. So you can now append
> "&limit=1" to your query and check if any records are returned.
>
> I have updated the docs here
> <https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s10.html#d5e1798>
> .
>
> Will see if this can be backported to 2.19 later.
>
> regards,
>
> Lars
>
>
>
>
>
>
>
>
>
>
>
>
> On Mon, Jun 8, 2015 at 11:30 PM, Lorill Crees <lcrees@xxxxxxxxxx> wrote:
>
>> Hi,
>>
>> I am trying to craft a web api call to determine if a dataset has at
>> least one data value in it or not. I am not interested in the data values
>> themselves, just if any data has been uploaded / inputted into the system
>> yet or not.
>>
>> If data values did exist, I would not know what org units or periods were
>> chosen so would not be able to supply those parameters.
>>
>> I would also prefer to do this in one api call instead of having to
>> iterate through data elements until finding data (if any).
>>
>> I've been digging around the api and the best I can find right now in one
>> call is this:
>>
>> dhis/api/dataValueSets?dataSet=QnhNNSNFE0M&startDate=1980-01-01&endDate=2020-01-01&orgUnit=
>> lZsCb6y0KDX&children=true
>>
>> where I set the start date to a far past, the end date to the future, and
>> the org unit to the level 1 parent org unit.
>>
>> This could potentially return a very large number of records which is a
>> heavy overhead when only wanting to know if dataValues > 0.
>>
>> I also tried this:
>>
>> dhis/api/dataValueSets?dataSet=QnhNNSNFE0M&startDate=1980-01-01&endDate=2020-01-01&orgUnit=
>> lZsCb6y0KDX&children=true&fields=dataValues:: isNotEmpty
>>
>> but the "::isNotEmpty" does not seem to be in place for this call. I also
>> could not seem to return paged data to reduce the payload.
>>
>> Do you have any other suggestions of how I can do this? To give context,
>> I will be iterating through all Datasets in the system and displaying them
>> in a list, so I need something that is fairly efficient. I wouldn't want to
>> have to iterate through each data element individually unless necessary.
>>
>> Thanks,
>>
>> Lorill
>>
>>
>> _______________________________________________
>> 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 <http://www.dhis2.org/>
> University of Oslo
> Skype: larshelgeoverland
> http://www.dhis2.org <https://www.dhis2.org>
>
>
--
Lars Helge Øverland
Lead developer, DHIS 2 <http://www.dhis2.org/>
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org>
Follow ups
References