Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

REST API for Administration and Mapping (1.1)

Volker edited this page Jun 13, 2019 · 4 revisions

The content of this page has been generated automatically. The original version of this page can be accessed on a running adapter with the following URL http://localhost:8081/docs/api-guide.html (assuming that the adapter has been installed in the root context of the web application container and the container accepts connections on port 8081 on localhost).

DHIS2 FHIR Adapter API Guide for Administration and Mapping

Table of Contents

Verb Usage
GET Used to retrieve a resource
POST Used to create a new resource
PATCH Used to update an existing resource, including partial updates (support for http://jsonpatch.com/and https://tools.ietf.org/html/rfc7386).
DELETE Used to delete an existing resource
Status code Usage
200 OK The request completed successfully
201 Created A new resource has been created successfully. The resource's URI is available from the response's Locationheader
204 No Content An update to an existing resource has been applied successfully
400 Bad Request The request was malformed. The response body will include an error providing further information
404 Not Found The requested resource did not exist

To use the API authentication is required. Currently only basic authentication is supported. The support will be extended to OAuth2 in the future. The authentication is verified by DHIS 2 and authorities are granted by DHIS 2 as well (mapped by the configuration of the adapter).

The API re-uses several enumerations. These are described by this section. Enumerations that are used by one one API resource are documented with the corresponding API resource.

Data type enumerations are used for defining data the are passed to a script and data that is returned by a script. Some of the data types can also be used for script arguments. In this case there is a string represenation for that data type.

Value Description
BOOLEAN A boolean value. The strings trueand falsecan be used.
INTEGER An integer value without fraction digits. E.g. 10678
STRING A string value.
DOUBLE A double precision floating point value. E.g. -18.83
DATE_TIME A date and time value. E.g. 2018-11-13T20:11:11.204Z
DATE_UNIT A date unit. Possible values are YEARS, MONTHS, DAYS.
GENDER Gender of a person. Possible values are MALE, FEMALE.
WEIGHT_UNIT A weight unit. Possible values are GRAM, KILO_GRAM, OUNCE, POUND.
CONSTANT The code of a constant resource entry. E.g. GENDER_FEMALE.
CODE The code of a code resource entry. E.g. VACCINE_01.
LOCATION A GEO location with longitude and latitude (in specified order). E.g. [-10.212,69.123]
PATTERN A regular expression pattern that may also contain groups. E.g. CODE_(.+)
ORG_UNIT_REF A reference to a organization unit (by unique ID, code or name). E.g. CODE:OU_471827
TRACKED_ENTITY_REF A reference to a tracked entity type (by unique ID or name). E.g. NAME:Person
TRACKED_ENTITY_ATTRIBUTE_REF A reference to a tracked entity attribute (by unique ID, code or name). E.g. ID:1uw827761s21
DATA_ELEMENT_REF A reference to a data element (by unique ID, code or name). E.g. NAME:CP Birth Weight
PROGRAM_REF A reference to a tracker program (by unique ID, name). E.g. NAME:Child Programme
PROGRAM_STAGE_REF A reference to a tracker program stage (bu unique ID, name). E.g. NAME:Birth
FHIR_RESOURCE A FHIR resource as defined by HAPI FHIR API. There is no string representation for this data type.
FHIR_RESOURCE_LIST A list of FHIR resources as defined by HAPI FHIR API. There is no string representation for this data type.
EVENT_DECISION_TYPE A decision that is made before processing an event (tracker program stage instance). Possible values are CONTINUE (use the existing event), NEW_EVENT (create a new event, just for repeatable program stages), BREAK (the complete rule is not applicable).
  • ACTIVE
  • CANCELLED
  • COMPLETED
  • ACTIVE
  • COMPLETED
  • OVERDUE
  • SCHEDULE
  • SKIPPED
  • VISITED

The event period day type specifies when a FHIR resource can be used as input for a specific rule. For this the effective date that is extracted from the FHIR resource is compared relative to an event specific date. To which event specific date the comparison is performed is defined by this constant. If this constant is not specified in a rule, then no restriction for the effective date of the FHIR resource exists.

Value Description
EVENT_DATE Relative to the event date itself.
DUE_DATE Relative to the due date of the event.
ORIG_DUE_DATE Relative to the originally calculated due date (not modified by any script).
EVENT_UPDATED_DATE Relative to the last update date of the event.
VALUE_UPDATED_DATE Relative to the maximum last updated date of any data value of the event.

Resources can be divided into three groups:

  • Code mapping management.
  • Data mapping management.
  • Adapter administration.

The response body resource examples in this document use by default content type application/hal+json.

If you create a new resource, links to other resources can simply be specified by the URL of the resource (see examples in all resource specific sections). If you want to update an existing resource, links to other resources must be updated by a special operation.

If you would like to update the transformation export script of a program stage rule, the following example will change the link:

$ curl -i -XPUT -u admin:district -d "http://localhost:8081/api/executableScripts/ddc7c612-aabb-4ec4-bd63-6d5220cf666f" -H "Content-Type:text/uri-list" http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/transformExpScript

With the following command, the link can be deleted:

$ curl -i -XDELETE -u admin:district http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/transformExpScript

Sorting and paging can be achieved as seen below. Read resource sorted and paged curl snippet

$ curl 'http://localhost:8081/api/codes?page=0&size=3&sort=lastUpdatedAt%2Cdesc' -i -u 'admin:district' -X GET

Read resource sorted and paged response body

{
  "_embedded" : {
    "codes" : [ {
      "createdAt" : "2019-06-13T11:03:50.334Z",
      "lastUpdatedBy" : "2h2maqu827d",
      "lastUpdatedAt" : "2019-06-13T11:03:50.334Z",
      "name" : "DTaP, 5 pertussis antigens",
      "code" : "VACCINE_106",
      "mappedCode" : null,
      "description" : "diphtheria, tetanus toxoids and acellular pertussis vaccine, 5 pertussis antigens",
      "enabled" : true,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8081/api/codes/02422ddd-b606-4bb6-8d0f-cca090182b5d"
        },
        "code" : {
          "href" : "http://localhost:8081/api/codes/02422ddd-b606-4bb6-8d0f-cca090182b5d"
        },
        "codeCategory" : {
          "href" : "http://localhost:8081/api/codes/02422ddd-b606-4bb6-8d0f-cca090182b5d/codeCategory"
        }
      }
    }, {
      "createdAt" : "2019-06-13T11:03:50.334Z",
      "lastUpdatedBy" : "2h2maqu827d",
      "lastUpdatedAt" : "2019-06-13T11:03:50.334Z",
      "name" : "M/R",
      "code" : "VACCINE_04",
      "mappedCode" : null,
      "description" : "measles and rubella virus vaccine",
      "enabled" : true,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8081/api/codes/eac12b34-ddeb-47af-a1de-59ee2dac488f"
        },
        "code" : {
          "href" : "http://localhost:8081/api/codes/eac12b34-ddeb-47af-a1de-59ee2dac488f"
        },
        "codeCategory" : {
          "href" : "http://localhost:8081/api/codes/eac12b34-ddeb-47af-a1de-59ee2dac488f/codeCategory"
        }
      }
    }, {
      "createdAt" : "2019-06-13T11:03:50.334Z",
      "lastUpdatedBy" : "2h2maqu827d",
      "lastUpdatedAt" : "2019-06-13T11:03:50.334Z",
      "name" : "MMR",
      "code" : "VACCINE_03",
      "mappedCode" : null,
      "description" : "measles, mumps and rubella virus vaccine",
      "enabled" : true,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8081/api/codes/71f5536a-2587-45b9-88ac-9aba362a424a"
        },
        "code" : {
          "href" : "http://localhost:8081/api/codes/71f5536a-2587-45b9-88ac-9aba362a424a"
        },
        "codeCategory" : {
          "href" : "http://localhost:8081/api/codes/71f5536a-2587-45b9-88ac-9aba362a424a/codeCategory"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8081/api/codes?page=0&size=3&sort=lastUpdatedAt,desc"
    },
    "self" : {
      "href" : "http://localhost:8081/api/codes"
    },
    "next" : {
      "href" : "http://localhost:8081/api/codes?page=1&size=3&sort=lastUpdatedAt,desc"
    },
    "last" : {
      "href" : "http://localhost:8081/api/codes?page=1&size=3&sort=lastUpdatedAt,desc"
    },
    "profile" : {
      "href" : "http://localhost:8081/api/profile/codes"
    }
  },
  "page" : {
    "size" : 3,
    "totalElements" : 5,
    "totalPages" : 2,
    "number" : 0
  }
}
Table 1. Fields for paged code reading
Path Type Description
page Object The paging information.
page.size Number The used page size (may be less than the specified amount).
page.totalElements Number The total amount of elements.
page.totalPages Number The total number of pages.
page.number Number The current page number.
_links Object Links to other resources

Filtering can be done as shown below. Read resource filtered curl snippet

$ curl 'http://localhost:8081/api/codes?name=DTaP' -i -u 'admin:district' -X GET

Read resource filtered response body

{
  "_embedded" : {
    "codes" : [ {
      "createdAt" : "2019-06-13T11:03:50.333Z",
      "lastUpdatedBy" : "2h2maqu827d",
      "lastUpdatedAt" : "2019-06-13T11:03:50.333Z",
      "name" : "DTaP",
      "code" : "VACCINE_20",
      "mappedCode" : null,
      "description" : "diphtheria, tetanus toxoids and acellular pertussis vaccine",
      "enabled" : true,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8081/api/codes/f9462e8c-653b-4c6a-a502-8470a1ab2187"
        },
        "code" : {
          "href" : "http://localhost:8081/api/codes/f9462e8c-653b-4c6a-a502-8470a1ab2187"
        },
        "codeCategory" : {
          "href" : "http://localhost:8081/api/codes/f9462e8c-653b-4c6a-a502-8470a1ab2187/codeCategory"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/codes{?page,size,sort}",
      "templated" : true
    },
    "profile" : {
      "href" : "http://localhost:8081/api/profile/codes"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}

The constant resource enables mapping of a constant value to a configurable value. E.g. the constant GENDER_MALE can be mapped to the DHIS 2 option set value Male. When another value is used by DHIS 2 (e.g. the letter M for Male), then just the configurable value must be changed. The rules and transformations does not need to be changed. Create resource curl snippet

$ curl 'http://localhost:8081/api/constants' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "category" : "GENDER",
  "name" : "Gender Female",
  "description" : "Constant for Gender option value as it is used by DHIS2.",
  "code" : "GENDER_FEMALE",
  "dataType" : "STRING",
  "value" : "Female"
}'
Table 2. Fields for constant creation
Path Type Description Constraints
name String The unique name of the constant. Must not be blank. Size must be between 0 and 230 inclusive
code String The unique code of the constant. Must not be blank. Size must be between 0 and 50 inclusive
description String The detailed description that describes for which purpose the constant is used.
category String The constant category to which the constant belongs to. Must not be null. Supported values are GENDER, OTHER, TEXT_RECOGNITION
dataType String The data type of the constant value. Must not be null. Supported values are BOOLEAN, CODE, CODE_SET, CONSTANT, DATA_ELEMENT_REF, DATE_TIME, DATE_UNIT, DOUBLE, EVENT_DECISION_TYPE, FHIR_RESOURCE, FHIR_RESOURCE_LIST, GENDER, HEIGHT_UNIT, INTEGER, LOCATION, ORG_UNIT_REF, PATTERN, PROGRAM_REF, PROGRAM_STAGE_REF, STRING, TRACKED_ENTITY_ATTRIBUTE_REF, TRACKED_ENTITY_REF, WEIGHT_UNIT
value String The value of the constant (must have the specified data type). Size must be between 0 and 250 inclusive

Read resource curl snippet

$ curl 'http://localhost:8081/api/constants/fa4a3a0e-ca46-40e4-b832-3aec96bed55e' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.320Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.320Z",
  "name" : "Gender Male",
  "description" : null,
  "category" : "GENDER",
  "code" : "GENDER_MALE",
  "dataType" : "STRING",
  "value" : "Male",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/constants/fa4a3a0e-ca46-40e4-b832-3aec96bed55e"
    },
    "constant" : {
      "href" : "http://localhost:8081/api/constants/fa4a3a0e-ca46-40e4-b832-3aec96bed55e"
    }
  }
}
Table 3. Fields for constant reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the constant.
code String The unique code of the constant.
description String The detailed description that describes for which purpose the constant is used.
category String The constant category to which the constant belongs to.
dataType String The data type of the constant value.
value String The data type of the constant value (must have the specified data type).
_links Object Links to other resources

