← Back to team overview

dhis2-devs team mailing list archive

Re: Hello, can you help me with a query with web api.

 

Hi,

I would not start calculating aggregated data from the raw data
(dataValueSets resource) as there are lots of business logic and
performance concerns involved in that process. Rather construct daily
period identifiers in your app like Knut suggests and use the
analytics web<http://www.dhis2.org/doc/snapshot/en/user/html/ch25.html>
api
or java<http://www.dhis2.org/download/apidocs/org/hisp/dhis/analytics/AnalyticsService.html>api.
Pulling out daily values for a full year in a single report sounds
like a lot in any case.

Lars



On Tue, Oct 1, 2013 at 3:43 PM, Saptarshi Purkayastha <sunbiz@xxxxxxxxx>wrote:

> Hi Sushil,
>
> I've tried that the dataValueSets allows for reading data values, based on
> startDate and endDate... but not indicators.
> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s11.html
>
> So you will have to calculate indicators based on their definition on your
> own.
> There is a small bug that I remember seeing sometime back that throws a
> NullPointerException if you pass only one orgUnit. The workaround is that
> you will have to pass a dummy orgunit (say the root orgUnit) that will not
> have data for the required dataset.
>
> Does this work for you??
>
> ---
> Regards,
> Saptarshi PURKAYASTHA
> ------------------------------
> From: knutst@xxxxxxxxx
> Date: Tue, 1 Oct 2013 13:05:43 +0200
> To: larshelge@xxxxxxxxx
> CC: sushilchitr@xxxxxxxxx; dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Dhis2-devs] Hello, can you help me with a query with web api.
>
>
> Hi Sushil,
>
> The API does not have extensive support for daily data yet. There are no
> relative periods for days, so you have to list them each explicitly, using
> the yyyyMMdd format:
> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s03.html
>
> Unfortunately, I think this means you cannot get daily data for a whole
> year in one query, because the URL would be more than 9*365 (over 3000)
> characters long. So you would probably have to split it.
>
> I agree that for daily data (what is the use case?), start and end date
> would be much more convenient. But you could build that logic in the
> javascript that constructs the query URL.
>
> Knut
>
>
>
>
> On Tue, Oct 1, 2013 at 12:20 PM, Lars Helge Øverland <larshelge@xxxxxxxxx>wrote:
>
> Thanks Namrata for the good explanation.
>
> Sushil, you cannot use start and end dates for the /analytics resource,
> you must use the standard period types (frequencies) as described here<http://www.dhis2.org/doc/snapshot/en/user/html/ch25s03.html>.
> Note that you can define fixed and relative periods in your query. Docs
> here:
>
> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s21.html
>
> Lars
>
>
> On Mon, Sep 30, 2013 at 6:52 PM, Namrata Nehete <n.nehete@xxxxxxxxx>wrote:
>
> Hi,
>
> To get data for relative period (last week, last month etc) we use,
>
> http://
> <serverURL>/api/analytics.json?dimension=dx:Uvn6LCg7dVU&dimension=pe:LAST_WEEK&filter=ou:ImspTQPwCqd
>
> To get data by specifying period we use,
>
> http://
> <serverURL>/api/analytics.json?dimension=dx:Uvn6LCg7dVU&dimension=pe:20130924;20130930&filter=ou:ImspTQPwCqd
>
> I am not sure how to get data for indicator by specifying start date and
> end date.
>
> You should ask on dev list for that.
>
> ---
> Regards,
> Namrata Nehete.
>
>
> On Mon, Sep 30, 2013 at 3:54 PM, Knut Staring <knutst@xxxxxxxxx> wrote:
>
> Hi Sushil,
>
> Remember you can also ask such questions on the dev list (are you a
> member)?
>
> DHIS 2 developers <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
>
> Knut
>
>
>
>
> On Mon, Sep 30, 2013 at 11:32 AM, Sushil Chitrakar <sushilchitr@xxxxxxxxx>wrote:
>
> Hello Namrata, I hope you are all doing well.
>
> I was going though a issue in api checking if you know the solution.
>
>
> I was trying to get data for couple of indicators on the daily basis from
> a startdate to a enddate or say a yearly data for a whole year daily basis.
>
> I tried putting StartDate and enddate and chekced the daily parameter as
> well.
>
> But was not help, can you give a example for this if you have one or
> suggest me a solution.
>
> Let me know.
>
> Regards,
> Sushil
>
>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> +4791880522
> http://dhis2.org
>
>
>
> _______________________________________________
> 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
>
>
>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> +4791880522
> http://dhis2.org
>
> _______________________________________________ Mailing list:
> https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.netUnsubscribe :
> https://launchpad.net/~dhis2-devs 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
>
>

References