Re: [Dhis2-devs] [d2 lib] - API call failing with "Server connection failed for API request"

2018-02-21 Thread Edoardo Sabadelli
On Wed, Feb 21, 2018 at 11:31 AM, Martin Van Aken
 wrote:
> Now I'm trying a event analytics query:
>
> return getInstance().then(d2 =>
> d2.Api.getApi().get("/25/analytics/events/query/jqKm7VLgdzL?stage=tbLC6IHktf0:ou:VAPI4p81HAz;LEVEL-6=NAME"));
>
> And this show an error in the console with  "Server connection failed for
> API request"
>
> I've ran the query through the browser & Postman without any problems. I've
> debugged, the authorization header is correct.
>
> Any clue what could go wrong there?

Martin, I found one problem, possibly 2 with your code.
The first one is with the dimension parameter you're passing.

It should be:

dimension=ou:VAPI4p81HAz;LEVEL-6

instead of:

dimension:ou:VAPI4p81HAz;LEVEL-6

The second problem is URL encoding, specifically the ou dimension
query parameter.
The response I get in this case is "409: Dimension ou is present in
query without any valid dimension options."

It's better to pass the query parameters as a object in the 2nd
parameter of the get, so that the Api class takes care of all the URL
encoding, like this:

d2.Api.getApi().get('analytics/events/query/jqKm7VLgdzL', {
stage: 'tbLC6IHktf0',
dimension: 'ou:VAPI4p81HAz;LEVEL-6',
displayProperty: 'NAME'
});

Once I do this, I get a different error about missing start and end
date, which is ok since this endpoint requires those parameters:
https://docs.dhis2.org/master/en/developer/html/webapi_event_analytics.html#webapi_event_analytics_request_query_parameters

Hope this helps,
-- 
Edoardo Sabadelli
DHIS 2
University of Oslo
edoa...@dhis2.org
http://www.dhis2.org

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Dhis2-users] Error importing tracker events data

2018-02-21 Thread DJIBRIL Hakim
Thank you Lars.
it is like there is a issue doing synchronisation data between same DHIS2
instances both 2.28 ( Production and backup on local server).

export/import programs by *Metadata Dependency Export *works well
Not for export/import events. when doing export, we don't have enrollment
infomations like programAttributes data in this exported file.
Do I miss something before doing this export
Best.

2018-02-21 11:00 GMT+00:00 Lars Helge Øverland :

> Hi Hakim,
>
> this feedback indicates that some of your events are referring to a
> tracked entity instance (e.g. person) that does not exist in your
> destination system, with the identifier Ug2TixCkiAy.
>
> regards,
>
> Lars
>
>
> On 21 February 2018 at 11:54, DJIBRIL Hakim  wrote:
>
>> Hi all
>> Please Can I have help on this
>>
>> I am trying export event data from DHIS2 instance to another Instance.
>> I have the same program on both instances. But got error this error
>>
>> TypeNombre
>> Imported 0
>> updated 0
>> Ignored 1ErrorEvent.trackedEntityInstance does not point to a valid
>> tracked entity instance: Ug2TixCkiAy
>>
>> What can be the issue
>> Best
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to : dhis2-us...@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Lars Helge Øverland
> Lead developer, DHIS 2
> University of Oslo
> Skype: larshelgeoverland
> l...@dhis2.org
> http://www.dhis2.org 
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Martin Van Aken
Ok - that's not what I wanted to hear but that's quite logical - so
probably better in the end.

Thanks,

Martin

On Wed, Feb 21, 2018 at 12:18 PM, Lars Helge Øverland 
wrote:

