← Back to team overview

dhis2-users team mailing list archive

Re: Programme Rules


Hi there Samuel!

Let me try and help on the points you mention. 

Auto assigning the data entry date is a bit hard to do before 2.27. I assume you are working on 2.26 or older?

For the other points:
1. I assume you are entering the age as a number? If so I would start by assigning the age data element a value type "Positive integer" - that would validate that numbers below 1 is not allowed. Then make one program rule to show an error if the age entered seems too high. To create this program rule, use expression #{age} > 120 - and add one action of type "Show error". Type in an error message to the right of the action type, and select where the error should be displayed. In this case you can select the age data element. #{age} is a source field, that needs to be created by clicking add in the source field section of the program rule user interface. In this source field you select source field type "Data element in current event", and the age data element to be the source of #{age}. Reach out if you get stuck here.
Do you have three data elements for hours, months and weeks, you can do the same approach for these as for age. Let me know if my assumptions where correct or not :)

2. Is the date of admission and date of discharge data elements or tracked entity attributes? If so, you can create a program rule, and add two source fields. One for date of admission and one for date of discharge. Let us say you name them #{admission} and #{discharge}. Then you add the expression d2:daysBetween(#{admission},#{discharge}) < 0 - if the number of days between the admission and discharge is positive, it means that the discharge date comes after the admsision date. If the days between admission and discharge is negative, it means the opposite, that the discharge comes before the admission. If the number is negative, the action that should be triggered should be of type "show error" - just like the rules in 1.

3. We can create a rule that hides the date of admission if the place of death is outside the hospital - if you think that will work?
Assuming the place of death is an option set, you could create an expression #{placeOfDeath} == 'Outside hospital' and an action of type "hide field", and select the Date of admission as the data element to hide.

Hope this helps you along, dont hesitate to ask if you need something more - and please correct me if I made any wrong assumptions above.

Best regards

> 31. mai 2017 kl. 11.46 skrev Samuel Cheburet <samuelcheburet@xxxxxxxxx>:
> Dear ll,
> Hope fine, Look for assistance on programme rules and section hiding.
> How to make the data entry be auto fill date of data entry once click register event

> How to set age limit for years from 1 to 120 and should not have negative value if violate should bring errors,  if hours should not be more than 23, Months should not exit 59 months, weeks should not exit 52.
> Date of admission should be earlier than date of Discharge.
> If place of death is outside hospital then date of admission blocked and date of death or Discharge active.
> I interested on Verbal Autopsy 2016 algorithm on DHIS use.
> Regards
> Samuel K. Cheburet  (MSc HIM, Bsc.  HRIM,Dip. HRIT)
> Division of Monitoring and Evaluation,Health Research development and Informatic's
> CRVS Unit
> Afya House, Room LG 37
> PO. Box 30016, 00100.
> Ministry of Health Headquarters, Nairobi, Kenya. 
> mobile + 254-721624338
> Email: samuelcheburet@xxxxxxxxx <mailto:samuelcheburet@xxxxxxxxx>
> Office personal mail: samuel.cheburet@xxxxxxxxxxxx <mailto:samuel.cheburet@xxxxxxxxxxxx>
> Office email: crvsunit@xxxxxxxxxxxx <mailto:crvsunit@xxxxxxxxxxxx>
> Skype: samuelcheburet 
> _______________________________________________
> 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