The code category resource is used to group codes. E.g. a category can be used for defining vaccine codes or organization unit codes. Create resource curl snippet

$ curl 'http://localhost:8081/api/codeCategories' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Test Code Category",
  "code" : "TEST_CODE_CATEGORY",
  "description" : "This is a test code category."
}'
Table 4. Fields for code category creation
Path Type Description Constraints
name String The unique name of the code category. Must not be blank. Size must be between 0 and 230 inclusive
code String The unique code of the code category. Must not be blank. Size must be between 0 and 50 inclusive
description String The detailed description that describes for which purpose the code category is used.

Read resource curl snippet

$ curl 'http://localhost:8081/api/codeCategories/8673a315-dd27-4e4c-bb8b-1212808d4ca1' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.314Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.314Z",
  "name" : "Organization Unit",
  "code" : "ORGANIZATION_UNIT",
  "description" : "Includes the mapping for organization units.",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/codeCategories/8673a315-dd27-4e4c-bb8b-1212808d4ca1"
    },
    "codeCategory" : {
      "href" : "http://localhost:8081/api/codeCategories/8673a315-dd27-4e4c-bb8b-1212808d4ca1"
    }
  }
}
Table 5. Fields for code category reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the code category.
code String The unique code of the code category.
description String The detailed description that describes for which purpose the code category is used.
_links Object Links to other resources

The code resource is used to define system independent codes. E.g. one code can be created for a specific vaccine. This code can then be used by rules and transformations. This code can the be mapped to system specific codes (e.g. country dependent vaccine codes). Create resource curl snippet

$ curl 'http://localhost:8081/api/codes' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Test Code",
  "code" : "TEST_CODE",
  "mappedCode" : "MAPPED_TEST_CODE",
  "description" : "This is a test code.",
  "codeCategory" : "http://localhost:8081/api/codeCategories/8673a315-dd27-4e4c-bb8b-1212808d4ca1"
}'
Table 6. Fields for code creation
Path Type Description Constraints
name String The unique name of the code. Must not be blank. Size must be between 0 and 230 inclusive
enabled Boolean Specifies if the code can be used (by default true).
code String The unique code of the code. Must not be blank. Size must be between 0 and 50 inclusive
mappedCode String The optional mapped code (e.g. organization unit code as it exists on DHIS2). If this is not specified the code itself is used. Size must be between 0 and 230 inclusive
description String The detailed description that describes for which purpose the code is used.
codeCategory String The reference to the code category to which this code belongs to. Must not be null

Read resource curl snippet

$ curl 'http://localhost:8081/api/codes/348d9391-c770-4853-8cdf-f3c5c6830485' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.319Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.319Z",
  "name" : "Central Hospital Freetown",
  "code" : "OU_FT_CH",
  "mappedCode" : "OU_6125",
  "description" : "Organization unit Central Hospital in Freetown.",
  "enabled" : true,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/codes/348d9391-c770-4853-8cdf-f3c5c6830485"
    },
    "code" : {
      "href" : "http://localhost:8081/api/codes/348d9391-c770-4853-8cdf-f3c5c6830485"
    },
    "codeCategory" : {
      "href" : "http://localhost:8081/api/codes/348d9391-c770-4853-8cdf-f3c5c6830485/codeCategory"
    }
  }
}
Table 7. Fields for code reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the code.
enabled Boolean Specifies if the code can be used.
code String The unique code of the code.
mappedCode String The optional mapped code (e.g. organization unit code as it exists on DHIS2). If this is not specified the code itself is used.
description String The detailed description that describes for which purpose the code is used.
_links Object Links to other resources

The code category resource is used to group codes for a specific purpose. E.g. a code set can be defined that contains all vaccines that result in a measles immunization. This code set can then be used to check if a rule is applicable to change measles immunization related information of a patient. Create resource curl snippet

$ curl 'http://localhost:8081/api/codeSets' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Vaccine Measles",
  "code" : "ALL_MEASLES",
  "codeCategory" : "http://localhost:8081/api/codeCategories/7090561e-f45b-411e-99c0-65fa1d145018",
  "description" : "All measles vaccine codes.",
  "codeSetValues" : [ {
    "code" : "http://localhost:8081/api/codes/f9462e8c-653b-4c6a-a502-8470a1ab2187"
  }, {
    "code" : "http://localhost:8081/api/codes/02422ddd-b606-4bb6-8d0f-cca090182b5d",
    "enabled" : false
  } ]
}'
Table 8. Fields for code set creation
Path Type Description Constraints
name String The unique name of the code set. Must not be blank. Size must be between 0 and 230 inclusive
code String The unique code of the code set. Must not be blank. Size must be between 0 and 50 inclusive
description String The detailed description that describes for which purpose the code set is used.
codeCategory String The code category reference to which the code set belongs to. Must not be null
codeSetValues Array The codes that belong to this code set. Must not be null
codeSetValues[].code String The included code reference (must be unique in the code set).
codeSetValues[].enabled Boolean Specifies if the code is enabled in the code set.
codeSetValues[].preferredExport Boolean Specifies if the code is used as preferred code when exporting (by default false).

Read resource curl snippet

$ curl 'http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.335Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.335Z",
  "name" : "All DTP/DTaP",
  "code" : "ALL_DTP_DTAP",
  "description" : "All DTP/DTaP vaccines.",
  "codeSetValues" : [ {
    "enabled" : true,
    "preferredExport" : false,
    "_links" : {
      "codeSet" : {
        "href" : "http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558"
      },
      "code" : {
        "href" : "http://localhost:8081/api/codes/02422ddd-b606-4bb6-8d0f-cca090182b5d"
      }
    }
  }, {
    "enabled" : true,
    "preferredExport" : false,
    "_links" : {
      "codeSet" : {
        "href" : "http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558"
      },
      "code" : {
        "href" : "http://localhost:8081/api/codes/f9462e8c-653b-4c6a-a502-8470a1ab2187"
      }
    }
  } ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558"
    },
    "codeSet" : {
      "href" : "http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558"
    },
    "codeCategory" : {
      "href" : "http://localhost:8081/api/codeSets/bb66ee91-8e86-422c-bb00-5a90ac95a558/codeCategory"
    }
  }
}
Table 9. Fields for code set reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the code set.
code String The unique code of the code set.
description String The detailed description that describes for which purpose the code set is used.
codeSetValues Array The codes that belong to this code set.
codeSetValues[].enabled Boolean Specifies if the code is enabled in the code set.
codeSetValues[].preferredExport Boolean Specifies if the code is used as preferred code when exporting (by default false).
_links Object Links to other resources
codeSetValues[]._links Object Links to other resources (e.g. the referenced code)

The system resource is used to define coding system. E.g. the CVX standard for vaccine codes is a coding system with a defined system URI. Also the identifier values for national patient identifiers are defined within a coding system. Create resource curl snippet

$ curl 'http://localhost:8081/api/systems' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Sierra Leone Patient",
  "code" : "SYSTEM_SL_PATIENT",
  "description" : "All Sierra Leone patients.",
  "descriptionProtected" : false,
  "systemUri" : "http://example.sl/patients",
  "enabled" : true,
  "fhirDisplayName" : "National Patients"
}'
Table 10. Fields for system creation
Path Type Description Constraints
name String The unique name of the system. Must not be blank. Size must be between 0 and 230 inclusive
code String The unique code of the system. Must not be blank. Size must be between 0 and 50 inclusive
description String The detailed description that describes for which purpose the system is used.
systemUri String The system URI of the system. Must not be blank. Size must be between 0 and 120 inclusive
enabled Boolean Specifies if this system and its code are enabled.
descriptionProtected Boolean Specifies if the description contains license information that must not be changed.
fhirDisplayName String Display name of the system and its assigned identifiers and codes that is used when storing data on FHIR clients. Size must be between 0 and 100 inclusive

Read resource curl snippet

$ curl 'http://localhost:8081/api/systems/c4e9ac6a-cc8f-4c73-aab6-0fa6775c0ca3' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.331Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.331Z",
  "name" : "Sierra Leone Organization",
  "code" : "SYSTEM_SL_ORGANIZATION",
  "systemUri" : "http://example.sl/organizations",
  "enabled" : true,
  "description" : null,
  "descriptionProtected" : false,
  "fhirDisplayName" : null,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/systems/c4e9ac6a-cc8f-4c73-aab6-0fa6775c0ca3"
    },
    "system" : {
      "href" : "http://localhost:8081/api/systems/c4e9ac6a-cc8f-4c73-aab6-0fa6775c0ca3"
    }
  }
}
Table 11. Fields for system reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the system.
code String The unique code of the system.
description String The detailed description that describes for which purpose the system is used.
systemUri String The system URI of the system.
enabled Boolean Specifies if this system and its code are enabled.
fhirDisplayName String Display name of the system and its assigned identifiers and codes that is used when storing data on FHIR clients.
descriptionProtected Boolean Specifies if the description contains license information that must not be changed.
_links Object Links to other resources

The system code resource is used to define system specific codes and map then to internally used codes that are used by rules and transformations. E.g. a system specific code may be a national vaccine code that is mapped to an internal code. Create resource curl snippet

$ curl 'http://localhost:8081/api/systemCodes' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "system" : "http://localhost:8081/api/systems/c4e9ac6a-cc8f-4c73-aab6-0fa6775c0ca3",
  "code" : "http://localhost:8081/api/codes/348d9391-c770-4853-8cdf-f3c5c6830485",
  "systemCode" : "982783729",
  "displayName" : "Organization Test"
}'
Table 12. Fields for system code creation
Path Type Description Constraints
enabled Boolean Specifies if the code can be used.
system String The reference to the system to which the code belongs to. Must not be null
systemCode String The code of the system. Must not be blank. Size must be between 0 and 120 inclusive
code String The reference to the internal code that is used for the system specific code. Must not be null
displayName String The official display name of the system specific code.

Read resource curl snippet

$ curl 'http://localhost:8081/api/systemCodes/c513935c-9cd2-4357-a679-60f0c79bfacb' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.331Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.331Z",
  "systemCode" : "982737",
  "enabled" : true,
  "displayName" : "Organization 982737",
  "systemCodeValue" : "http://example.sl/organizations|982737",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/systemCodes/c513935c-9cd2-4357-a679-60f0c79bfacb"
    },
    "systemCode" : {
      "href" : "http://localhost:8081/api/systemCodes/c513935c-9cd2-4357-a679-60f0c79bfacb"
    },
    "code" : {
      "href" : "http://localhost:8081/api/systemCodes/c513935c-9cd2-4357-a679-60f0c79bfacb/code"
    },
    "system" : {
      "href" : "http://localhost:8081/api/systemCodes/c513935c-9cd2-4357-a679-60f0c79bfacb/system"
    }
  }
}
Table 13. Fields for system code reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
enabled Boolean Specifies if the code can be used.
systemCode String The code of the system.
displayName String The official display name of the system specific code.
systemCodeValue String The combination of system URI and code separated by a pipe character (generated, cannot be updated).
_links Object Links to other resources