>
>
> On 21 February 2018 at 12:12, Martin Van Aken 
> wrote:
>
>> Hi Markus & Lars,
>> Thanks both for your answers.
>>
>> Ok so: programIndicators have a more powerful evaluation engine (with the
>> d2:condition for example), but indicators can use other indicators.
>> What I'm not 100% is the consequence of using a (aggregate) indicator to
>> compose program indicators - is it still possible in this case to compute
>> values "per event" or will it only work for aggregated values per org unit
>> per period?
>>
>>
> No unfortunately not per event.
>
>
>
>
>
>> Martin
>>
>> On Wed, Feb 21, 2018 at 11:56 AM, Markus Bekken  wrote:
>>
>>> Hey Martin!
>>> - You can make composite indicators that consists of other program
>>> indicators, but program indicators can not be nested within each other
>>> directly.
>>> - Yes-  program indicator values are always based on the data in the
>>> analytics_* tables.
>>>
>>> Markus
>>>
>>> 21. feb. 2018 kl. 11:03 skrev Martin Van Aken :
>>>
>>> Hi DHIS2 dev team!
>>>
>>> I'm working on a decently large tracker program, and got some questions
>>> regarding ProgramIndicators:
>>>
>>> - It looks like ProgramIndicator can only refer to DataElements, not
>>> other ProgramIndicators (like "aggregate" Indicators can) - is there any
>>> specific reason for this? Will this constraint be left at some point in the
>>> future? Building indicators on top of other indicators is quite handy
>>> - Are the programIndicator results linked to running the analytics (when
>>> viewing them in the Event Manager app)? I tried to test that one, but was
>>> not totally sure of my results (as the pivot table & browser are doing a
>>> lot of caching too)
>>>
>>> Thanks!
>>>
>>> Martin
>>>
>>> --
>>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>>
>>> Mobile : +32 486 899 652
>>>
>>> Follow me on Twitter : @martinvanaken 
>>> Call me on Skype : vanakenm
>>> Hang out with me : mar...@joyouscoding.com
>>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>>> Company website : www.joyouscoding.com
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>>
>>
>>
>> --
>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>
>> Mobile : +32 486 899 652
>>
>> Follow me on Twitter : @martinvanaken 
>> Call me on Skype : vanakenm
>> Hang out with me : mar...@joyouscoding.com
>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>> Company website : www.joyouscoding.com
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> 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
> l...@dhis2.org
> http://www.dhis2.org 
>
>


-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Lars Helge Øverland
On 21 February 2018 at 12:12, Martin Van Aken 
wrote:

> Hi Markus & Lars,
> Thanks both for your answers.
>
> Ok so: programIndicators have a more powerful evaluation engine (with the
> d2:condition for example), but indicators can use other indicators.
> What I'm not 100% is the consequence of using a (aggregate) indicator to
> compose program indicators - is it still possible in this case to compute
> values "per event" or will it only work for aggregated values per org unit
> per period?
>
>
No unfortunately not per event.





> Martin
>
> On Wed, Feb 21, 2018 at 11:56 AM, Markus Bekken  wrote:
>
>> Hey Martin!
>> - You can make composite indicators that consists of other program
>> indicators, but program indicators can not be nested within each other
>> directly.
>> - Yes-  program indicator values are always based on the data in the
>> analytics_* tables.
>>
>> Markus
>>
>> 21. feb. 2018 kl. 11:03 skrev Martin Van Aken :
>>
>> Hi DHIS2 dev team!
>>
>> I'm working on a decently large tracker program, and got some questions
>> regarding ProgramIndicators:
>>
>> - It looks like ProgramIndicator can only refer to DataElements, not
>> other ProgramIndicators (like "aggregate" Indicators can) - is there any
>> specific reason for this? Will this constraint be left at some point in the
>> future? Building indicators on top of other indicators is quite handy
>> - Are the programIndicator results linked to running the analytics (when
>> viewing them in the Event Manager app)? I tried to test that one, but was
>> not totally sure of my results (as the pivot table & browser are doing a
>> lot of caching too)
>>
>> Thanks!
>>
>> Martin
>>
>> --
>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>
>> Mobile : +32 486 899 652
>>
>> Follow me on Twitter : @martinvanaken 
>> Call me on Skype : vanakenm
>> Hang out with me : mar...@joyouscoding.com
>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>> Company website : www.joyouscoding.com
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>>
>
>
> --
> *Martin Van Aken - **Freelance Enthusiast Developer*
>
> Mobile : +32 486 899 652
>
> Follow me on Twitter : @martinvanaken 
> Call me on Skype : vanakenm
> Hang out with me : mar...@joyouscoding.com
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
> Company website : www.joyouscoding.com
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> 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
l...@dhis2.org
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Martin Van Aken
Hi Markus & Lars,
Thanks both for your answers.

