...
Syncing reports to the server then to DHIS 2
Opensrp server provides the following api for adding reports
The following is the structure of the payload expected
Code Block language json { "reports": "[{\"dateCreated\":\"2020-08-04T15:16:55.539+03:00\",\"duration\":0,\"formSubmissionId\":\"9028b90e-be65-4ec0-91d0-86e9ba9d6c01\",\"hia2Indicators\":[{\"categoryOptionCombo\":\"pE37AYgl7bx\",\"dhisId\":\"BOAUQVmPxf3\",\"indicatorCode\":\"ME_Anti_Malaria_Treatment_Confirmed_Under_5\",\"value\":\"0\"},{\"dhisId\":\"unknown\",\"indicatorCode\":\"ME_Malaria_Cases_Presumed_Over_5\",\"value\":\"0\"}],\"locationId\":\"76bc21e4-6670-480a-8628-7fd44b1d8d14\",\"providerId\":\"chigodi\",\"reportDate\":\"2020-02-27T00:00:00.000+03:00\",\"reportType\":\"Malaria Health Facility Report\"}]" }
A json object inside the reports array looks like so
Code Block { "dateCreated": "2020-08-04T15:16:55.539+03:00", "duration": 0, "formSubmissionId": "9028b90e-be65-4ec0-91d0-86e9ba9d6c01", "hia2Indicators": [ { "categoryOptionCombo": "pE37AYgl7bx", "dhisId": "BOAUQVmPxf3", "indicatorCode": "ME_Anti_Malaria_Treatment_Confirmed_Under_5", "value": "0" }, { "dhisId": "unknown", "indicatorCode": "ME_Malaria_Cases_Presumed_Over_5", "value": "0" } ], "locationId": "76bc21e4-6670-480a-8628-7fd44b1d8d14", "providerId": "chigodi", "reportDate": "2020-02-27T00:00:00.000+03:00", "reportType": "Malaria Health Facility Report" }
To generate the following payload you will need the following.
Create or use an existing report in DHIS 2 instance, use the report name as the
reportType
in the payload above. To check if your report exists use the following apilocationId
,formSubmissionId
,reportDate
,providerId
,dateCreated
(optional),duration
are generated within the app.The
hia2Indicators
are the monthly tallies of the report for a particular month (an aggregation of daily tallies)For a successful sync to DHIS 2 you will need the
https://{dhis2-domain}/api/dataSets/{dataset-id}/metadata.json datasetId is the id of the report, to get this use the api provided in the first pointcategoryOptionCombo
,dhisId
andvalue
as the required fields. To get these you attributes one can fetch export from the following dhis2 apia DHIS 2 instance using the following tool.
For Giz Malawi the mapping for
indicatorCode
is done within the app using a csv with the following structure …Code Block id,indicatorCode,IndicatorDescription,dhisId,categoryOptionCombo,.. 2,ME_Vaccines_Age_pcv_3_Over_1_Outreach,CHD EPI PCV3 Childhood Vaccination Outreach Over 1,IQFC39nNHPX,zKLduwqZFnh,CHD EPI PCV3 Childhood Vaccination Outreach Over 1,child 3,ME_Vaccines_Age_pcv_3_Over_1_Outreach,CHD EPI PCV3 Childhood Vaccination Outreach Under 1,IQFC39nNHPX,ipKITPnwlcP,CHD EPI PCV3 Childhood Vaccination Outreach Under 1,child 4,ME_A_CHD_EPI_Immunization_sessions_cancelled_Outreach,CHD EPI Immunization sessions cancelled Outreach,QJBtQ8GfxXE,kVTGmhgf7wQ,CHD EPI Immunization sessions cancelled Outreach,child 5,ME_A_CHD_EPI_Immunization_sessions_cancelled_Static,CHD EPI Immunization sessions cancelled Static,QJBtQ8GfxXE,yqszvXV2s8u,CHD EPI Immunization sessions cancelled Static,child 6,ME_A_CHD_EPI_Immunization_sessions_planned_Outreach,CHD EPI Immunization sessions planned Outreach,Hig2nHtgfVr,kVTGmhgf7wQ,CHD EPI Immunization sessions planned Outreach,child 7,ME_A_CHD_EPI_Immunization_sessions_planned_Static,CHD EPI Immunization sessions planned Static,Hig2nHtgfVr,yqszvXV2s8u,CHD EPI Immunization sessions planned Static,child 8,ME_A_CHD_EPI_Reasons_for_cancellation,CHD EPI Reasons for cancellation,Er9t7hU2OQp,Tt7fU5lUhAU,CHD EPI Reasons for cancellation,child
At this point you should be done and left with debugging