The script resource defines a single script with a specific purpose. The script itself cannot be executed. Only executable scripts can be executed. There may be more than one executable script for one script (using different script argument values). The purpose may be a evaluation (e.g. calculating a specific date) or a transformation (e.g. transformation from FHIR patient to DHIS 2 tracked entity instance). For one script there may be several script sources (one for each supported FHIR version). A single script source can also handle multiple FHIR versions. One script may have several arguments that are passed as a single map variable to the script. The script may require further variables to execute. Create resource curl snippet

$ curl 'http://localhost:8081/api/scripts' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Transforms FHIR Immunization to Y/N data element",
  "code" : "TRANSFORM_FHIR_IMMUNIZATION_YN",
  "description" : "Transforms FHIR Immunization to Y/N data element.",
  "scriptType" : "TRANSFORM_TO_DHIS",
  "returnType" : "BOOLEAN",
  "inputType" : "FHIR_IMMUNIZATION",
  "outputType" : "DHIS_EVENT",
  "variables" : [ "CONTEXT", "INPUT", "OUTPUT" ]
}'
Table 14. Fields for script creation
Path Type Description Constraints
name String The unique name of the script. Must not be blank. Size must be between 0 and 230 inclusive
code String The unique code of the script. Must not be blank. Size must be between 0 and 50 inclusive
description String The detailed description that describes for which purpose the script is used.
scriptType String The the of the script that describes its purpose. Must not be null. Supported values are EVALUATE, SEARCH_FILTER, TRANSFORM_FHIR, TRANSFORM_TO_DHIS, TRANSFORM_TO_FHIR
returnType String The data type of the value that is returned by the script. Must not be null. Supported values are BOOLEAN, CODE, CODE_SET, CONSTANT, DATA_ELEMENT_REF, DATE_TIME, DATE_UNIT, DOUBLE, EVENT_DECISION_TYPE, FHIR_RESOURCE, FHIR_RESOURCE_LIST, GENDER, HEIGHT_UNIT, INTEGER, LOCATION, ORG_UNIT_REF, PATTERN, PROGRAM_REF, PROGRAM_STAGE_REF, STRING, TRACKED_ENTITY_ATTRIBUTE_REF, TRACKED_ENTITY_REF, WEIGHT_UNIT
inputType String The required data type of the transformation input. Supported values are DHIS_ENROLLMENT, DHIS_EVENT, DHIS_ORGANIZATION_UNIT, DHIS_TRACKED_ENTITY_INSTANCE, FHIR_CONDITION, FHIR_DIAGNOSTIC_REPORT, FHIR_ENCOUNTER, FHIR_IMMUNIZATION, FHIR_LOCATION, FHIR_MEDICATION_REQUEST, FHIR_OBSERVATION, FHIR_ORGANIZATION, FHIR_PATIENT, FHIR_PRACTITIONER, FHIR_RELATED_PERSON
outputType String The required data type of the transformation output. Supported values are DHIS_ENROLLMENT, DHIS_EVENT, DHIS_ORGANIZATION_UNIT, DHIS_TRACKED_ENTITY_INSTANCE, FHIR_CONDITION, FHIR_DIAGNOSTIC_REPORT, FHIR_ENCOUNTER, FHIR_IMMUNIZATION, FHIR_LOCATION, FHIR_MEDICATION_REQUEST, FHIR_OBSERVATION, FHIR_ORGANIZATION, FHIR_PATIENT, FHIR_PRACTITIONER, FHIR_RELATED_PERSON
variables Array The variables that are required for the script execution.
baseScript String Link to another script from which arguments are inherited.

Read resource curl snippet

$ curl 'http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.320Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.320Z",
  "name" : "Transforms FHIR Immunization to option set data element",
  "description" : "Transforms FHIR Immunization to an option set data element.",
  "code" : "TRANSFORM_FHIR_IMMUNIZATION_OS",
  "scriptType" : "TRANSFORM_TO_DHIS",
  "returnType" : "BOOLEAN",
  "inputType" : "FHIR_IMMUNIZATION",
  "outputType" : "DHIS_EVENT",
  "variables" : [ "CONTEXT", "INPUT", "OUTPUT" ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b"
    },
    "script" : {
      "href" : "http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b"
    },
    "sources" : {
      "href" : "http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b/sources"
    },
    "arguments" : {
      "href" : "http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b/arguments"
    },
    "baseScript" : {
      "href" : "http://localhost:8081/api/scripts/f18acd12-bc85-4f79-935d-353904eadc0b/baseScript"
    }
  }
}
Table 15. Fields for script reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the script.
code String The unique code of the script.
description String The detailed description that describes for which purpose the script is used.
scriptType String The the of the script that describes its purpose.
returnType String The data type of the value that is returned by the script.
inputType String The required data type of the transformation input.
outputType String The required data type of the transformation output.
variables Array The variables that are required for the script execution.
_links Object Links to other resources

The script argument resource defines a single script argument that belongs to a script. Event of the script argument is marked as mandatory, providing a value is not required. The final value must be specified by the executable script argument in this case. The provided default argument value is only used when the executable script does not define any override value for that argument Create resource curl snippet

$ curl 'http://localhost:8081/api/scriptArgs' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "script" : "http://localhost:8081/api/script/f1da6937-e2fe-47a4-b0f3-8bbff7818ee1",
  "name" : "otherWeightUnit",
  "description" : "The resulting weight unit in which the value will be set on the data element.",
  "dataType" : "WEIGHT_UNIT",
  "mandatory" : true,
  "array" : false,
  "defaultValue" : "KILO_GRAM"
}'
Table 16. Fields for script argument creation
Path Type Description Constraints
script String The reference to the script resource to which this argument belongs to. Must not be null
name String The name of the script argument. This is also used inside the script source to access the argument value. Must not be blank. Size must be between 0 and 30 inclusive
description String The detailed description of the purpose of the argument.
dataType String The data type of the argument value. Must not be null. Supported values are BOOLEAN, CODE, CODE_SET, CONSTANT, DATA_ELEMENT_REF, DATE_TIME, DATE_UNIT, DOUBLE, EVENT_DECISION_TYPE, FHIR_RESOURCE, FHIR_RESOURCE_LIST, GENDER, HEIGHT_UNIT, INTEGER, LOCATION, ORG_UNIT_REF, PATTERN, PROGRAM_REF, PROGRAM_STAGE_REF, STRING, TRACKED_ENTITY_ATTRIBUTE_REF, TRACKED_ENTITY_REF, WEIGHT_UNIT
array Boolean Specifies if the argument contains an array of values. The values must be separated by a pipe character.
mandatory Boolean Specifies if the argument is mandatory and cannot be null when the script is executed.
defaultValue String The default value of the argument. This may be overridden by the executable script. The value must be convertible to the specified data type. If the argument is an array, the array values must be separated by pipe characters.

Read resource curl snippet

$ curl 'http://localhost:8081/api/scriptArgs/d8cd0e7d-7780-45d1-8094-b448b480e6b8' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.329Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.329Z",
  "name" : "round",
  "dataType" : "BOOLEAN",
  "mandatory" : true,
  "array" : false,
  "defaultValue" : "true",
  "description" : "Specifies if the resulting value should be rounded.",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/scriptArgs/d8cd0e7d-7780-45d1-8094-b448b480e6b8"
    },
    "scriptArg" : {
      "href" : "http://localhost:8081/api/scriptArgs/d8cd0e7d-7780-45d1-8094-b448b480e6b8"
    },
    "script" : {
      "href" : "http://localhost:8081/api/scriptArgs/d8cd0e7d-7780-45d1-8094-b448b480e6b8/script"
    }
  }
}
Table 17. Fields for script argument reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The name of the script argument. This is also used inside the script source to access the argument value.
description String The detailed description of the purpose of the argument.
dataType String The data type of the argument value.
array Boolean Specifies if the argument contains an array of values. The values must be separated by a pipe character.
mandatory Boolean Specifies if the argument is mandatory and cannot be null when the script is executed.
defaultValue String Specifies if the argument is mandatory and cannot be null when the script is executed.
_links Object Links to other resources

The source code of the script. There may be a source for each supported FHIR version at most. Create resource curl snippet

$ curl 'http://localhost:8081/api/scriptSources' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "script" : "http://localhost:8081/api/script/f1da6937-e2fe-47a4-b0f3-8bbff7818ee1",
  "sourceType" : "JAVASCRIPT",
  "sourceText" : "output.setValue(args['dataElement'], vitalSignUtils.getWeight(input.value, args['weightUnit'], args['round']), null, args['override'], context.getFhirRequest().getLastUpdated())",
  "fhirVersions" : [ "DSTU3" ]
}'
Table 18. Fields for script source creation
Path Type Description Constraints
script String The reference to the script to which this source belongs to. Must not be null
sourceType String The type of the source code (the programming language). Must not be null. Supported values are JAVASCRIPT
sourceText String The code of the script in the configured programming language (source type). Must not be blank
fhirVersions Array The FHIR versions that are supported by this script source. Must not be null. Size must be between 1 and 2147483647 inclusive

Read resource curl snippet

$ curl 'http://localhost:8081/api/scriptSources/081c4642-bb83-44ab-b90f-aa206ad347aa' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.323Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.323Z",
  "sourceText" : "output.setIntegerOptionValue(args['dataElement'], immunizationUtils.getMaxDoseSequence(input), 1, false, args['optionValuePattern'], (input.hasPrimarySource()?!input.getPrimarySource():null))",
  "sourceType" : "JAVASCRIPT",
  "fhirVersions" : [ "DSTU3" ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/scriptSources/081c4642-bb83-44ab-b90f-aa206ad347aa"
    },
    "scriptSource" : {
      "href" : "http://localhost:8081/api/scriptSources/081c4642-bb83-44ab-b90f-aa206ad347aa"
    },
    "script" : {
      "href" : "http://localhost:8081/api/scriptSources/081c4642-bb83-44ab-b90f-aa206ad347aa/script"
    }
  }
}
Table 19. Fields for script source reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
sourceType String The type of the source code (the programming language).
sourceText String The code of the script in the configured programming language (source type).
fhirVersions Array The FHIR versions that are supported by this script source.
_links Object Links to other resources

The executable script resource provides the ability to create an executable script for a script. There may be more than one executable script for one script. Each executable script can override the script argument values of the original scripts. E.g. a script may define an argument for the data element reference and the unit for the weight of the person. The script may not define a default value for the data element, but a default value for the unit (e.g. kilogram). The executable script that processes the weight of a new born child must then define the value for the data element reference and may override the unit (e.g. gram because weight precision for a new born child). Create resource curl snippet

