I would like to discuss and get your advice on implementing a potential predictor use case.

Our requirement: We have Maternal Mortality rate of last 5 years (in Aggregation Dataset) and we need to calculate the progress in Maternal Mortality Reduction

Calculation is like : (MMR(2017) - MMR(2021)) / MMR 2017 * 100

Can we implement this in predictor ? I tried implemeniting with .periodOffset(-5) but didn’t work yet for me. Below is the formula i tried to build

@Jim_Grace & @Scott , I got this idea of periodOffset from your session on Predictors in DHIS2 symposium. Would like to kindly seek your advice.

Hi @jthomas, Actually, the .periodOffset() function is only valid for indicators, not for predictors. It may be that the most effective way for you to get what you want is to just create an indicator with exactly the same expression shown in your screen shot.

If you want to compute the same value using a predictor, you could do it with a predictor generator expression such as:

Any value within an aggregation function such as sum() means to get the value from past sampled periods, whereas a value outside the aggregation function means to get the value from the same period that you are predicting for. Then you could define the predictor with a sequential sample count of 5, but a sequential skip count of 4. (Look at the last five years, but not a the most recent 4 of these.) This means that the value inside sum() is looking only a the single value from 5 years ago.

But my guess is that your best option may be to use the .periodOffset() function within an indicator.

This assumes that the data is stored with a periodType of Yearly.

Finally, our apologies that the .periodOffset() function was even considered valid within a predictor expression. This is a bug. It should only be valid within an indicator expression. I have created a Jira ticket for this: DHIS2-12258.