Re: [Dhis2-devs] Web api authorization not working

2018-02-07 Thread Lars Helge Øverland
Hi Terence,

have a look at the CORS concept:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

You can whitelist the URL/domain of your app from Apps > Settings > Access
> CORS whitelist.

regards,

Lars



On 8 February 2018 at 09:15, Morten Olav Hansen  wrote:

> Did you whitelist your domain in CORS settings?
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Feb 8, 2018 at 2:37 AM, Knut Staring  wrote:
>
>> Forwarding to the dev list.
>>
>> On Feb 7, 2018 8:31 PM, "Terence Kaite"  wrote:
>>
>>> Hello there,
>>>
>>> I've been trying to build an external web app that should be making use
>>> of dhis 2 data through the its' web api endpoints. But when I try to access
>>> dhis web apis - even after including credentials for authentication
>>> (username:password bases64encoded) as value for the authorization request
>>> header, I'm getting a "response for preflight is invalid (redirect)". (I'm
>>> using basic authentication). And when I monitor the network activity in
>>> chrome dev tool I came to discover that the preflight OPTION request method
>>> is also being redirected, which shouldn't be the case.
>>> I really need to get my app connect to dhis, I'm building it as part of
>>> the country's Health Information System. I will greatly appreciate any
>>> assistance in how I can solve this issue, or any workable solution I can
>>> refer to. Thanks a lot.
>>>
>>> Regards
>>> Terence
>>>
>>> Sent from my iPhone
>>
>>
>> ___
>> 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
>
>


-- 
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] Web api authorization not working

2018-02-07 Thread Morten Olav Hansen
Did you whitelist your domain in CORS settings?

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Thu, Feb 8, 2018 at 2:37 AM, Knut Staring  wrote:

> Forwarding to the dev list.
>
> On Feb 7, 2018 8:31 PM, "Terence Kaite"  wrote:
>
>> Hello there,
>>
>> I've been trying to build an external web app that should be making use
>> of dhis 2 data through the its' web api endpoints. But when I try to access
>> dhis web apis - even after including credentials for authentication
>> (username:password bases64encoded) as value for the authorization request
>> header, I'm getting a "response for preflight is invalid (redirect)". (I'm
>> using basic authentication). And when I monitor the network activity in
>> chrome dev tool I came to discover that the preflight OPTION request method
>> is also being redirected, which shouldn't be the case.
>> I really need to get my app connect to dhis, I'm building it as part of
>> the country's Health Information System. I will greatly appreciate any
>> assistance in how I can solve this issue, or any workable solution I can
>> refer to. Thanks a lot.
>>
>> Regards
>> Terence
>>
>> Sent from my iPhone
>
>
> ___
> 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


Re: [Dhis2-devs] [Dhis2-users] Dataset Custom Forms (CSS & JS)

2018-02-07 Thread Timothy Harding
Hello Makhate,

Couple things!

So first of all, *if* the CSS is for the custom form and the custom form
only, putting them in the source tab like you described *should* work, but
it can be finicky, as DHIS 2 does alter the HTML as it is being displayed.
Best figure out what works in the chrome console and put that in your
custom form.


  /*
 CSS code here
  */


Second, if you want css to work on all pages,
https://docs.dhis2.org/master/en/developer/html/webapi_ui_customization.html
*isn't
the safest place* to keep custom css and js as you have found it does not
work on all pages. There is no way besides forking core to put your own
custom CSS on the react apps unfortunately:

https://jira.dhis2.org/browse/DHIS2-2065
https://jira.dhis2.org/browse/DHIS2-1299
https://jira.dhis2.org/browse/DHIS2-2624




*Timothy Harding*
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | thard...@baosystems.com | http://www.baosystems.com | Skype:
hardi...@gmail.com | 2900 K Street, Suite 406, Washington D.C. 20007

On Wed, Feb 7, 2018 at 4:48 AM, Makhate Makhate 
wrote:

