Event data in a Predictor

Hello all,

Using dhis2 v2.31.4 I’m unable to get a predictor to work for event data. I can see in the documentation that a predictor “may come from aggregate data, event data, or both.” However, I can’t get the predictor to work when using event data, or both. (It works when using only aggregated data)

My output data element is set to domain type: aggregate, value type: number, aggregation type: SUM, and category combination: none.

My predictor is set to period type: weekly, generator: SUM( I {program indicator UID} ), sequential sample count: 1, annual sample count: 0. The organisation unit level is set to the level the data is captured.

After running this predictor in the scheduler app, then running analytics, this data element is blank in the pivot table app.

@Scott is this a bug? Or is there something incorrect in the configuration?

Thank you for your time,
Lauren Fregosi

Hi @lnfregos

It might be a bug, but there are a couple of things to check first.

You’re generator expression looks correct. Could you also make sure you have assigned an org unit level? This is necessary, but not clearly indicated as compulsory in the UX.

Keep in mind that the predictor can only generate aggregate DEs. What is the domain of the data element that receives the predicted value?

Just fyi, in 2.33 you could actually create this as a program indicator if you are able to upgrade.

Best,
Scott

Thank you @Scott for the quick response.

My data element domain type is aggregate, and my predictor org unit is set to where the data is captured.

I recreated our set up in play v. 2.34. the only difference is that I added all org units to the predictor in play. The data element, predictor, scheduler, and pivot table are all named ‘Testing Predictor with Event Data.’

After running the scheduler and analytics in play, it there is no data appearing in the predictor.

Thanks again,
Lauren

Hi Lauren Fregosi,

I found your predictor on https://play.dhis2.org/2.34.0 (the daily refresh has not run yet). When I opened up the generator expression, it said “Expression is not well-formed”. Starting in 2.34, function names are case sensitive, so you need to say sum(…) instead of SUM(…). When I replaced SUM with sum in your expression, it said the expression was valid.

This change is documented in the 2.34 upgrade notes (though not the release notes), at dhis2-releases/releases/2.34/README.md at master · dhis2/dhis2-releases · GitHub. Sorry this tripped you up.

Cheers,
Jim

Thanks @Jim_Grace for the help!

I set up this predictor in play to exemplify how I set up my predictor in the version I’m using (dhis2 v2.31.4).

Nonetheless, I tried this fix in the v2.31.4, and it didn’t work.

Also, in play (v2.34) I ran the predictor (with the generator fix sum(…) ) in the scheduler app, then ran analytics, and its not working.

Any other ideas as to why this isn’t working?

Hi @lnfregos,

I am seeing the same problem now. I will need to look into this further. I will let you know what I find.

Cheers,
Jim

1 Like

Hello @Jim_Grace,

Any luck on this? I’m still experiencing this issue.

Thanks!
Lauren

Hi @lnfregos,

I apologize for the delay in responding. As far as I can tell, the predictors are working correctly, but for some reason the predicted data is not represented in analytics. I have been able to reproduce this problem in analytics with data entered from the data entry screen – just to be sure it was not a problem related to how predictors were writing the data values. I’ve created a Jira ticket for the analytics problem, see [DHIS2-8855] - Jira. I’ve tested this on 2.31 and 2.34 and found exactly the same problem.

The way you can see the predicted values before they go into analytics is by creating a data set that will allow you to view the data element for the predicted values. The values show up correctly in data entry, but are not included in analytics after the analytics are refreshed.

Hi @lnfregos,

Lars commented in [DHIS2-8855] - Jira that what appeared to be an analytics problem is most likely a corruption in the SL Demo database, rather than a real problem in the analytics code.

As far as I can tell, predictors are working correctly for event data. This can’t be seen on the SL Demo in analytics because of its database corruption. I can see predictors from event data working correctly on the SL Demo using a data set to view the data.

If you still cannot get event data predictors working in another system, I suggest that you try using a data set to view the predicted data. This should confirm whether the problem is with predictors or somewhere else.

If you’re still seeing a problem, please let us know, and we can try to be more creative about reproducing it.

Cheers,
Jim

Hello @Jim_Grace,

Your work on this is greatly appreciated. Thank you for getting back to me.

I see in play v2.34.0 one predictor called ‘Test’ using event data in the generator. Is this your test predictor? I noticed that it doesn’t have the ''SUM" operator in the generator and the ‘Sequential Sample Count’ = 0. So, I created another predictor called ‘Test 2’ to reflect the predictor described above (adding SUM to the generator and changing the sequential sample count).

I’ve added the ‘Test’ and ‘Test 2’ data elements to a weekly data set, ran the predictors in the scheduler, then ran analytics, and am not seeing the predicted data values as described in data entry for either predictor data elements. I don’t see the ‘Test’ predictor data element in any other data set. If this is the predictor you used, what data set did you add it to in order to see the predicted values in data entry?

In our system, we are not able to view predictor data in data entry for event data. However, we can see predicted values for aggregate data in data entry.

About the analytics issue, I’m seeing data where it’s expected in our system.

Many thanks again,
Lauren

Hi @lnfregos,

I don’t think that was my predictor in play 2.34.0. I usually name mine “AA …” just so i can see them better in alphabetical lists. Predictor output is always to aggregate data, regardless of whether the input is from event data or aggregate data. So to view any predicted value without analytics, you can create a data set (which accesses aggregate data) and view it in there. You won’t ever see predictor output in event data.

I’m glad to hear that predictors are working for you in your system as expected. (I think that’s what you are saying.) I apologize that our play demo system has some problems with analytics. Let me know if you have any further questions or problems with predictors.

Cheers,
Jim

Hello!

Thanks again for getting back to this post.

To clarify, we are not seeing predictors with input event data in our system. Even when looking at the output data element in a data set.

Am I understanding correctly that if predictors using event data were working as expected we would be able to see them in their output data element in a data set? If this is true, I do not think predictors for event data are working.

Thanks!
Lauren