...
Insert data into DHIS2
Check the result of the data processed into DHIS2
...
Insert data into DHIS2
To insert DHIS2 data, the following url:
Dev Environment
Code Block | ||
---|---|---|
| ||
POST http://openhim-dev.psi-mis.org:5001/nifi.solidlines.io/surveys (DEV ENVIRONMENT) |
Production Environment
Code Block |
---|
POST http://openhim.psi-mis.org:5001/moz/ussd/nifi/surveys (PRODUCTION ENVIRONMENT) |
This endpoint expects a request body with the surveys to be inserted in DHIS2, so the request body must be the following:
Code Block | ||
---|---|---|
| ||
{ "surveys": [ { "orgUnit": "", "surveyID": "", "surveyDate": "", "answers": [{ "type": "TEA", "answer": "M", "question": "JcGai6pHG1M" }, { "type": "DE", "answer": "user", "question": "fFjTS4qVA4h" }, { "type": "DE", "answer": "0010", "question": "C0fLABBqctc" }, { "type": "DE", "answer": "RCP", "question": "BUvnfpNC8Sg" }, { "type": "DE", "answer": 1, "question": "EXs9avwMrC6" }, { "type": "DE", "answer": 1, "question": "dXqvlNSA0rt" }, { "type": "DE", "answer": 1, "question": "VC57h7Z9WEZ" }, { "type": "DE", "answer": 0, "question": "olkJStuPU6a" }, { "type": "DE", "answer": 1, "question": "NrcQzTXHs1y" }, { "type": "DE", "answer": 0, "question": "OAeAYYna9Da" }, { "type": "DE", "answer": 1, "question": "YjaGSF7gW69" }, { "type": "DE", "answer": 1, "question": "goyGi80JLzn" }, { "type": "DE", "answer": 1, "question": "s8spLqKaFdR" }, { "type": "DE", "answer": 1, "question": "zWV0tzlhwCi" }, { "question": "FLd1dXDdHhT", "type": "TEA", "answer": "f22346132907bfe36981cf5614f2c4c8ad2d237e55c8165eabd8d46304bedf1e" }] } ] } |
Question | Refers to | Accepted values | Accepted values meaning |
---|---|---|---|
JcGai6pHG1M | Thank you for helping us to improve our service. What is the gender of the person served: | M | Male |
fFjTS4qVA4h | Who is answering the questionnaire: | user | User |
C0fLABBqctc | What is the age range of the person served: | 0010 | 0 - 10 years |
BUvnfpNC8Sg | In which sector were you served? | RCP CPN MAT CPP CCR LAB PHA SAAJ PNCT IC PSY NUT STO OPH OTH | Reception/Acceptance |
EXs9avwMrC6 | The way I was treated by the health care provider: | 1 | Makes me want to go back to the Health Center (1) |
dXqvlNSA0rt | During the consultation the health care provider: | 1 | Asked if I had questions (1) |
VC57h7Z9WEZ | Before you finish the consultation the health care provider: | 1 | Gave me room to ask questions (1) |
olkJStuPU6a | In talking to me the health care provider: | 1 | Explained everything in a simple way (1) Used words I didn't understand (0) |
NrcQzTXHs1y | During the consultation the health care provider: | 1 | He was my friend (1) |
OAeAYYna9Da | During the consultation: | 1 | I understood that the treatment is good for me (1) I was unsure/fearful of the treatment (0) |
YjaGSF7gW69 | During the consultation the health provider talked about HIV Treatment: | 1 | Yes (If yes move on to the next question) (1) |
goyGi80JLzn | During the consultation the health care provider: | 1 | Explained importance of complying with HIV Treatment (1) |
s8spLqKaFdR | During the consultation the health care provider explained that: | 1 | If I take medicines correctly I will not transmit HIV to partner (1) |
zWV0tzlhwCi | Viral load is: | 1 0 0.000001 | The amount of HIV in my body (1) |
FLd1dXDdHhT | Phone Number | any |
The endpoint should respond any of the following cases:
{"message": "invalid request, check if the structure of your request is correct for every survey (accepted answers for questions / all parameters are included within the questions) or if the org unit is accepted"}
: meaning that the structure of your request body JSON is not correct, check if all the values sent are accepted.{"message":"success, valid request"}
: meaning that the structure of your request body JSON is correct.
...
Retrieve data inserted into DHIS2
Everyday at 6:00 AM (GMT+2 Time zone), the server will retrieve all the processed data responses and merge it into one full response, this means that the data that the user can view before 6:00 AM (GMT+2 Time zone) will be replaced with the new one.
...
The url to retrieve all the information of the data processed is the following:
Developer Environment
Code Block |
---|
GET http://openhim-dev.psi-mis.org:5001/nifi.solidlines.io/results |
Production Environment
Code Block |
---|
GET http://openhim.psi-mis.org:5001/moz/ussd/nifi/results |
...
Code Block |
---|
{ "surveys": [ { "surveyID": "", "dhisTeiID": "", "dhisEventID": "", "status": "" } ] } |
Parameter | Meaning |
---|---|
surveyID | ID of the survey sent by the user |
dhisTeiID | ID created for the Tracked Entity Instance created |
dhisEventID | ID created for the Event inserted into the Tracked Entity Instance |
status | Message describing if the process was success or if there was any error during the insertion of the data. |
The following is an example for a request done to the endpoint:
...