As the user may know now, the service is capable of inserting data into DHIS2 and also it is capable of retrieving the data processed (and know what happened with it, success, error).
This page will cover the messages sent by the service for the available functionalities.
Insert data into DHIS2
This module will validate agains a JSON Schema the structure of the JSON sent and will lookup for the questions and the values provided to process the data.
This module will return the following messages:
Valid JSON
Invalid JSON
Valid JSON: this message will be sent that everything was correct, the structure and the values of the request body are the ones expected. For example, for the question EXs9avwMrC6, there are only two possible answers (0 or 1), in case the answer has any other value (let’s say answer has value 2), a message of invalid JSON will be sent.
Invalid JSON: this message will be returned by the service if the validator checks that some parameter is missing within the structure of the request body.
For this step, the validator does not check if a question exists or not, instead, it checks if the question ID is sent and if the validator founds the correct question ID, it checks the structure of the object and its possible answers to ensure that the registration DHIS2.
If the question has the correct ID, the user must ensure that the answer value is one of the possible values. For example: let say that EXs9avwMrC6NotExist is sent as one of the questions. As this ID is incorrect, the service will return the message “valid JSON” (because this step does not check if the question EXs9avwMrC6 exists, it checks that IF the question EXs9avwMrC6 is sent, just in that case, it verifies that the structure of the object must contain the Type, Answer, Question parameters and also verifies that the answer is one of the possible choices).
Instead, if the user send the actual question with the correct ID (EXs9avwMrC6), the validator will check againts the accepted values (0 or 1), if some other value is sent as an answer, the service will return the message “invalid JSON”.
Retrieve processed data into DHIS2
This module retrieves every survey processed into DHIS2 and also shows if there was any problem during the data processing.
The status messages that the user can encounter by each survey are the following:
Success
Error - failed to get properties from surveys, please, check if all question IDs are correct
Error - failed to store survey property, unmatched property from survey
Error - failed to get survey properties
Error - failed while trying to connect to DHIS2 and check if Tracked Entity Instance exists, DHIS2 responded status: [status_code_sent_by_DHIS2]
Error - failed to get Tracked Entity Instance, DHIS2 responded status: ${invokehttp.status.code}
Error - failed to store survey property, unmatched property from survey
Error - failed to get survey properties
Error - could not create Track Entity Instance payload for DHIS2
Error - failed to insert DHIS2 Tracked Entity Instance, DHIS2 responded status: ${invokehttp.status.code}
Error - failed while trying to connect to DHIS2 and insert Tracked Entity Instance, DHIS2 responded status:
Error - failed to store Tracked Entity Instance properties from inserted, unmatched property
Error - failed to get Tracked Entity Instance properties from inserted
Error - Could not create Event payload for Track Entity Instance for DHIS2
Error - failed to insert DHIS2 Event on Tracked Entity Instance, DHIS2 responded status: [status_code_sent_by_DHIS2]
Error - failed to store property from DHIS2 Event inserted, unmatched property
Error - failed to store property from DHIS2 Event inserted
Also, there are some errors in case the endpoint has problem looking for the responses:
permission denied
File not found
failed to fetch file
Success
Success: Means that everything was successfully inserted into DHIS2.
Failures by internal processing
This errors refer to the same: the service presented an error at some point of the data processing. The error specify in which step the flow stoped and at which point the flow should be checked:
Error - failed to get survey properties
Error - failed while trying to connect to DHIS2 and check if Tracked Entity Instance exists, DHIS2 responded status: [status_code_sent_by_DHIS2]
Error - failed to get Tracked Entity Instance properties from inserted
Error - could not create Track Entity Instance payload for DHIS2
Error - failed while trying to connect to DHIS2 and insert Tracked Entity Instance, DHIS2 responded status:
Error - failed to get Tracked Entity Instance properties from inserted
Error - Could not create Event payload for Track Entity Instance for DHIS2
Error - failed to store property from DHIS2 Event inserted
Failures by DHIS2
This errors refer that DHIS2 presented some problem trying to insert the data. As DHIS2 returns a status code, the data inserted into DHIS2 must be reviewed (as there could be a duplicate, or the data can not be inserted for some reason):
Error - failed to get Tracked Entity Instance, DHIS2 responded status: [status_code_sent_by_DHIS2]
Error - failed to insert DHIS2 Tracked Entity Instance, DHIS2 responded status: [status_code_sent_by_DHIS2]
Error - failed to insert DHIS2 Event on Tracked Entity Instance, DHIS2 responded status: [status_code_sent_by_DHIS2]
Failures by wrong data received
This errors refers that some data within the request body was incorrect or there are required questions that are missing:
Error - failed to get properties from surveys, please, check if all question IDs are correct
Error - failed to store survey property, unmatched property from survey
Error - failed to store Tracked Entity Instance properties from inserted, unmatched property
Error - failed to store property from DHIS2 Event inserted, unmatched property