$ curl 'http://localhost:8081/api/executableScripts' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "script" : "http://localhost:8081/api/script/f1da6937-e2fe-47a4-b0f3-8bbff7818ee1",
  "name" : "CP: Baby Birth Weight",
  "code" : "CP_BABY_BIRTH_WEIGHT",
  "overrideArguments" : [ {
    "argument" : "http://localhost:8081/api/scriptArgs/07679199-59ae-4530-9411-ac5814102372",
    "overrideValue" : "CODE:DE_2005736",
    "enabled" : true
  }, {
    "argument" : "http://localhost:8081/api/scriptArgs/d8cd0e7d-7780-45d1-8094-b448b480e6b8",
    "overrideValue" : "false",
    "enabled" : true
  } ]
}'
Table 20. Fields for executable script creation
Path Type Description Constraints
script String The reference to the script resource that is executed by this resource definition. Must not be null
name String The name of the executable script. Must not be blank. Size must be between 0 and 230 inclusive
code String The code of the executable script. Must not be blank. Size must be between 0 and 100 inclusive
description String The detailed description of the purpose of the executable script.
overrideArguments Array The overridden arguments of the script resource. If the script resource defined mandatory arguments with null values, these must be specified for the executable script. Otherwise the script cannot be executed. If no argument value should be overridden, this field need not to be specified.
baseExecutableScript String Link to another executable script from which arguments are inherited.
overrideArguments[].argument String Reference to the script argument resource for which the value should be overridden.
overrideArguments[].overrideValue String The value that should be used for the argument when executing the script. The value must match the data type of the argument.
overrideArguments[].enabled Boolean Specifies if the override argument is enabled. If the override argument is not enabled, the value of the script argument itself is used.

Read resource curl snippet

$ curl 'http://localhost:8081/api/executableScripts/1a2950cf-0842-4dd3-9453-284fb08789d3' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.325Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.325Z",
  "name" : "CP: OPV Dose",
  "code" : "CP_OPV_DOSE",
  "description" : "Transforms FHIR Immunization for OPV vaccines.",
  "overrideArguments" : [ {
    "overrideValue" : "CODE:DE_2006104",
    "enabled" : true,
    "_links" : {
      "argument" : {
        "href" : "http://localhost:8081/api/scriptArgs/44134ba8-d77f-4c4d-90c6-b434ffbe7958"
      }
    }
  } ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/executableScripts/1a2950cf-0842-4dd3-9453-284fb08789d3"
    },
    "executableScript" : {
      "href" : "http://localhost:8081/api/executableScripts/1a2950cf-0842-4dd3-9453-284fb08789d3"
    },
    "baseExecutableScript" : {
      "href" : "http://localhost:8081/api/executableScripts/1a2950cf-0842-4dd3-9453-284fb08789d3/baseExecutableScript"
    },
    "script" : {
      "href" : "http://localhost:8081/api/executableScripts/1a2950cf-0842-4dd3-9453-284fb08789d3/script"
    }
  }
}
Table 21. Fields for executable script reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The name of the executable script.
code String The code of the executable script.
description String The detailed description of the purpose of the executable script.
overrideArguments Array The overridden arguments of the script resource. If the script resource defined mandatory arguments with null values, these must be specified for the executable script. Otherwise the script cannot be executed. If no argument value should be overridden, this field need not to be specified.
overrideArguments[].overrideValue String The value that should be used for the argument when executing the script. The value must match the data type of the argument.
overrideArguments[].enabled Boolean Specifies if the override argument is enabled. If the override argument is not enabled, the value of the script argument itself is used.
_links Object Links to other resources
overrideArguments[]._links Object Links to other resources

Configures the reference to a DHIS 2 tracked entity type. A tracked entity type must define a unique identifier in order to be able to map FHIR data to existing tracked entity instances. Create resource curl snippet

$ curl 'http://localhost:8081/api/trackedEntities' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Person Tracked Entity (disabled)",
  "description" : "Transforms a FHIR Patient to a Person (obsolete).",
  "enabled" : false,
  "trackedEntityReference" : {
    "value" : "Obsolete Person",
    "type" : "NAME"
  },
  "trackedEntityIdentifierReference" : {
    "value" : "National identifier",
    "type" : "CODE"
  }
}'
Table 22. Fields for tracked entity rule creation
Path Type Description Constraints
name String The unique name of the rule. Must not be blank. Size must be between 0 and 230 inclusive
description String The detailed description that describes for which purpose the rule is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
trackedEntityReference Object The reference to the DHIS2 Tracked Entity Type. Must not be null
trackedEntityReference.value String The unique ID/code/name of the Tracked Entity Type.
trackedEntityReference.type String The type of reference value of the Tracked Entity Type.
trackedEntityIdentifierReference Object The reference to the DHIS2 Tracked Entity Attribute that is used as national identifier. Must not be null
trackedEntityIdentifierReference.value String The unique ID/code/name of the Tracked Entity Attribute.
trackedEntityIdentifierReference.type String The type of reference value of the Tracked Entity Attribute.

Read resource curl snippet

$ curl 'http://localhost:8081/api/trackedEntities/4203754d-2177-4a44-86aa-2de31ee4c8ee' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.352Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.352Z",
  "name" : "Person",
  "description" : "Tracked entity for a patient.",
  "enabled" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "trackedEntityReference" : {
    "value" : "Person",
    "type" : "NAME"
  },
  "trackedEntityIdentifierReference" : {
    "value" : "National identifier",
    "type" : "CODE"
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/trackedEntities/4203754d-2177-4a44-86aa-2de31ee4c8ee"
    },
    "trackedEntity" : {
      "href" : "http://localhost:8081/api/trackedEntities/4203754d-2177-4a44-86aa-2de31ee4c8ee"
    }
  }
}
Table 23. Fields for tracked entity reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the rule.
description String The detailed description that describes for which purpose the rule is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
trackedEntityReference Object The reference to the DHIS2 Tracked Entity Type.
trackedEntityReference.value String The unique ID/code/name of the Tracked Entity Type.
trackedEntityReference.type String The type of reference value of the Tracked Entity Type.
trackedEntityIdentifierReference Object The reference to the DHIS2 Tracked Entity Attribute that is used as national identifier.
trackedEntityIdentifierReference.value String The unique ID/code/name of the Tracked Entity Attribute.
trackedEntityIdentifierReference.type String The type of reference value of the Tracked Entity Attribute.
_links Object Links to other resources

The tracked entity rule resource defines a rule that is able to transform a FHIR resource to a DHIS 2 tracked entity instance. Create resource curl snippet

$ curl 'http://localhost:8081/api/rules' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "FHIR Patient to Person (disabled)",
  "description" : "Transforms a FHIR Patient to a Person",
  "enabled" : false,
  "evaluationOrder" : 0,
  "dhisResourceType" : "TRACKED_ENTITY",
  "fhirResourceType" : "PATIENT",
  "applicableImpScript" : null,
  "applicableCodeSet" : null,
  "trackedEntity" : "http://localhost:8081/api/trackedEntities/4203754d-2177-4a44-86aa-2de31ee4c8ee",
  "transformImpScript" : "http://localhost:8081/api/executableScripts/72451c8f-7492-4707-90b8-a3e0796de19e",
  "orgUnitLookupScript" : "http://localhost:8081/api/executableScripts/25a97bb4-7b39-4ed4-8677-db4bcaa28ccf",
  "locationLookupScript" : "http://localhost:8081/api/executableScripts/ef90531f-4438-48bd-83b3-6370dd65875a"
}'
Table 24. Fields for rule creation
Path Type Description Constraints
name String The unique name of the rule. Must not be blank. Size must be between 0 and 230 inclusive
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2. Must not be null. Supported values are ENROLLMENT, ORGANIZATION_UNIT, PROGRAM_STAGE_EVENT, TRACKED_ENTITY
fhirResourceType String The FHIR resource type of the incoming resource. Must not be null. Supported values are CONDITION, DIAGNOSTIC_REPORT, ENCOUNTER, IMMUNIZATION, LOCATION, MEASURE_REPORT, MEDICATION_REQUEST, OBSERVATION, ORGANIZATION, PATIENT, PRACTITIONER, RELATED_PERSON
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled (by default true).
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled (by default false).
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well (by default false).
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
applicableCodeSet String Link to the code set reference that is used to check if the incoming request is applicable for this rule.
applicableImpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule when transforming from a FHIR to a DHIS2 resource. The script must be an evaluation script that returns a boolean value.
transformImpScript String Link to the executable script reference that is used to transform the FHIR resource input to the DHIS2 resource.
applicableExpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule when transforming from a DHIS2 to a FHIR resource. The script must be an evaluation script that returns a boolean value.
transformExpScript String Link to the executable script reference that is used to transform the DHIS2 resource input to the FHIR resource.
trackedEntity String The reference to the DHIS2 Tracked Entity resource. Must not be null
orgUnitLookupScript String Link to the executable script reference that is used to extract the organization unit reference. The script must be an evaluation script that return a reference.
locationLookupScript String Link to the executable script reference that is used to extract the location reference. The script must be an evaluation script that return a location (geo coordinates).
teiLookupScript String Link to the executable script reference that is used to extract the tracked entity related FHIR resource from the input. The script must be an evaluation script that returns a FHIR resource.
expGeoTransformScript String Link to the executable transformation script that performs the transformation of the GEO coordinates that are included in the tracked entity instance.
expOuTransformScript String Link to the executable transformation script that performs the transformation of the DHIS organization unit to a FHIR resource (e.g. FHIR organization or location).
filterScript String Link to the executable script that prepares the search filter.

Read resource curl snippet

$ curl 'http://localhost:8081/api/rules/5f9ebdc9-852e-4c83-87ca-795946aabc35' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.352Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.352Z",
  "name" : "FHIR Patient to Person",
  "description" : null,
  "enabled" : true,
  "evaluationOrder" : 1,
  "dhisResourceType" : "TRACKED_ENTITY",
  "fhirResourceType" : "PATIENT",
  "impEnabled" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "stop" : false,
  "containedAllowed" : false,
  "grouping" : false,
  "dhisDataReferences" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35"
    },
    "trackedEntityRule" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35"
    },
    "applicableCodeSet" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/applicableCodeSet"
    },
    "expOuTransformScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/expOuTransformScript"
    },
    "filterScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/filterScript"
    },
    "applicableExpScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/applicableExpScript"
    },
    "transformImpScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/transformImpScript"
    },
    "orgUnitLookupScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/orgUnitLookupScript"
    },
    "locationLookupScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/locationLookupScript"
    },
    "teiLookupScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/teiLookupScript"
    },
    "trackedEntity" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/trackedEntity"
    },
    "transformExpScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/transformExpScript"
    },
    "applicableImpScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/applicableImpScript"
    },
    "expGeoTransformScript" : {
      "href" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35/expGeoTransformScript"
    }
  }
}
Table 25. Fields for rule reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the rule.
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2.
fhirResourceType String The FHIR resource type of the incoming resource.
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled.
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well.
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
containedAllowed Boolean Specified if this rule can process contained resources.
dhisDataReferences Array Contains the references to DHIS2 data elements in which the data that is processed by the assigned rule is stored.
_links Object Links to other resources

The organization unit rule resource defines a rule that is able to transform a DHIS 2 organisation unit to a FHIR resource (e.g. Organization or Location). Create resource curl snippet