Ok so: programIndicators have a more powerful evaluation engine (with the
d2:condition for example), but indicators can use other indicators.
What I'm not 100% is the consequence of using a (aggregate) indicator to
compose program indicators - is it still possible in this case to compute
values "per event" or will it only work for aggregated values per org unit
per period?

Martin

On Wed, Feb 21, 2018 at 11:56 AM, Markus Bekken  wrote:

> Hey Martin!
> - You can make composite indicators that consists of other program
> indicators, but program indicators can not be nested within each other
> directly.
> - Yes-  program indicator values are always based on the data in the
> analytics_* tables.
>
> Markus
>
> 21. feb. 2018 kl. 11:03 skrev Martin Van Aken :
>
> Hi DHIS2 dev team!
>
> I'm working on a decently large tracker program, and got some questions
> regarding ProgramIndicators:
>
> - It looks like ProgramIndicator can only refer to DataElements, not other
> ProgramIndicators (like "aggregate" Indicators can) - is there any specific
> reason for this? Will this constraint be left at some point in the future?
> Building indicators on top of other indicators is quite handy
> - Are the programIndicator results linked to running the analytics (when
> viewing them in the Event Manager app)? I tried to test that one, but was
> not totally sure of my results (as the pivot table & browser are doing a
> lot of caching too)
>
> Thanks!
>
> Martin
>
> --
> *Martin Van Aken - **Freelance Enthusiast Developer*
>
> Mobile : +32 486 899 652
>
> Follow me on Twitter : @martinvanaken 
> Call me on Skype : vanakenm
> Hang out with me : mar...@joyouscoding.com
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
> Company website : www.joyouscoding.com
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
>


-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Dhis2-users] Error importing tracker events data

2018-02-21 Thread Lars Helge Øverland
Hi Hakim,

this feedback indicates that some of your events are referring to a tracked
entity instance (e.g. person) that does not exist in your destination
system, with the identifier Ug2TixCkiAy.

regards,

Lars


On 21 February 2018 at 11:54, DJIBRIL Hakim  wrote:

> Hi all
> Please Can I have help on this
>
> I am trying export event data from DHIS2 instance to another Instance.
> I have the same program on both instances. But got error this error
>
> TypeNombre
> Imported 0
> updated 0
> Ignored 1ErrorEvent.trackedEntityInstance does not point to a valid
> tracked entity instance: Ug2TixCkiAy
>
> What can be the issue
> Best
>
> ___
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-us...@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
l...@dhis2.org
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Markus Bekken
Hey Martin!
- You can make composite indicators that consists of other program indicators, 
but program indicators can not be nested within each other directly.
- Yes-  program indicator values are always based on the data in the 
analytics_* tables.

Markus

