Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
stylenone

RDQA Metadata Transfer

Program Metadata

...

Transfer

The metadata from a DHIS2 program contains items necessary for rendering within the enabled DHIS2 server. The DHIS2 server includes an Import/Export tool to generate a JSON or CSV file with all configurations in the server. However, certain attributes may need cleaning to prevent errors during import to the target server. These attributes typically involve references to users that don’t exist in the target server. To streamline the process and avoid manual deletion of each attribute, we can use the Program Configuration App (PCA). You can read more about the PCA here.

...

https://{serverSource}/api/organisationUnits.json?filter=level:in:[5,6]

https://{serverSource}/api/organisationUnits.json?fields=id&includeAncestors=true&paging=false&filter=ancestors.id:eq:{parentOrgUnit}

Parameters

Description

serverSource

Server where the Organisation Units will be retrieved

Example: https://play.im.dhis2.org/

id

Organisation Units ID

level

Organisation Unit level, this retrieves a more than one Organisation Units

...

Tracked Entity Instances Transfer

Enrollments Transfer

...

  1. Log in to the Server

  2. Type the following request in the URL:

https://{{Server}}/api/trackedEntityInstances.json?ou={{OrgUnit}}&ouMode=DESCENDANTS&program={{Program}}&skipPaging=true

Parameters

Description

Server

Server where the Tracked Entity Instances will be retrieved

Example: https://play.im.dhis2.org/

OrgUnit

Organisation Unit ID Parent

Program

Target Program

  1. Log in to the Target Server

  2. Open the Import/Export tool

  3. Select the TEI Import Option

  4. Import the TEIs

  5. Verify the Import Summary doesn’t display any errors

Enrollments Transfer

  1. Log in to the Server

  2. Type the following request in the URL:

https://{{Server}}/api/enrollments.json?ou={{OrgUnit}}&ouMode=DESCENDANTS&program={{Program}}&skipPaging=true

Parameters

Description

Server

Server where the enrollments will be retrieved

Example: https://play.im.dhis2.org/

OrgUnit

Organisation Unit ID Parent

Program

Target Program

  1. We need to open the JSON file using any tool to modify code, we recommend use VSCode , once the file has been opened, we need to eliminate the following attributes:

    1. lastUpdatedBy

    2. createdBy

  2. Open Postman

  3. Enter the credentials as Basic Authentication

  4. Select Post Method

  5. Enter the following Endpoint

https://{{ServerTarget}}/api/enrollments

  1. Select Body and Check ‘Raw’

  2. Select JSON

  3. Type the JSON retrieved in the source server

  4. Send the request

...

  1. Verify the enrollments

Events Transfer

  1. Log in to the Server

  2. Type the following request in the URL:

https://{{Server}}/api/events.json?program={{Program}}&orgUnit={{OrgUnit}}&ouMode=DESCENDANTS&paging=false&fields=*,!lastUpdatedByUserInfo,!createdByUserInfo,!attributeOptionCombo,!attributeCategoryOptions,!notes,!relationships,dataValues[*,!lastUpdated, !createdByUserInfo, !lastUpdatedByUserInfo]&skipPaging=true&trackedEntityInstance={{TEI}}

Parameters

Description

Server

Server where the events will be retrieved

Example: https://play.im.dhis2.org/

OrgUnit

Organisation Unit ID Parent

Program

Target Program

TEI

Tracked Entity Instance

This process will be repeated depending on the number of TEIs in the server, if the server contains 20 Tracked Entity Instances, we have to change the TEI 20 time to import all events posible

  1. We need to open the JSON file using any tool to modify code, we recommend use VSCode , once the file has been opened, we need to eliminate the following attributes:

    1. lastUpdatedBy

    2. createdBy

  2. Open Postman

  3. Enter the credentials as Basic Authentication

  4. Select Post Method

  5. Enter the following Endpoint

https://{{ServerTarget}}/api/events

  1. Select Body and Check ‘Raw’

  2. Select JSON

  3. Type the JSON retrieved in the source server

  4. Send the request

  5. Verify the events have been imported sucessfully