$ curl 'http://localhost:8081/api/rules' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "DHIS Organization Unit to FHIR Location",
  "enabled" : true,
  "evaluationOrder" : 1,
  "dhisResourceType" : "ORGANIZATION_UNIT",
  "fhirResourceType" : "LOCATION",
  "impEnabled" : false,
  "expEnabled" : true,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "stop" : false,
  "containedAllowed" : false,
  "grouping" : false,
  "transformExpScript" : "http://localhost:8081/api/trackedEntities//executableScripts/b918b4cd-67fc-4d4d-9b74-91f98730acd7",
  "identifierLookupScript" : "http://localhost:8081/api/trackedEntities//executableScripts/5090c485-a225-4c2e-a8f6-95fa74ce1618",
  "managingOrgIdentifierLookupScript" : "http://localhost:8081/api/executableScripts/66d12e44-471c-4318-827a-0b397f694b6a"
}'
Table 26. Fields for organization unit creation
Path Type Description Constraints
name String The unique name of the rule. Must not be blank. Size must be between 0 and 230 inclusive
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2. Must not be null. Supported values are ENROLLMENT, ORGANIZATION_UNIT, PROGRAM_STAGE_EVENT, TRACKED_ENTITY
fhirResourceType String The FHIR resource type of the incoming resource. Must not be null. Supported values are CONDITION, DIAGNOSTIC_REPORT, ENCOUNTER, IMMUNIZATION, LOCATION, MEASURE_REPORT, MEDICATION_REQUEST, OBSERVATION, ORGANIZATION, PATIENT, PRACTITIONER, RELATED_PERSON
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled (by default true).
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled (by default false).
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
containedAllowed Boolean Specified if this rule can process contained resources.
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well (by default false).
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
applicableCodeSet String Link to the code set reference that is used to check if the incoming request is applicable for this rule.
applicableImpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule when transforming from a FHIR to a DHIS2 resource. The script must be an evaluation script that returns a boolean value.
transformImpScript String Link to the executable script reference that is used to transform the FHIR resource input to the DHIS2 resource.
applicableExpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule when transforming from a DHIS2 to a FHIR resource. The script must be an evaluation script that returns a boolean value.
transformExpScript String Link to the executable script reference that is used to transform the DHIS2 resource input to the FHIR resource.
identifierLookupScript String Link to the executable script reference that is used to extract the location identifier from the DHIS 2 organization unit. The script must be an evaluation script that returns a STRING.
managingOrgIdentifierLookupScript String Link to the executable script reference that is used to extract the managing organization unit identifier from the DHIS 2 organization unit. The script must be an evaluation script that returns a STRING.
filterScript String Link to the executable script that prepares the search filter.

Read resource curl snippet

$ curl 'http://localhost:8081/api/rules/d0e1472a-05e6-47c9-b36b-ff1f06fec352' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.397Z",
  "lastUpdatedBy" : null,
  "lastUpdatedAt" : "2019-06-13T11:03:50.397Z",
  "name" : "DHIS Organization Unit to FHIR Organization",
  "description" : null,
  "enabled" : true,
  "evaluationOrder" : 0,
  "dhisResourceType" : "ORGANIZATION_UNIT",
  "fhirResourceType" : "ORGANIZATION",
  "impEnabled" : false,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "stop" : false,
  "containedAllowed" : false,
  "grouping" : false,
  "dhisDataReferences" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352"
    },
    "organizationUnitRule" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352"
    },
    "identifierLookupScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/identifierLookupScript"
    },
    "applicableCodeSet" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/applicableCodeSet"
    },
    "transformExpScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/transformExpScript"
    },
    "filterScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/filterScript"
    },
    "transformImpScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/transformImpScript"
    },
    "managingOrgIdentifierLookupScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/managingOrgIdentifierLookupScript"
    },
    "applicableExpScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/applicableExpScript"
    },
    "applicableImpScript" : {
      "href" : "http://localhost:8081/api/organizationUnitRules/d0e1472a-05e6-47c9-b36b-ff1f06fec352/applicableImpScript"
    }
  }
}
Table 27. Fields for rule reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the rule.
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2.
fhirResourceType String The FHIR resource type of the incoming resource.
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled.
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well.
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
containedAllowed Boolean Specified if this rule can process contained resources.
dhisDataReferences Array Contains the references to DHIS2 data elements in which the data that is processed by the assigned rule is stored.
_links Object Links to other resources

Configures how DHIS 2 organization units, DHIS 2 GEO locations, DHIS 2 timestamps and other values can be retrieved from specific FHIR resources. For all FHIR resource types that must be transformed from and to DHIS 2 events a mapping item must exist. Create resource curl snippet

$ curl 'http://localhost:8081/api/fhirResourceMappings' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "fhirResourceType" : "IMMUNIZATION",
  "trackedEntityFhirResourceType" : "PRACTITIONER",
  "impEventGeoLookupScript" : "http://localhost:8081/api/executableScripts/bb070631-46b3-42ec-83b2-00ea219bcf50",
  "impEffectiveDateLookupScript" : "http://localhost:8081/api/executableScripts/a7b60436-9fa7-4fe4-8bf7-f5e22123a980",
  "impTeiLookupScript" : "http://localhost:8081/api/executableScripts/1b6a2f75-cb4a-47b1-8e90-3dfb4db07d36",
  "impEventDateLookupScript" : "http://localhost:8081/api/executableScripts/a7b60436-9fa7-4fe4-8bf7-f5e22123a980",
  "impEnrollmentOrgLookupScript" : "http://localhost:8081/api/executableScripts/25a97bb4-7b39-4ed4-8677-db4bcaa28ccf",
  "impEventOrgLookupScript" : "http://localhost:8081/api/executableScripts/25a97bb4-7b39-4ed4-8677-db4bcaa28ccf",
  "impEnrollmentGeoLookupScript" : "http://localhost:8081/api/executableScripts/bb070631-46b3-42ec-83b2-00ea219bcf50",
  "impEnrollmentDateLookupScript" : "http://localhost:8081/api/executableScripts/a7b60436-9fa7-4fe4-8bf7-f5e22123a980"
}'
Table 28. Fields for FHIR resource mapping creation
Path Type Description Constraints
fhirResourceType String The unique FHIR resource type for which the definition is made.
trackedEntityFhirResourceType String The FHIR resource type to which the DHIS tracked entity is mapped.
deleteWhenAbsent Boolean Specifies if the FHIR resource should be deleted when the corresponding required DHIS 2 data elements are absent.
impTeiLookupScript String Link to the executable script that returns the FHIR resource for the TEI that is assigned to the evaluated mapped FHIR resource. The return type of the script must be FHIR_RESOURCE.
impEventOrgLookupScript String Link to the executable evaluation script that returns a reference to a DHIS2 organization unit of an event. The return type of the script must be ORG_UNIT_REF.
impEventGeoLookupScript String Link to the executable evaluation script that returns a location (longitude and latitude) of an event. The returns type of the script must be LOCATION.
impEventDateLookupScript String Link to the executable evaluation script that returns the event date. The return type of the script must be DATE_TIME.
impEnrollmentOrgLookupScript String Link to the executable evaluation script that returns a reference to a DHIS2 organization unit of an enrollment. The return type of the script must be ORG_UNIT_REF.
impEnrollmentGeoLookupScript String Link to the executable evaluation script that returns a location (longitude and latitude) of an event. The returns type of the script must be LOCATION.
impEnrollmentDateLookupScript String Link to the executable evaluation script that returns the event date. The return type of the script must be DATE_TIME.
impEffectiveDateLookupScript String Link to the executable evaluation script that extract the effective date when the data has been collected. The return type of the script must be DATE_TIME.
expAbsentTransformScript String Link to the executable transformation script that sets in an existing exported FHIR resource a status that indicates that corresponding required DHIS 2 data elements are missing. The return type must be BOOLEAN and indicates if the script was successful.
expTeiTransformScript String Link to the executable transformation script that sets the DHIS 2 tracked entity related FHIR resource in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.
expOrgUnitTransformScript String Link to the executable transformation script that sets the DHIS 2 organization unit related FHIR resource in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.
expGeoTransformScript String Link to the executable transformation script that sets the DHIS 2 GEO coordinate information in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.
expStatusTransformScript String Link to the executable transformation script that sets the DHIS 2 status (e.g. event status) in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.
expDateTransformScript String Link to the executable transformation script that sets the DHIS 2 effective date (e.g. event date) in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.
expGroupTransformScript String Link to the executable transformation script that sets and collects DHIS 2 grouping information (e.g. FHIR encounter as DHIS 2 event) in the transformed FHIR resource. The return type must be BOOLEAN and indicates if the script was successful.

Read resource curl snippet

$ curl 'http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.362Z",
  "lastUpdatedBy" : "h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.362Z",
  "fhirResourceType" : "OBSERVATION",
  "trackedEntityFhirResourceType" : "PATIENT",
  "deleteWhenAbsent" : false,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed"
    },
    "fhirResourceMapping" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed"
    },
    "expStatusTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expStatusTransformScript"
    },
    "impEventDateLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEventDateLookupScript"
    },
    "expAbsentTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expAbsentTransformScript"
    },
    "impEnrollmentOrgLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEnrollmentOrgLookupScript"
    },
    "impTeiLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impTeiLookupScript"
    },
    "impEventGeoLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEventGeoLookupScript"
    },
    "impEffectiveDateLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEffectiveDateLookupScript"
    },
    "impEventOrgLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEventOrgLookupScript"
    },
    "expGroupTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expGroupTransformScript"
    },
    "expOrgUnitTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expOrgUnitTransformScript"
    },
    "impEnrollmentDateLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEnrollmentDateLookupScript"
    },
    "impEnrollmentGeoLookupScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/impEnrollmentGeoLookupScript"
    },
    "expGeoTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expGeoTransformScript"
    },
    "expTeiTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expTeiTransformScript"
    },
    "expDateTransformScript" : {
      "href" : "http://localhost:8081/api/fhirResourceMappings/f1cbd84f-a3db-4aa7-a9f2-a5e547e60bed/expDateTransformScript"
    }
  }
}
Table 29. Fields for tracked entity reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
fhirResourceType String The unique FHIR resource type for which the definition is made.
trackedEntityFhirResourceType String The FHIR resource type to which the DHIS tracked entity is mapped.
deleteWhenAbsent Boolean Specifies if the FHIR resource should be deleted when the corresponding required DHIS 2 data elements are absent.
_links Object Links to other resources

Configures a DHIS 2 Tracker Program for transformations. Create resource curl snippet

$ curl 'http://localhost:8081/api/trackerPrograms' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Mother Programme",
  "description" : null,
  "programReference" : {
    "value" : "Mother Programme",
    "type" : "NAME"
  },
  "enabled" : true,
  "creationEnabled" : true,
  "enrollmentDateIsIncident" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "trackedEntityFhirResourceType" : "PATIENT",
  "trackedEntityRule" : "http://localhost:8081/api/trackedEntityRules/5f9ebdc9-852e-4c83-87ca-795946aabc35"
}'
Table 30. Fields for tracker program creation
Path Type Description Constraints
name String The unique name of the program.
description String The detailed description that describes for which purpose the program is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
programReference Object The reference to the DHIS2 Program.
programReference.value String The unique ID/code/name of the Program.
programReference.type String The type of reference value of the Program.
trackedEntityFhirResourceType String The FHIR resource type of the mapped tracked entity.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
creationEnabled Boolean Specifies if the automatic creation of this program has been enabled (by default false).
creationStatus String The status of the event when it is created automatically.
enrollmentDateIsIncident Boolean Specifies if the enrollment date should be set based on the incident date.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program .
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program .
trackedEntityRule String Link to the tracked entity rule that is used for the tracked entity of this program.
creationApplicableScript String Link to the script that evaluates if the creation of the program is applicable (when creation is enabled).
creationScript String Link to the evaluation of transformation script that is executed when the program event is created (when creation is enabled).
beforeScript String Link to the evaluation of transformation script that is executed before the transformed FHIR resource is processed.
afterScript String Link to the evaluation of transformation script that is executed after the transformed FHIR resource has been processed.

Read resource curl snippet

$ curl 'http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.370Z",
  "lastUpdatedBy" : null,
  "lastUpdatedAt" : "2019-06-13T11:03:50.370Z",
  "name" : "Child Programme",
  "description" : null,
  "programReference" : {
    "value" : "Child Programme",
    "type" : "NAME"
  },
  "enabled" : true,
  "creationEnabled" : true,
  "enrollmentDateIsIncident" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "trackedEntityFhirResourceType" : "PATIENT",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d"
    },
    "trackerProgram" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d"
    },
    "creationScript" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d/creationScript"
    },
    "trackedEntityRule" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d/trackedEntityRule"
    },
    "beforeScript" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d/beforeScript"
    },
    "afterScript" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d/afterScript"
    },
    "creationApplicableScript" : {
      "href" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d/creationApplicableScript"
    }
  }
}
Table 31. Fields for tracker program reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the program.
description String The detailed description that describes for which purpose the program is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
programReference Object The reference to the DHIS2 Program.
programReference.value String The unique ID/code/name of the Program.
programReference.type String The type of reference value of the Program.
trackedEntityFhirResourceType String The FHIR resource type of the mapped tracked entity.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
creationEnabled Boolean Specifies if the automatic creation of this program has been enabled (by default false).
creationStatus String The status of the event when it is created automatically.
enrollmentDateIsIncident Boolean Specifies if the enrollment date should be set based on the incident date.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program .
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program .
_links Object Links to other resources

Configures a DHIS 2 Tracker Program Stages for transformations. The Tracker Program Stages belong to a Tracker Program that must have been configured before. Create resource curl snippet

$ curl 'http://localhost:8081/api/trackerProgramStages' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Other Baby Postnatal",
  "description" : null,
  "programStageReference" : {
    "value" : "Baby Postnatal",
    "type" : "NAME"
  },
  "enabled" : true,
  "creationEnabled" : true,
  "creationStatus" : null,
  "eventDateIsIncident" : true,
  "beforePeriodDayType" : null,
  "beforePeriodDays" : 0,
  "afterPeriodDayType" : null,
  "afterPeriodDays" : 0,
  "program" : "http://localhost:8081/api/trackerPrograms/45e61665-754d-4861-891e-a2064fc0ae7d"
}'
Table 32. Fields for tracker program stage creation
Path Type Description Constraints
name String The unique name of the program stage.
description String The detailed description that describes for which purpose the program stage is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
programStageReference Object The reference to the DHIS2 Program Stage.
programStageReference.value String The unique ID/code/name of the Program Stage.
programStageReference.type String The type of reference value of the Program Stage.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
creationEnabled Boolean Specifies if the automatic creation of this program stage has been enabled (by default false).
creationStatus String The status of the event when it is created automatically.
eventDateIsIncident Boolean Specifies if the event date should be set based on the incident date.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
program String Link to the tracker program to which this stage belongs to.
creationApplicableScript String Link to the script that evaluates if the creation of the program stage is applicable (when creation is enabled).
creationScript String Link to the evaluation of transformation script that is executed when the program stage event is created (when creation is enabled).
beforeScript String Link to the evaluation of transformation script that is executed before the transformed FHIR resource is processed.
afterScript String Link to the evaluation of transformation script that is executed after the transformed FHIR resource has been processed.

Read resource curl snippet

$ curl 'http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.370Z",
  "lastUpdatedBy" : null,
  "lastUpdatedAt" : "2019-06-13T11:03:50.370Z",
  "name" : "Birth",
  "description" : null,
  "programStageReference" : {
    "value" : "Birth",
    "type" : "NAME"
  },
  "enabled" : true,
  "creationEnabled" : true,
  "creationStatus" : null,
  "eventDateIsIncident" : true,
  "beforePeriodDayType" : null,
  "beforePeriodDays" : 0,
  "afterPeriodDayType" : null,
  "afterPeriodDays" : 0,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad"
    },
    "trackerProgramStage" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad"
    },
    "beforeScript" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad/beforeScript"
    },
    "program" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad/program"
    },
    "afterScript" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad/afterScript"
    },
    "creationApplicableScript" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad/creationApplicableScript"
    },
    "creationScript" : {
      "href" : "http://localhost:8081/api/trackerProgramStages/4c074c85-be49-4b9d-8973-9e16b9615dad/creationScript"
    }
  }
}
Table 33. Fields for tracker program stage reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the program stage.
description String The detailed description that describes for which purpose the program stage is used.
enabled Boolean Specifies if this rule is enabled.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this tracked entity type is enabled.
programStageReference Object The reference to the DHIS2 Program Stage.
programStageReference.value String The unique ID/code/name of the Program Stage.
programStageReference.type String The type of reference value of the Program Stage.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this tracked entity type. (by default false).
creationEnabled Boolean Specifies if the automatic creation of this program stage has been enabled (by default false).
creationStatus String The status of the event when it is created automatically.
eventDateIsIncident Boolean Specifies if the event date should be set based on the incident date.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
_links Object Links to other resources

The program stage rule resource defines a rule that is able to transform a FHIR resource to a DHIS 2 event. Create resource curl snippet

$ curl 'http://localhost:8081/api/rules' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Child Programme: Estimated Infant Weight",
  "description" : null,
  "enabled" : true,
  "evaluationOrder" : 10,
  "dhisResourceType" : "PROGRAM_STAGE_EVENT",
  "fhirResourceType" : "OBSERVATION",
  "impEnabled" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "stop" : false,
  "containedAllowed" : false,
  "dhisDataReferences" : [ {
    "dataReference" : {
      "value" : "DE_2006099",
      "type" : "CODE"
    },
    "scriptArgName" : "dataElement",
    "description" : "The data element that receives the value.",
    "required" : true
  } ],
  "enrollmentCreationEnabled" : true,
  "eventCreationEnabled" : true,
  "updateEventDate" : false,
  "beforePeriodDayType" : "ORIG_DUE_DATE",
  "beforePeriodDays" : 0,
  "afterPeriodDayType" : "ORIG_DUE_DATE",
  "afterPeriodDays" : 1,
  "applicableEnrollmentStatus" : {
    "active" : true,
    "completed" : true,
    "cancelled" : false
  },
  "applicableEventStatus" : {
    "overdue" : true,
    "active" : true,
    "schedule" : true,
    "visited" : true,
    "completed" : true,
    "skipped" : false
  },
  "eventStatusUpdate" : {
    "overdueToActive" : false,
    "scheduleToActive" : true,
    "completedToActive" : false
  },
  "transformImpScript" : "http://localhost:8081/api/executableScripts/0104ad19-ba82-48dc-bbd1-38dd5f0d8a2c",
  "programStage" : "http://localhost:8081/api/executableScripts/526b4e01-7747-47ef-a25d-f32ccd739e87",
  "applicableCodeSet" : "http://localhost:8081/api/codeSets/d37dfecb-ce88-4fa4-9a78-44ffe874c140"
}'
Table 34. Fields for program stage rule creation
Path Type Description Constraints
name String The unique name of the rule. Must not be blank. Size must be between 0 and 230 inclusive
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2. Must not be null. Supported values are ENROLLMENT, ORGANIZATION_UNIT, PROGRAM_STAGE_EVENT, TRACKED_ENTITY
fhirResourceType String The FHIR resource type of the incoming resource. Must not be null. Supported values are CONDITION, DIAGNOSTIC_REPORT, ENCOUNTER, IMMUNIZATION, LOCATION, MEASURE_REPORT, MEDICATION_REQUEST, OBSERVATION, ORGANIZATION, PATIENT, PRACTITIONER, RELATED_PERSON
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled.
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well.
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
containedAllowed Boolean Specified if this rule can process contained resources.
enrollmentCreationEnabled Boolean Specifies if the creation of an enrollment is allowed when processing the rule and the enrollment does not exist.
eventCreationEnabled Boolean Specifies if the creation of an event is allowed when processing the rule and the event does not exist.
updateEventDate Boolean Specifies if the event date can be updated with the content of the transformed FHIR resource.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
applicableEnrollmentStatus Object Specifies for which status of the corresponding enrollment the transformation can be performed.
applicableEnrollmentStatus.active Boolean Specifies that the transformation can be performed when the status of the enrollment is active.
applicableEnrollmentStatus.completed Boolean Specifies that the transformation can be performed when the status of the enrollment is completed.
applicableEnrollmentStatus.cancelled Boolean Specifies that the transformation can be performed when the status of the enrollment is cancelled.
applicableEventStatus Object Specifies for which status of the corresponding event the transformation can be performed.
applicableEventStatus.active Boolean Specifies that the transformation can be performed when the status of the event is active.
applicableEventStatus.overdue Boolean Specifies that the transformation can be performed when the status of the event is overdue.
applicableEventStatus.schedule Boolean Specifies that the transformation can be performed when the status of the event is schedule.
applicableEventStatus.visited Boolean Specifies that the transformation can be performed when the status of the event is visited.
applicableEventStatus.skipped Boolean Specifies that the transformation can be performed when the status of the event is skipped.
applicableEventStatus.completed Boolean Specifies that the transformation can be performed when the status of the event is completed.
eventStatusUpdate Object Specifies if the status of the event should set to active when it is not active.
eventStatusUpdate.overdueToActive Boolean Specifies that the event status should be set to active when the event status is overdue.
eventStatusUpdate.scheduleToActive Boolean Specifies that the event status should be set to active when the event status is schedule.
eventStatusUpdate.completedToActive Boolean Specifies that the event status should be set to active when the event status is completed.
dhisDataReferences Array Contains the references to DHIS2 data elements in which the data that is processed by the assigned rule is stored.
dhisDataReferences[].description String The description of the purpose of the data reference.
dhisDataReferences[].scriptArgName String The name of the script argument to which the data reference is passed when performing the transformation.
dhisDataReferences[].required Boolean Specifies if the data element is required. If the data element is required and has no value, the value is regarded as absent and absence handling is performed when transforming.
dhisDataReferences[].dataReference Object Specifies the reference to the data element.
dhisDataReferences[].dataReference.value String The unique ID/code/name of the data element.
dhisDataReferences[].dataReference.type String The type of reference value of the data element.
applicableCodeSet String Link to the code set reference that is used to check if the incoming request is applicable for this rule.
applicableImpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule. The script must be an evaluation script that returns a boolean value.
transformImpScript String Link to the executable script reference that is used to transform the FHIR resource input to the DHIS2 resource.
applicableExpScript String Link to the executable script reference that is used to check if the incoming request is applicable for this rule when transforming a DHIS2 to FHIR resource. The script must be an evaluation script that returns a boolean value.
transformExpScript String Link to the executable script reference that is used to transform the DHIS2 resource input to the FHIR resource.
programStage String Link to the tracked entity resource that describes the tracked entity of the transformation.
expDeleteEvaluateScript String Link to the executable evaluation script that evaluates if the transformation should result in a deletion of the corresponding FHIR resource.
filterScript String Link to the executable script that prepares the search filter.

Read resource curl snippet

$ curl 'http://localhost:8081/api/rules/a6636c83-f236-48cd-bb2b-592147db9a34' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.373Z",
  "lastUpdatedBy" : null,
  "lastUpdatedAt" : "2019-06-13T11:03:50.373Z",
  "name" : "Child Programme: Infant Weight",
  "description" : null,
  "enabled" : true,
  "evaluationOrder" : 10,
  "dhisResourceType" : "PROGRAM_STAGE_EVENT",
  "fhirResourceType" : "OBSERVATION",
  "impEnabled" : true,
  "expEnabled" : false,
  "fhirCreateEnabled" : true,
  "fhirUpdateEnabled" : false,
  "fhirDeleteEnabled" : false,
  "stop" : false,
  "containedAllowed" : false,
  "grouping" : false,
  "dhisDataReferences" : [ {
    "createdAt" : "2019-06-13T11:03:50.374Z",
    "lastUpdatedBy" : null,
    "lastUpdatedAt" : "2019-06-13T11:03:50.374Z",
    "dataReference" : {
      "value" : "DE_2006099",
      "type" : "CODE"
    },
    "scriptArgName" : "dataElement",
    "description" : null,
    "required" : true,
    "_links" : {
      "rule" : {
        "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34"
      }
    }
  } ],
  "enrollmentCreationEnabled" : true,
  "eventCreationEnabled" : true,
  "updateEventDate" : false,
  "beforePeriodDayType" : "ORIG_DUE_DATE",
  "beforePeriodDays" : 0,
  "afterPeriodDayType" : "ORIG_DUE_DATE",
  "afterPeriodDays" : 1,
  "applicableEnrollmentStatus" : {
    "active" : true,
    "completed" : false,
    "cancelled" : false
  },
  "applicableEventStatus" : {
    "overdue" : true,
    "active" : true,
    "schedule" : true,
    "visited" : true,
    "completed" : false,
    "skipped" : false
  },
  "eventStatusUpdate" : {
    "overdueToActive" : false,
    "scheduleToActive" : false,
    "completedToActive" : false
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34"
    },
    "programStageRule" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34"
    },
    "applicableExpScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/applicableExpScript"
    },
    "filterScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/filterScript"
    },
    "transformImpScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/transformImpScript"
    },
    "programStage" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/programStage"
    },
    "applicableCodeSet" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/applicableCodeSet"
    },
    "applicableImpScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/applicableImpScript"
    },
    "transformExpScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/transformExpScript"
    },
    "expDeleteEvaluateScript" : {
      "href" : "http://localhost:8081/api/programStageRules/a6636c83-f236-48cd-bb2b-592147db9a34/expDeleteEvaluateScript"
    }
  }
}
Table 35. Fields for rule reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The unique name of the rule.
description String The detailed description that describes for which purpose the rule is used.
dhisResourceType String The type of the rule and the type of the data that is stored in DHIS2.
fhirResourceType String The FHIR resource type of the incoming resource.
enabled Boolean Specifies if this rule is enabled.
impEnabled Boolean Specifies if transformation of a FHIR to a DHIS2 resource has been enabled.
expEnabled Boolean Specifies if transformation of a DHIS2 to a FHIR resource has been enabled.
fhirCreateEnabled Boolean Specifies if the creation of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default true).
fhirUpdateEnabled Boolean Specifies if the update of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
fhirDeleteEnabled Boolean Specifies if the deletion of a FHIR resource is enabled for output transformations from DHIS to FHIR for this rule (by default false).
stop Boolean Specifies if this rule is the last applied rule. When the transformation should not stop further rules are applied as well.
grouping Boolean Specifies if the FHIR resources groups references of other FHIR resources (e.g. FHIR Encounter).
evaluationOrder Number Specifies the precedence of this rule when several rules match. Higher values define a higher precedence.
containedAllowed Boolean Specified if this rule can process contained resources.
enrollmentCreationEnabled Boolean Specifies if the creation of an enrollment is allowed when processing the rule and the enrollment does not exist.
eventCreationEnabled Boolean Specifies if the creation of an event is allowed when processing the rule and the event does not exist.
updateEventDate Boolean Specifies if the event date can be updated with the content of the transformed FHIR resource.
beforePeriodDayType String Specifies to which date the the amount of the specified before period days are relative.
beforePeriodDays Number The day (relative according to the specified setting) on and after which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
afterPeriodDayType String Specifies to which date the the amount of the specified after period days are relative.
afterPeriodDays Number The day (relative according to the specified setting) on and before which FHIR resources (according to their effective date) are regarded as being applicable for this program stage.
applicableEnrollmentStatus Object Specifies for which status of the corresponding enrollment the transformation can be performed.
applicableEnrollmentStatus.active Boolean Specifies that the transformation can be performed when the status of the enrollment is active.
applicableEnrollmentStatus.completed Boolean Specifies that the transformation can be performed when the status of the enrollment is completed.
applicableEnrollmentStatus.cancelled Boolean Specifies that the transformation can be performed when the status of the enrollment is cancelled.
applicableEventStatus Object Specifies for which status of the corresponding event the transformation can be performed.
applicableEventStatus.active Boolean Specifies that the transformation can be performed when the status of the event is active.
applicableEventStatus.overdue Boolean Specifies that the transformation can be performed when the status of the event is overdue.
applicableEventStatus.schedule Boolean Specifies that the transformation can be performed when the status of the event is schedule.
applicableEventStatus.visited Boolean Specifies that the transformation can be performed when the status of the event is visited.
applicableEventStatus.skipped Boolean Specifies that the transformation can be performed when the status of the event is skipped.
applicableEventStatus.completed Boolean Specifies that the transformation can be performed when the status of the event is completed.
eventStatusUpdate Object Specifies if the status of the event should set to active when it is not active.
eventStatusUpdate.overdueToActive Boolean Specifies that the event status should be set to active when the event status is overdue.
eventStatusUpdate.scheduleToActive Boolean Specifies that the event status should be set to active when the event status is schedule.
eventStatusUpdate.completedToActive Boolean Specifies that the event status should be set to active when the event status is completed.
dhisDataReferences Array Contains the references to DHIS2 data elements in which the data that is processed by the assigned rule is stored.
dhisDataReferences[].createdAt String The timestamp when the resource has been created.
dhisDataReferences[].lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
dhisDataReferences[].lastUpdatedAt String The timestamp when the resource has been updated the last time.
dhisDataReferences[].description String The description of the purpose of the data reference.
dhisDataReferences[].scriptArgName String The name of the script argument to which the data reference is passed when performing the transformation.
dhisDataReferences[].required Boolean Specifies if the data element is required. If the data element is required and has no value, the value is regarded as absent and absence handling is performed when transforming.
dhisDataReferences[].dataReference Object Specifies the reference to the data element.
dhisDataReferences[].dataReference.value String The unique ID/code/name of the data element.
dhisDataReferences[].dataReference.type String The type of reference value of the data element.
_links Object Links to other resources

The FHIR Client resource defines a single remote FHIR Client and its subscriptions for FHIR resources. Create resource curl snippet

$ curl 'http://localhost:8081/api/fhirClients' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "name" : "Main Subscription",
  "code" : "MAIN_SUBSCRIPTION",
  "description" : "Main FHIR service on which the adapter has subscriptions.",
  "enabled" : true,
  "locked" : false,
  "fhirVersion" : "DSTU3",
  "toleranceMillis" : 2000,
  "autoCreatedSubscriptionResources" : [ "PATIENT" ],
  "adapterEndpoint" : {
    "baseUrl" : "http://localhist:8081",
    "subscriptionType" : "REST_HOOK",
    "authorizationHeader" : "Bearer 98a7558102b7bdc4da5c8f74ca63958c498b4bd9231bd3b0cc"
  },
  "dhisEndpoint" : {
    "authenticationMethod" : "BASIC",
    "username" : "admin",
    "password" : "district"
  },
  "fhirEndpoint" : {
    "baseUrl" : "http://localhost:8082/hapi-fhir-jpaserver-example/baseDstu3",
    "headers" : [ {
      "name" : "Authorization",
      "value" : "Bearer 1196cc744b416a2b91c8239c1a1e251c139d2a89df86427241",
      "secure" : true
    } ]
  }
}'
Table 36. Fields for FHIR client creation
Path Type Description Constraints
name String The name of the FHIR client. Must not be blank. Size must be between 0 and 50 inclusive
code String The code of the FHIR client. Must not be blank. Size must be between 0 and 20 inclusive
description String The detailed description of the purpose of the FHIR client.
enabled Boolean Specifies if this FHIR client has been enabled. If the FHIR client has not been enabled, no subscription notifications are processed from the corresponding FHIR service.
locked Boolean Specifies if this FHIR client has been locked. If the FHIR client has been locked (i.e. by automatic processes), no subscription notifications are processed from the corresponding FHIR service.
outEnabled Boolean Specifies if output transformation from DHIS to FHIR for this FHIR client is enabled (by default false).
useAdapterIdentifier Boolean Specifies if the adapter should add an adapter specific identifier to created and updated resources (by default true). Using such identifiers makes it easier to map resources between FHIR and DHIS 2.
fhirVersion String The FHIR version that should be used when communicating with the client FHIR service. Must not be null. Supported values are DSTU3, R4
toleranceMillis Number The number of milli-seconds to subtract from the last updated timestamp when searching for created and updated resources. Must be at least 0
autoCreatedSubscriptionResources Array Subscription resources for which the subscriptions should be created automatically when creating the subscription resource. This value will not be returned and can only be used when creating and updating the entity. Supported values are PATIENT, RELATED_PERSON
remoteSyncEnabled Boolean Specifies if a FHIR notification can be simulated by a remote FHIR client by invoking a read request on a FHIR resource.
adapterEndpoint Object Specifies FHIR client settings that are relevant for the adapter. Must not be null
adapterEndpoint.baseUrl String The base URL of the adapter that is used to register the subscription on the FHIR service. If the FHIR service runs on a different client, the URL must not contain localhost. If this URL is not specified it is calculated automatically.
adapterEndpoint.subscriptionType String The subscription type that is used to register the subscription on FHIR service. A normal REST hook subscription is sufficient (without any payload). If this causes issues on the FHIR service also a subscription with payload can be used.
adapterEndpoint.authorizationHeader String The authorization header value that is expected by the adapter when it receives a subscription notification from the FHIR service. This should include a bearer token.
dhisEndpoint Object Specifies FHIR client settings that are relevant for the connection to DHIS2. Must not be null
dhisEndpoint.authenticationMethod String The authentication method that should be used when connecting to DHIS2.
dhisEndpoint.username String The username that is used to connect to DHIS2 when handling data of this FHIR client.
dhisEndpoint.password String The password that is used to connect to DHIS2 when handling data of this FHIR client. This value will not be returned and will be set using the original value when performing an update without this value.
fhirEndpoint Object Specifies FHIR client settings that are relevant for the connection to FHIR. Must not be null
fhirEndpoint.baseUrl String The base URL of the FHIR endpoints on the FHIR service.
fhirEndpoint.useRemote Boolean Specifies if connections to the remote FHIR endpoint are enabled (true by default). Otherwise no connection attempt will be made and default values will be used.
fhirEndpoint.useJsonFormat Boolean Specifies if JSON format instead of XML should be used when communicating with this FHIR client (by default false).
fhirEndpoint.sortSupported Boolean Specifies if client does support sorting (by default true).
fhirEndpoint.headers Array The headers that are sent to the client FHIR service when connecting to the FHIR endpoints.
fhirEndpoint.headers[].name String The name of the header for which the value will be sent (e.g. Authorization).
fhirEndpoint.headers[].value String The value of the header for which the value will be sent (e.g. a bearer token). If the value of the header is marked as secure, the value will not be returned and will be set using the original value when performing an update without this value.
fhirEndpoint.headers[].secure Boolean Specifies if the value of the header is secure and should not be returned (e.g. when it contains authentication information).

Read resource curl snippet

