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.

...

  1. Check the Summary Table to ensure that there are no issues.

  2. Once the process has been completed without any problems, click on the ‘Start Import’ button.

  3. Verify that the RDQA already exists on the server using the Maintenance App.

...

Preparing Organisation Units [Both OU match UIDs, OU do not match]

Exporting data

Preparing data

GET API data

Send data

...

Dashboards Transfer

RDQA Program has some Dashboard used to review the Program and review the data over time, those Objects are not included in the RDQA Metadata, so we need to use the Import/Export tool in the source server.

  1. Log in into the source server

  2. Open the Import/Export tool

  3. Select Metadata Dependency Export

  4. Select ‘Dashboard’ in the Object Type field

  5. Type ‘RDQA’ on the object field

  6. Check the followings options

    1. JSON

    2. Uncompressed

    3. Skip sharing and access settings

  7. Click on the ‘Export Metadata Dependencies’ button

...

  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

...

  1. Once the JSON file has been cleaned, we import the JSON in the target File

  2. Verify the Summary Report to ensure there are no issues

  3. Verify the Dashboard has been created properly

...

Organisation Units Tranfer

The metadata or data may include some organizational units that don’t exist on the target server. In the case of events with different organizational units, issues may arise when attempting to import them.

To export the organization, we need to use an API request. You can use either Postman or the browser, but make sure to have an extension to change the text to JSON format.

Filters:

https://{serverSource}/api/organisationUnits.json

https://{serverSource}/api/organisationUnits.json?filter=id:in:[organisationUnit1,organisationUnit2]

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

Searching for Organisation Unit IDs


https://play.im.dhis2.org/dev/api/organisationUnits.json?filter=id:in:[Rp268JB6Ne4,cDw53Ej8rju]&fields=*&paging=false

Reponse

Code Block
languagejson
{
    "organisationUnits": [
        {
            "code": "OU_651071",
            "name": "Adonkia CHP",
            "created": "2012-02-17T15:54:39.987",
            "lastUpdated": "2017-05-22T15:21:48.515",
            "translations": [],
            "favorites": [],
            "sharing": {
                "external": false,
                "users": {},
                "userGroups": {}
            },
            "shortName": "Adonkia CHP",
            "dimensionItemType": "ORGANISATION_UNIT",
            "legendSets": [],
            "parent": {
                "id": "qtr8GGlm4gg"
            },
            "children": [],
            "path": "/ImspTQPwCqd/at6UHUQatSo/qtr8GGlm4gg/Rp268JB6Ne4",
            "openingDate": "2010-01-01T00:00:00.000",
            "dataSets": [
            
            ],
            "programs": [
     
            ],
            "users": [],
            "leaf": true,
            "dimensionItem": "Rp268JB6Ne4",
            "displayShortName": "Adonkia CHP",
            "displayName": "Adonkia CHP",
            "access": {
                "manage": true,
                "externalize": false,
                "write": true,
                "read": true,
                "update": true,
                "delete": true
            },
            "favorite": false,
            "href": "https://play.im.dhis2.org/dev/api/organisationUnits/Rp268JB6Ne4",
            "displayFormName": "Adonkia CHP",
            "id": "Rp268JB6Ne4",
            "attributeValues": [],
            "organisationUnitGroups": [
                {
                    "id": "f25dqv3Y7Z0"
                }
            ],
            "level": 4,
            "ancestors": [
                {
                    "id": "ImspTQPwCqd"
                },
                {
                    "id": "at6UHUQatSo"
                },
                {
                    "id": "qtr8GGlm4gg"
                }
            ]
        },
        {
            "code": "OU_278371",
            "name": "Afro Arab Clinic",
            "created": "2012-02-17T15:54:39.987",
            "lastUpdated": "2017-05-22T15:21:48.518",
            "translations": [
                {
                    "locale": "en_GB",
                    "property": "SHORT_NAME",
                    "value": "Afro Arab Clinic"
                },
                {
                    "locale": "en_GB",
                    "property": "NAME",
                    "value": "Afro Arab Clinic"
                }
            ],
            "favorites": [],
            "sharing": {
                "external": false,
                "users": {},
                "userGroups": {}
            },
            "shortName": "Afro Arab Clinic",
            "dimensionItemType": "ORGANISATION_UNIT",
            "legendSets": [],
            "parent": {
                "id": "qtr8GGlm4gg"
            },
            "children": [],
            "path": "/ImspTQPwCqd/at6UHUQatSo/qtr8GGlm4gg/cDw53Ej8rju",
            "openingDate": "2008-01-01T00:00:00.000",
            "dataSets": [
         
            ],
            "programs": [
    
            ],
            "users": [],
            "leaf": true,
            "dimensionItem": "cDw53Ej8rju",
            "displayShortName": "Afro Arab Clinic",
            "displayName": "Afro Arab Clinic",
            "access": {
                "manage": true,
                "externalize": false,
                "write": true,
                "read": true,
                "update": true,
                "delete": true
            },
            "favorite": false,
            "href": "https://play.im.dhis2.org/dev/api/organisationUnits/cDw53Ej8rju",
            "displayFormName": "Afro Arab Clinic",
            "id": "cDw53Ej8rju",
            "attributeValues": [],
            "organisationUnitGroups": [
                {
                    "id": "f25dqv3Y7Z0"
                },
                {
                    "id": "RXL3lPSK8oG"
                }
            ],
            "level": 4,
            "ancestors": [
              
            ]
        }
    ]
}

Download the file and save with JSON format.

Import the Organisation Units on the target server

  1. Log in into the target server

  2. Open the Import/Export tool

  3. Select Import Metadata

  4. Import the Organisation Units

  5. Verify the Organisation Units using the Maintenance App

RDQA Data Transfer

Tracked Entity Instances 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