← Back to team overview

dhis2-devs team mailing list archive

Re: API - Post Event - Program Rule not triggered

 

Hi,

Markus - thanks for the clarification (clearly I did not pay enough
attention the other day, must be caffein-deficiency...)

Matt,

IMHO, if you NEED to store the derived value, you could consider running a
small database-side script at regular intervals (depending on how often you
push events through the API) that mimicks the client-side ASSIGN program
rule. Again depending on your database size etc, it might only take a
second or three to run such a script - which means you could consider
running it very frequently. OR you might find a way of using a trigger that
fires immediately after the API has inserted the event (note: I have not
used that myself for this purpose, so not sure)

Regards
Calle

On 14 June 2018 at 20:14, Matt Finholt-Daniel <mfinholt@xxxxxxxxxx> wrote:

> Thanks, Calle and Markus!
>
> I will keep an eye on upcoming releases for expanded Program Rule
> functionality.
>
>
>
> I didn’t even consider the possibility that the rule would be run at
> analytics time.  I do some more testing around that. Worst-case, I can
> include some basic logic in my script that’s pushing data into the system.
>
>
>
> -Matt
>
>
>
> *From: *Markus Bekken <markus.bekken@xxxxxxxxx>
> *Date: *Thursday, June 14, 2018 at 2:09 PM
> *To: *Calle Hedberg <calle.hedberg@xxxxxxxxx>, Matt Finholt-Daniel
> <mfinholt@xxxxxxxxxx>
> *Cc: *"dhis2-devs@xxxxxxxxxxxxxxxxxxx" <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
> *Subject: *Re: [Dhis2-devs] API - Post Event - Program Rule not triggered
>
>
>
> Calle - You are right that the program rules now run on the server, but
> the only program rule action type they perform in 2.30 is "Send message"
> and "Schedule message". The other action types like assign will be added on
> the server side in later releases.
>
>
>
> Matt - can you make a program indicator for the same expression? This
> would not store the value in a data element, but this calculation would run
> at the time of creating the pivot/report in analytics.
>
>
>
> Markus
>
>
>
> 14. jun. 2018 kl. 18:15 skrev Calle Hedberg <calle.hedberg@xxxxxxxxx>:
>
>
>
> Matt,
>
>
>
> Until very recently, all program rules were run on the client side.
> Support for server-side program rules have been added recently, but I
> believe only in trunk (2.30 - initial beta to be released tomorrow). Using
> that, I believe it will be possible to trigger that assign rule via the api
>
>
>
> Regards
>
> calle
>
>
>
> On 14 June 2018 at 15:27, Matt Finholt-Daniel <mfinholt@xxxxxxxxxx> wrote:
>
> Hi All,
>
>
>
> I’m hoping that you can help me out. I am using the API (/29/) to push a
> Program Event into the DHIS2. This program also has a "program rule" set on
> it that adds two of the variables together and sets the result to a third
> value. I've notice that this program rule is not run until I actually visit
> the page and choose to edit that record.
>
>
>
> Does anyone happen to know if there is any way that I can remotely trigger
> the program rule to run via the API?
>
>
>
> Thanks,
>
> Matt
>
>
>
>
>
>
>
>
> _______________________________________________
> 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
>
>
>
>
>
> --
>
> *******************************************
>
> Calle Hedberg
>
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
> <https://maps.google.com/?q=46D+Alma+Road,+7700+Rosebank,+SOUTH+AFRICA&entry=gmail&source=g>
>
> Tel/fax (home): +27-21-685-6472
>
> Cell: +27-82-853-5352
>
> Iridium SatPhone: +8816-315-19119
>
> Email: calle.hedberg@xxxxxxxxx
>
> Skype: calle_hedberg
>
> *******************************************
>
>
>
> _______________________________________________
> 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
>
>
>



-- 

*******************************************

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@xxxxxxxxx

Skype: calle_hedberg

*******************************************

References