$ curl 'http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.331Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.331Z",
  "name" : "HAPI FHIR JPA Server",
  "code" : "DEFAULT_SUBSCRIPTION",
  "enabled" : true,
  "locked" : false,
  "expEnabled" : false,
  "useAdapterIdentifier" : true,
  "description" : "HAPI FHIR JPA Server.",
  "fhirVersion" : "DSTU3",
  "toleranceMillis" : 60000,
  "remoteSyncEnabled" : false,
  "dhisEndpoint" : {
    "authenticationMethod" : "BASIC",
    "username" : "admin"
  },
  "fhirEndpoint" : {
    "baseUrl" : "http://localhost:8082/hapifhirjpaserverexample/baseDstu3",
    "useRemote" : true,
    "logging" : false,
    "verboseLogging" : false,
    "useJsonFormat" : false,
    "sortSupported" : true,
    "headers" : [ {
      "name" : "Authorization",
      "secure" : true
    } ]
  },
  "adapterEndpoint" : {
    "baseUrl" : "http://localhost:8081",
    "authorizationHeader" : "Bearer jhsj832jDShf8ehShdu7ejhDhsilwmdsgs",
    "subscriptionType" : "REST_HOOK_WITH_JSON_PAYLOAD"
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f"
    },
    "fhirClient" : {
      "href" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f"
    },
    "systems" : {
      "href" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f/systems"
    },
    "resources" : {
      "href" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f/resources"
    }
  }
}
Table 37. Fields for FHIR client reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
name String The name of the FHIR client.
code String The code of the FHIR client.
description String The detailed description of the purpose of the FHIR client.
enabled Boolean Specifies if this FHIR client has been enabled. If the FHIR client has not been enabled, no subscription notifications are processed from the corresponding FHIR service.
locked Boolean Specifies if this FHIR client has been locked. If the FHIR client has been locked (i.e. by automatic processes), no subscription notifications are processed from the corresponding FHIR service.
expEnabled Boolean Specifies if output transformation from DHIS to FHIR for this FHIR client is enabled.
useAdapterIdentifier Boolean Specifies if the adapter should add an adapter specific identifier to created and updated resources (by default true). Using such identifiers makes it easier to map resources between FHIR and DHIS 2.
fhirVersion String The FHIR version that should be used when communicating with the client FHIR service.
toleranceMillis Number The number of milli-seconds to subtract from the last updated timestamp when searching for created and updated resources.
autoCreatedSubscriptionResources Array Subscription resources for which the subscriptions should be created automatically when creating the subscription resource. This value will not be returned and can only be used when creating and updating the entity.
remoteSyncEnabled Boolean Specifies if a FHIR notification can be simulated by a remote FHIR client by invoking a read request on a FHIR resource.
adapterEndpoint Object Specifies FHIR client settings that are relevant for the adapter.
adapterEndpoint.baseUrl String The base URL of the adapter that is used to register the subscription on the FHIR service. If the FHIR service runs on a different client, the URL must not contain localhost. If this URL is not specified it is calculated automatically.
adapterEndpoint.subscriptionType String The subscription type that is used to register the subscription on FHIR service. A normal REST hook subscription is sufficient (without any payload). If this causes issues on the FHIR service also a subscription with payload can be used.
adapterEndpoint.authorizationHeader String The authorization header value that is expected by the adapter when it receives a subscription notification from the FHIR service. This should include a bearer token.
dhisEndpoint Object Specifies FHIR client settings that are relevant for the connection to DHIS2.
dhisEndpoint.authenticationMethod String The authentication method that should be used when connecting to DHIS2.
dhisEndpoint.username String The username that is used to connect to DHIS2 when handling data of this FHIR client.
dhisEndpoint.password String The password that is used to connect to DHIS2 when handling data of this FHIR client. This value will not be returned and will be set using the original value when performing an update without this value.
fhirEndpoint Object Specifies FHIR client settings that are relevant for the connection to FHIR.
fhirEndpoint.baseUrl String The base URL of the FHIR endpoints on the FHIR service.
fhirEndpoint.useRemote Boolean Specifies if connections to the remote FHIR endpoint are enabled (true by default). Otherwise no connection attempt will be made and default values will be used.
fhirEndpoint.useJsonFormat Boolean Specifies if JSON format instead of XML should be used when communicating with this FHIR client (by default false).
fhirEndpoint.sortSupported Boolean Specifies if client does support sorting (by default true).
fhirEndpoint.logging Boolean Specifies if basic logging should be enabled when communicating with the FHIR endpoints of this FHIR service.
fhirEndpoint.verboseLogging Boolean Specifies if verbose logging (includes complete payload) should be enabled when communicating with the FHIR endpoints of this FHIR service. Enabling verbose logging may log confidential patient data. This could violate data protection laws and regulations.
fhirEndpoint.headers Array The headers that are sent to the client FHIR service when connecting to the FHIR endpoints.
fhirEndpoint.headers[].name String The name of the header for which the value will be sent (e.g. Authorization).
fhirEndpoint.headers[].value String The value of the header for which the value will be sent (e.g. a bearer token). If the value of the header is marked as secure, the value will not be returned and will be set using the original value when performing an update without this value.
fhirEndpoint.headers[].secure Boolean Specifies if the value of the header is secure and should not be returned (e.g. when it contains authentication information).
_links Object Links to other resources

The resource for FHIR Client resources defines a single subscription for a single specific FHIR resource on a single FHIR Client. Create resource curl snippet

$ curl 'http://localhost:8081/api/fhirClientResources' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "fhirClient" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f",
  "fhirResourceType" : "IMMUNIZATION",
  "description" : "Subscription for all immunizations.",
  "fhirCriteriaParameters" : null
}'
Table 38. Fields for script source creation
Path Type Description Constraints
fhirClient String The reference to the FHIR client to which this resource belongs to. Must not be null
fhirResourceType String The type of the subscribed FHIR resource. Must not be null. Supported values are CONDITION, DIAGNOSTIC_REPORT, ENCOUNTER, IMMUNIZATION, LOCATION, MEASURE_REPORT, MEDICATION_REQUEST, OBSERVATION, ORGANIZATION, PATIENT, PRACTITIONER, RELATED_PERSON
description String The detailed description of the purpose of the subscribed FHIR resource.
fhirCriteriaParameters String The prefix that should be added to the codes when mapping them to DHIS2. Size must be between 0 and 200 inclusive
expOnly Boolean Specifies that this is only used for exporting FHIR resources. Subscription requests are not accepted.
preferred Boolean Specifies if this resource definition is the preferred resource definition for the resource type when no resource definition can be determined otherwise.
impTransformScript String Link to the executable transformation script that transform incoming FHIR resources.

Read resource curl snippet

$ curl 'http://localhost:8081/api/fhirClientResources/667bfa41-867c-4796-86b6-eb9f9ed4dc94' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.332Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.332Z",
  "fhirResourceType" : "PATIENT",
  "fhirCriteriaParameters" : "_format=json",
  "description" : "Subscription for all Patients.",
  "virtual" : false,
  "expOnly" : false,
  "preferred" : false,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/fhirClientResources/667bfa41-867c-4796-86b6-eb9f9ed4dc94"
    },
    "fhirClientResource" : {
      "href" : "http://localhost:8081/api/fhirClientResources/667bfa41-867c-4796-86b6-eb9f9ed4dc94"
    },
    "fhirClient" : {
      "href" : "http://localhost:8081/api/fhirClientResources/667bfa41-867c-4796-86b6-eb9f9ed4dc94/fhirClient"
    },
    "impTransformScript" : {
      "href" : "http://localhost:8081/api/fhirClientResources/667bfa41-867c-4796-86b6-eb9f9ed4dc94/impTransformScript"
    }
  }
}
Table 39. Fields for FHIR client resource reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
fhirResourceType String The type of the subscribed FHIR resource.
description String The detailed description of the purpose of the subscribed FHIR resource.
fhirCriteriaParameters String The prefix that should be added to the codes when mapping them to DHIS2.
expOnly Boolean Specifies that this is only used for exporting FHIR resources. Subscription requests are not accepted.
virtual Boolean Specifies that there is no subscription for this FHIR resource since the FHIR service may not accept subscription for this resource type (just available as contained resources).
preferred Boolean Specifies if this resource definition is the preferred resource definition for the resource type when no resource definition can be determined otherwise.
hirSubscriptionId String The ID of the automatically created FHIR subscription on the FHIR service.
_links Object Links to other resources

The FHIR Client system resource defines a specific coding system that is used for a FHIR resource. E.g. a FHIR system may use system specific codes for patients and organizations. The codes that are provided by several FHIR systems may overlap and are only unique in combination with a FHIR system specific system URI. For each coding system a code prefix can be defined. E.g. if there are ten regions in a country and the ten regions use their own FHIR Client than each region may use its own patient identifiers. These patient identifiers can be made unique by adding a specific code prefix (e.g. two letter abbreviation of the regions). This results in a unique national identifier. Create resource curl snippet

$ curl 'http://localhost:8081/api/fhirClientSystems' -i -u 'admin:district' -X POST \
    -H 'Content-Type: application/json' \
    -d '{
  "fhirClient" : "http://localhost:8081/api/fhirClients/73cd99c5-0ca8-42ad-a53b-1891fccce08f",
  "fhirResourceType" : "LOCATION",
  "system" : "http://localhost:8081/api/systems/2dd51309-3319-40d2-9a1f-be2a102df4a7",
  "codePrefix" : "LOC_"
}'
Table 40. Fields for script source creation
Path Type Description Constraints
fhirClient String The reference to the FHIR client to which this resource belongs to. Must not be null
system String The reference to the system URI that should be mapped to the FHIR client. Must not be null
fhirResourceType String The FHIR resource type to which the system URI should be mapped. Must not be null. Supported values are CONDITION, DIAGNOSTIC_REPORT, ENCOUNTER, IMMUNIZATION, LOCATION, MEASURE_REPORT, MEDICATION_REQUEST, OBSERVATION, ORGANIZATION, PATIENT, PRACTITIONER, RELATED_PERSON
codePrefix String The prefix that should be added to the codes when mapping them to DHIS2. Size must be between 0 and 20 inclusive
defaultValue String The default value that may be used when FHIR resource does not contain the corresponding value. Size must be between 0 and 230 inclusive

Read resource curl snippet

$ curl 'http://localhost:8081/api/fhirClientSystems/ea9804a3-9e82-4d0d-9cd2-e417b32b1c0c' -i -u 'admin:district' -X GET

Read resource response body

{
  "createdAt" : "2019-06-13T11:03:50.332Z",
  "lastUpdatedBy" : "2h2maqu827d",
  "lastUpdatedAt" : "2019-06-13T11:03:50.332Z",
  "fhirResourceType" : "ORGANIZATION",
  "codePrefix" : null,
  "defaultValue" : null,
  "_links" : {
    "self" : {
      "href" : "http://localhost:8081/api/fhirClientSystems/ea9804a3-9e82-4d0d-9cd2-e417b32b1c0c"
    },
    "fhirClientSystem" : {
      "href" : "http://localhost:8081/api/fhirClientSystems/ea9804a3-9e82-4d0d-9cd2-e417b32b1c0c"
    },
    "fhirClient" : {
      "href" : "http://localhost:8081/api/fhirClientSystems/ea9804a3-9e82-4d0d-9cd2-e417b32b1c0c/fhirClient"
    },
    "system" : {
      "href" : "http://localhost:8081/api/fhirClientSystems/ea9804a3-9e82-4d0d-9cd2-e417b32b1c0c/system"
    }
  }
}
Table 41. Fields for FHIR client system reading
Path Type Description
createdAt String The timestamp when the resource has been created.
lastUpdatedBy String The ID of the user that has updated the user the last time or null if the data has been imported to the database directly.
lastUpdatedAt String The timestamp when the resource has been updated the last time.
fhirResourceType String The FHIR resource type to which the system URI should be mapped.
codePrefix String The prefix that should be added to the codes when mapping them to DHIS2.
defaultValue String The default value that may be used when FHIR resource does not contain the corresponding value.
_links Object Links to other resources
Clone this wiki locally