> Thanks,
>
> I ran the POST-request and it looks like it ran successfully because i can
> see the CSS file when i run /api/28/files/style.
>
> One last thing, how do i link/reference that css file? I'm asking this
> because the styling is not working on my forms.
>
> Warmest regards,
> Makhate, ICAP Lesotho
>
> On Wed, Feb 7, 2018 at 7:49 AM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> Did you have a look at our developer documentation on the use of custom
>> CSS/JS?
>>
>> https://docs.dhis2.org/master/en/developer/html/webapi_ui_cu
>> stomization.html
>>
>> This should also work for inline JS in the form.
>>
>> 
>> 
>> 
>>
>>
>>
>> On Wed, Feb 7, 2018 at 6:38 AM, Makhate Makhate > > wrote:
>>
>>> Hi Diao,
>>>
>>> Thanks for helping out.
>>>
>>> What do you mean when you say "*it maybe possible to use files*" what
>>> do you mean by files.
>>>
>>> The only trick that I could come up with is doing it like this but it
>>> doesn't quite work:
>>>
>>> 
>>>   /*
>>>  CSS code here
>>>   */
>>> 
>>>
>>> 
>>>
>>> 
>>>
>>> Well, doing it like this, when i hit Preview i can see basic
>>> interactivity but when i load the actuall dataset, it doesn't work.
>>>
>>> Does anyone know exactly where to put JS and CSS code.
>>>
>>> Kind regards,
>>> Makhate,
>>> ICAP Lesotho
>>>
>>> On Tue, Feb 6, 2018 at 5:54 PM, Mamadou Diao Diallo <
>>> diao_dia...@gn.jsi.com> wrote:
>>>
 Hi Makhate,

 It maybe possible to use files but I used to paste Javascript code in
 the Source window at the custom form editor, following this link
 https://docs.dhis2.org/master/en/user/html/database_design.h
 tml#d0e36608 see the section *30.5.3.1.2. Custom Forms.*

 Best

 *Diao*

 30.5.3.1.2. Custom Forms

 On Tue, Feb 6, 2018 at 2:30 PM, Makhate Makhate <
 makhatemakh...@gmail.com> wrote:

> ​Hello Communit​y,
>
> I am customizing the UI form of our datasets here. We need help on
> where to put CSS and Javascript files.
>
> Kind regards,
> Makhate Makhate
> ICAP, Lesotho
>
> ___
> 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
>
>


 --
 *DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 **( District
 Health Information Software )*


 *Projet de Renforcement du Système d'Information Sanitaire en Guinée*
 *Phone : 623909413 | 662256106*
 *Skype : diawwdiallo*
 www.jsi.com

>>>
>>>
>>> ___
>>> 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
>>>
>>>
>>
>>
>> --
>> Jason P. Pickering
>> email: jason.p.picker...@gmail.com
>> tel:+46764147049 <+46%2076%20414%2070%2049>
>>
>
>
> ___
> 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
>
>
___
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] Issue with deprecated android-apt on tracker-capture

2018-02-07 Thread Elisabeth Meyers
Dear DHIS2 developer team,

When loading in dhis2-android-sdk on branch tracker-capture as a submodule,
we get the following message:

"To take advantage of all the latest features (such as Instant Run),
> improvements and security fixes, we strongly recommend that you update the
> Android Gradle plugin to version 3.0.1 and Gradle to version 4.1."


However, we cannot choose this update due to deprecated items on the
submodule branch mentioned above. In order to allow updating, I am
requesting the following changes:

https://github.com/dhis2/dhis2-android-sdk/pull/124

Sincerely,

Liz Meyers
elisabethz.mey...@gmail.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] Web api authorization not working

2018-02-07 Thread Knut Staring
Forwarding to the dev list.

On Feb 7, 2018 8:31 PM, "Terence Kaite"  wrote:

> Hello there,
>
> I've been trying to build an external web app that should be making use of
> dhis 2 data through the its' web api endpoints. But when I try to access
> dhis web apis - even after including credentials for authentication
> (username:password bases64encoded) as value for the authorization request
> header, I'm getting a "response for preflight is invalid (redirect)". (I'm
> using basic authentication). And when I monitor the network activity in
> chrome dev tool I came to discover that the preflight OPTION request method
> is also being redirected, which shouldn't be the case.
> I really need to get my app connect to dhis, I'm building it as part of
> the country's Health Information System. I will greatly appreciate any
> assistance in how I can solve this issue, or any workable solution I can
> refer to. Thanks a lot.
>
> Regards
> Terence
>
> Sent from my iPhone
___
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] DAYS OR MONTHS BETWEEN ENROLLMENT AND AN EVENT

2018-02-07 Thread Stanley Kalyati
Hi All,

Anyone that can help with how i can create a program indicator to filter
all clients that have enrolled into a program before december 31,2017 and
accessed a particular service and also clients that enrolled into a program
after december 31,2017 and accessed a service?

Anything i can use to relate to my desire.

Thank you

Stanley
___
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] Using program rule expressions in Program indicator expressions

2018-02-07 Thread Bernard Sadaka (IM Advisor)
Hello Markus,

Thank you for the list and explanation; is there any expected timeline for 
that? (JIRA issue, I can track?)



With regards to the number of decimals, even if set to zero at the program 
indicator and after running the analytics, the “pivot table” still shows the 
digits.



Regarding the expression, yes it is true, I’m rounding the constants, because I 
am actually creating a budget report and applying a discount rate on the 
individual cost of a specific PHCC activity and aggregating them using sum (so 
I am using one constant per cost of a PHCC activity and another for discount 
rate of all activities). I ended up using exact values in the constant instead 
of a discounted factor; after all, changing a discount factor is easier than 
changing 200 values individually when the discount rate changes. The reason for 
all this, is that with a discounted factor there is a need to round the values 
and disallow them to be cumulated in the sum of the aggregation in order to 
keep the report error free.

Hope the above explains my usecase: aggregating the data elements of a TEI and 
multiplying them by a cost constant and a discount factor. And yes the round 
functions in this case would be very beneficial.



Thank you again for your support.



All the best,

Bernard






Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail:   lib@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website:   https://www.pu-ami.org





From: Markus Bekken [mailto:mar...@dhis2.org]
Sent: Wednesday, February 7, 2018 9:52 AM
To: Bernard Sadaka (IM Advisor) 
Cc: dhis2-us...@lists.launchpad.net; DHIS 2 developers 

Subject: Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in 
Program indicator expressions



Hi there Bernard,

We aim to support more and hopefully all the program rule functions in program 
indicators.

Unfortunately we are not there yet, and the list of supported functions in 
program indicators can be found here:

19.4.5. Reference information: Functions, variables and operators to use in 
program indicator expressions and filters 




Where did you get the wrong number of decimals? In the Pivot or in the 
Tracker/Event capture?



One question on your expression below, it seems you are trying to round off a 
constant from your defined constant values? Your use case I would have guessed 
is to round off a data element or tracked entity attribute value?



Best regards

Markus





6. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor)  >:



I found a similar issue on JIRA (  
https://jira.dhis2.org/browse/DHIS2-2734)



But still doesn’t explain why I can’t use different expressions in program 
indicators :(



All the best,

Bernard






Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail:   lib@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website:   https://www.pu-ami.org





From: Dhis2-users [ 
 
mailto:dhis2-users-bounces+lib.ima=pu-ami@lists.launchpad.net] On Behalf Of 
Bernard Sadaka (IM Advisor)
Sent: Tuesday, February 6, 2018 3:53 PM
To:   dhis2-us...@lists.launchpad.net; 
'DHIS 2 developers' <  
dhis2-devs@lists.launchpad.net>
Subject: [Dhis2-users] Using program rule expressions in Program indicator 
expressions



Can anyone tell me why I can’t use program rule expressions in Program 
indicator expressions?

Functions like ceil, floor, round and others are very useful.



Also I tried to use the “Decimals in data output” in the program indicator 
details, it didn’t work.

Also I tried to simulate the round function using conditional modulo 
subtraction/addition (the pivot table keeps trying to load) :

C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + 
d2:condition('(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50',1,0)



Thank you in advance.

Please advise.



All the best,

Bernard






Bernard Sadaka

Information Management Advisor

Première Urgence - Aide Médicale Internationale

Nehmeh Building, Sanine Street, Chiyah, 3rd Floor

Ain el Remmaneh, Beirut, Lebanon

E-mail:   lib@pu-ami.org

Cell: +961 71 004 881 (208)

Skype: imapuami

Website:   https://www.pu-ami.org








 

Re: [Dhis2-devs] [Dhis2-users] Using program rule expressions in Program indicator expressions

2018-02-07 Thread Markus Bekken
Hi there Bernard,
We aim to support more and hopefully all the program rule functions in program 
indicators.
Unfortunately we are not there yet, and the list of supported functions in 
program indicators can be found here:
19.4.5. Reference information: Functions, variables and operators to use in 
program indicator expressions and filters 


Where did you get the wrong number of decimals? In the Pivot or in the 
Tracker/Event capture?

One question on your expression below, it seems you are trying to round off a 
constant from your defined constant values? Your use case I would have guessed 
is to round off a data element or tracked entity attribute value?

Best regards
Markus

> 6. feb. 2018 kl. 15:31 skrev Bernard Sadaka (IM Advisor) :
> 
> I found a similar issue on JIRA (https://jira.dhis2.org/browse/DHIS2-2734 
> )
>  
> But still doesn’t explain why I can’t use different expressions in program 
> indicators L
>  
> All the best,
> Bernard
>  
> 
> Bernard Sadaka
> Information Management Advisor
> Première Urgence - Aide Médicale Internationale
> Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
> Ain el Remmaneh, Beirut, Lebanon
> E-mail: lib@pu-ami.org 
> Cell: +961 71 004 881 (208)
> Skype: imapuami
> Website: https://www.pu-ami.org 
>  
>  
> From: Dhis2-users 
> [mailto:dhis2-users-bounces+lib.ima=pu-ami@lists.launchpad.net 
> ] On 
> Behalf Of Bernard Sadaka (IM Advisor)
> Sent: Tuesday, February 6, 2018 3:53 PM
> To: dhis2-us...@lists.launchpad.net ; 
> 'DHIS 2 developers'  >
> Subject: [Dhis2-users] Using program rule expressions in Program indicator 
> expressions
>  
> Can anyone tell me why I can’t use program rule expressions in Program 
> indicator expressions?
> Functions like ceil, floor, round and others are very useful.
>  
> Also I tried to use the “Decimals in data output” in the program indicator 
> details, it didn’t work.
> Also I tried to simulate the round function using conditional modulo 
> subtraction/addition (the pivot table keeps trying to load) :
> C{eB6eQXKY8HA}*C{xGZ2I9aTeXX} -(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 + 
> d2:condition('(C{eB6eQXKY8HA}*C{xGZ2I9aTeXX}*100) % 100 >=50',1,0)
>  
> Thank you in advance.
> Please advise.
>  
> All the best,
> Bernard
>  
> 
> Bernard Sadaka
> Information Management Advisor
> Première Urgence - Aide Médicale Internationale
> Nehmeh Building, Sanine Street, Chiyah, 3rd Floor
> Ain el Remmaneh, Beirut, Lebanon
> E-mail: lib@pu-ami.org 
> Cell: +961 71 004 881 (208)
> Skype: imapuami
> Website: https://www.pu-ami.org 
>  
>  
>  
>  
> 
> 
> Virus-free. www.avast.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