This script imports patients from a Simple line list into DHIS2. To use it, follow the steps below.
Log into the Simple dashboard and download the desired line list from Reports.
Under the human-readable headers, insert a new row. Populate the relevant columns in that row with the DHIS2 UIDs for those fields.
Note that the src
directory is gitignored.
The script will convert the linelist into a JSON file and place it in the dist/
directory. This directory is also gitignored.
The JSON file is ready to be uploaded to DHIS2
The JSON file can be uploaded to DHIS2 through:
- The dashboard: Navigate to Import/Export --> Tracked Entity Instances --> Upload the JSON file
- The command line:
curl -d @dist/test.json "https://dhis2-sandbox.simple.org/api/trackedEntityInstances" -X POST -H "Content-type:application/json" -u 'user:pass'