> 21. feb. 2018 kl. 11:03 skrev Martin Van Aken :
> 
> Hi DHIS2 dev team!
> 
> I'm working on a decently large tracker program, and got some questions 
> regarding ProgramIndicators:
> 
> - It looks like ProgramIndicator can only refer to DataElements, not other 
> ProgramIndicators (like "aggregate" Indicators can) - is there any specific 
> reason for this? Will this constraint be left at some point in the future? 
> Building indicators on top of other indicators is quite handy
> - Are the programIndicator results linked to running the analytics (when 
> viewing them in the Event Manager app)? I tried to test that one, but was not 
> totally sure of my results (as the pivot table & browser are doing a lot of 
> caching too)
> 
> Thanks!
> 
> Martin
> 
> -- 
> Martin Van Aken - Freelance Enthusiast Developer
> 
> Mobile : +32 486 899 652 <> 
> 
> Follow me on Twitter : @martinvanaken 
> Call me on Skype : vanakenm
> Hang out with me : mar...@joyouscoding.com 
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken 
> 
> Company website : www.joyouscoding.com 
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] Error importing tracker events data

2018-02-21 Thread DJIBRIL Hakim
Hi all
Please Can I have help on this

I am trying export event data from DHIS2 instance to another Instance.
I have the same program on both instances. But got error this error

TypeNombre
Imported 0
updated 0
Ignored 1ErrorEvent.trackedEntityInstance does not point to a valid tracked
entity instance: Ug2TixCkiAy

What can be the issue
Best
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [d2 lib] - API call failing with "Server connection failed for API request"

2018-02-21 Thread Martin Van Aken
Hi,
I'm using d2 to fetch some data inside a DHIS2 app. Everything looks to be
working well, until I have a query using event analytics.

As the d2 lib don't have models yet (I think) for this, I'm making direct
calls using get, for example:

return getInstance().then(d2 =>
d2.Api.getApi().get("events?program=jqKm7VLgdzL"))

This works perfectly, I see the query go through the network view, and the
values get back

Now I'm trying a event analytics query:

return getInstance().then(d2 =>
d2.Api.getApi().get("/25/analytics/events/query/jqKm7VLgdzL?stage=tbLC6IHktf0:ou:VAPI4p81HAz;LEVEL-6=NAME"));

And this show an error in the console with  "Server connection failed for
API request"

I've ran the query through the browser & Postman without any problems. I've
debugged, the authorization header is correct.

Any clue what could go wrong there?

Thanks!

Martin

-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Lars Helge Øverland
Hi Martin,

On 21 February 2018 at 11:03, Martin Van Aken 
wrote:

> Hi DHIS2 dev team!
>
> I'm working on a decently large tracker program, and got some questions
> regarding ProgramIndicators:
>
> - It looks like ProgramIndicator can only refer to DataElements, not other
> ProgramIndicators (like "aggregate" Indicators can) - is there any specific
> reason for this? Will this constraint be left at some point in the future?
> Building indicators on top of other indicators is quite handy
>

Correct, program indicators cannot refer to other program indicators. We do
consider supporting this in the future.

Aggregate indicators can refer to program indicators though.


> - Are the programIndicator results linked to running the analytics (when
> viewing them in the Event Manager app)? I tried to test that one, but was
> not totally sure of my results (as the pivot table & browser are doing a
> lot of caching too)
>
>
Yes it is.

regards,

Lars




> Thanks!
>
> Martin
>
> --
> *Martin Van Aken - **Freelance Enthusiast Developer*
>
> Mobile : +32 486 899 652
>
> Follow me on Twitter : @martinvanaken 
> Call me on Skype : vanakenm
> Hang out with me : mar...@joyouscoding.com
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
> Company website : www.joyouscoding.com
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> 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
l...@dhis2.org
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] ProgramIndicators questions

2018-02-21 Thread Martin Van Aken
Hi DHIS2 dev team!

I'm working on a decently large tracker program, and got some questions
regarding ProgramIndicators:

- It looks like ProgramIndicator can only refer to DataElements, not other
ProgramIndicators (like "aggregate" Indicators can) - is there any specific
reason for this? Will this constraint be left at some point in the future?
Building indicators on top of other indicators is quite handy
- Are the programIndicator results linked to running the analytics (when
viewing them in the Event Manager app)? I tried to test that one, but was
not totally sure of my results (as the pivot table & browser are doing a
lot of caching too)

Thanks!

Martin

-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp