← Back to team overview

dhis2-users team mailing list archive

Re: Generate scores using program rules, tracker capture web app

 

Hi Markus,

I have made the changes you have suggested, but it doesn't work, I've tried
to assign this rule to another data element, the score element greys out
but the score doesn't show up. Is there any other way to debug program
rules and check what value is being stored. I also tried to make the
changes you have suggested and it didn't work.

Please find the attached screenshots. Thank you for the help.

-Siva

On Sun, Nov 5, 2017 at 6:28 AM, Markus Bekken <markus@xxxxxxxxx> wrote:

> I suggesr try replacing your second rule expression to simply the word
> true, lowercase and no hyphens.
>
> Markus
>
> 5. nov. 2017 kl. 04:21 skrev abhishek addepally <
> abhishekaddepally@xxxxxxxxx>:
>
> Thank you for the reply Markus,
>
> I have created intermediate rules and assigned the value like the
> following image.
> <Capture1.PNG>
>
> For the second part, I have created an expression which is always true
> (I'm assuming to be)
> <Capture.PNG>
> I have tried this and it doesn't show the score. I there any thing that
> I'm missing. Please let me know, thank you for the help.
>
> -Siva
>
> On Fri, Nov 3, 2017 at 9:49 AM, Markus Bekken <markus@xxxxxxxxx> wrote:
>
>> Hi there Siva,
>> An important principle for the assign rules is that they should produce
>> the same result every time if the input is unchanged.
>>
>> Here is a suggested approach to acheive this. It will require that you
>> create a programRuleVariable for each data element that is going to be
>> scored, and make rules that calculates intermediary scores - one for each
>> data element to be scored. Then after the intermediary scores is assigned,
>> you can sum the whole form.
>>
>> Rules for storing intermediate scores can be made like this:
>> Expression: #{dataElement1} == 'correctOption'
>> Action: Assign score(a number) to the program rule variable
>> #{dataElement1Score}
>> (you need to create a separate programRuleVariable that is called
>> #{dataElement1Score}, and give it the source type "Calculated value".
>> Give all these rules priority 1.
>>
>> Then you make one rule for calculating and assigning the sum:
>> Expression: true (we want this rule to always run I presume)
>> Action: Assign total score to the score data element. The expression to
>> assign would be #{dataElement1Score} + #{dataElement2Score} +
>> #{dataElement3Score} ...and so on, depending on the number of options that
>> should score.
>> This rule should be given priority 2, as it relies on the rules above to
>> be run first.
>>
>> Please reach out if you have any questions or need further assistance on
>> this.
>>
>> All the best,
>> Markus
>>
>>
>> > 2. nov. 2017 kl. 08.43 skrev abhishek addepally <
>> abhishekaddepally@xxxxxxxxx>:
>> >
>> > Hi,
>> >
>> > I'm trying to generate a score based on the input provided by the user
>> for a program stage. I have created a program rule expression where if an
>> option is selected and then the rule action to increment the value for the
>> score data element using the assign value function. This is done for
>> different fields across the program stage. But when any option is selected
>> the score variable increases. I'm using 2.27 of DHIS2.
>> >
>> > Please let me know if there is any way this could be done.
>> >
>> >
>> > -Siva
>> > <Capture.PNG><Capture1.PNG><Capture2.PNG>___________________
>> ____________________________
>> > Mailing list: https://launchpad.net/~dhis2-users
>> > Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~dhis2-users
>> > More help   : https://help.launchpad.net/ListHelp
>>
>>
>

Attachment: Capture.PNG
Description: PNG image

Attachment: Capture1.PNG
Description: PNG image


References