Data value not defined in Program Stage

Hi
I encountered a similar problem. Here is the error that appears when entering a field. but i don’t know what i should do to fix the problem.
Thank you for your support.

{“httpStatus”:“Conflict”,“httpStatusCode”:409,“status”:“WARNING”,“message”:“One more conflicts encountered, please check import summary.”,“response”:{“responseType”:“ImportSummary”,“status”:“WARNING”,“description”:“Data Values [db0UBBUrcox] ignored because not defined in program stage QCnQB1XkUKE”,“importCount”:{“imported”:1,“updated”:0,“ignored”:0,“deleted”:0},“conflicts”:[],“reference”:“rMzc6QZQMes”}}

@elmoujarrade,

Please try to clear cache and run tables analytics export and see if it works. If it doesn’t would you check if there are any errors in the Catalina.out log and if there is share it (without the sensitive info)?

Thank you!

1 Like

Hi All-
I’m getting the same error after upgrading to 2.37.7.1. I had cleared my cache. I tried running analytics but this didn’t seem to fix the problem. I get this same error every time I add a new event to any of the Program Stages in my Program.

Any other ideas?

Thanks!
Kayla

2 Likes

@kstankevitz and @elmoujarrade ,

Please share the full Catalina.out log (without sensitive info) if there are any errors.

Thanks!

I am having the same issue, the catalina.out log does not report the error shown on the browser’s console. I could not figure out how to ask DHIS2 to do a more verbose logging, something like log.level=debug. Is that possible?

I activated statement logging on Postgres, and tested the error on the command line to get the queries:

~# curl -u admin:district -v -H “Content-Type: application/json” -d @datos.json -X PUT http://1.2.3.4:8080/dhis/api/events/[program_stageID]/[data_elementID]

I tested two data elements IDs, the first returned StatusCode 200 (ok) and another that returned StatusCode 409 (conflict).

In both cases, Postgres logged the same queries (16 Select and 3 Update statements).
I then executed all those queries manually and received results every time -no empty sets. Furthermore, The update queries did run without a problem since they do not include the data element ID.

I did noticed that one of the Select statements is getting ALL the dataelements from the given TEI - not only for the specified program stage. It is as though some how the application is using this list of data elements to try to do the update, and obviously not finding many of them on the current stage. Here is the Query:

SELECT psde.programstageid,
de.dataelementid,
de.uid AS de_uid,
de.code AS de_code,
psde.compulsory
FROM programstagedataelement psde
JOIN dataelement de
ON psde.dataelementid = de.dataelementid
ORDER BY psde.programstageid;
SELECT tei.trackedentityinstanceid,
tei.uid,
tei.code
FROM trackedentityinstance tei
WHERE tei.uid IN (‘TEI_ID’);

Given that the error is only being logged on the browser’s console; makes think this might be caused by the jQuery code, without the server knowing about it. I already cleared cache, cookies and app local storage in the browser, error continues to appear.

Thank you for comments.
Eric.

Just to confirm I see the same thing… the error is being shown in the browsers console (in my case Chrome and Chrome incognito) but not in any of the logs.

If anyone has any ideas about next steps to troubleshoot this please advise.

After many hours of hopeless debugging, and testing many data entry combinations, I have come to the conclusion that the problem does not come come from DHIS2 data model or logic; rather our own custom ProgramRuleActions are causing the problem. I have observed that there are rules requesting values be updated/added as the user enters data; these rules worked fine from 2.30 up to 2.35 but have started to fail in 2.36. If I delete these rules, the problem goes away.

2 Likes

Hi @Eric_Boyd_Ramirez,
I’m glad you found the cause of the issue. Would you like to share what was wrong with the program rule actions?

Thanks!

Program rules were referencing variables/data elements that had not been added to the program stage under “assign data elements”.

2 Likes

Thank you so much @Eric_Boyd_Ramirez! I was able to find a similar issue in our program rules and it resolved this error.

For our program, it was 8 program rules that didn’t have a “trigger rule for this program stage” defined. So it seemed to be trying to trigger that PR for each program stage. The PRs were used to assign a value to a DE, and that impacted DE was only assigned to one program stage, so we got an error on every other program stage.

2 Likes