1.32 Complete data set registrations

This section is about complete data set registrations for data sets. A registration marks as a data set as completely captured.

1.32.1 Completing data sets

This section explains how to register data sets as complete. This is achieved by interacting with the completeDataSetRegistrations resource:

/api/26/completeDataSetRegistrations

The endpoint supports the POST method for registering data set completions. The endpoint is functionally very similar to the dataValueSets endpoint, with support for bulk import of complete registrations.

Importing both XML and JSON formatted payloads are supported. The basic format of this payload, given as XML in this example, is like so:

<completeDataSetRegistrations xmlns="http://dhis2.org/schema/dxf/2.0">
  <completeDataSetRegistration period="200810" dataSet="eZDhcZi6FLP" organisationUnit="qhqAxPSTUXp"
    attributeOptionCombo="bRowv6yZOF2" storedBy="imported"/>
  <completeDataSetRegistration period="200811" dataSet="eZDhcZi6FLP" organisationUnit="qhqAxPSTUXp"
    attributeOptionCombo="bRowv6yZOF2" storedBy="imported"/>
</completeDataSetRegistrations>

The storedBy attribute is optional (as it is a nullable property on the complete registration object). You can also optionally set the date property (time of registration) as an attribute. It the time is not set, the current time will be used.

The import process supports the following query parameters:

Complete data set registrations query parameters
Parameter Values Description
dataSetIdScheme id | name | code | attribute:ID Property of the data set to use to map the complete registrations.
orgUnitIdScheme id | name | code | attribute:ID Property of the organisation unit to use to map the complete registrations.
attributeOptionComboIdScheme id | name | code | attribute:ID Property of the attribute option combos to use to map the complete registrations.
idScheme id | name | code | attribute:ID Property of all objects including data sets, org units and attribute option combos, to use to map the complete registrations.
preheatCache false | true Whether to save changes on the server or just return the import summary.
dryRun false | true Whether registration applies to sub units
importStrategy CREATE | UPDATE | CREATE_AND_UPDATE | DELETE Save objects of all, new or update import status on the server.
skipExistingCheck false | true Skip checks for existing complete registrations. Improves performance. Only use for empty databases or when the registrations to import do not exist already.
async false | true Indicates whether the import should be done asynchronous or synchronous. The former is suitable for very large imports as it ensures that the request does not time out, although it has a significant performance overhead. The latter is faster but requires the connection to persist until the process is finished.

1.32.2 Reading complete data set registrations

This section explains how to retrieve data set completeness registrations. We will be using the completeDataSetRegistrations resource. The query parameters to use are these:

Data value set query parameters
Parameter Description
dataSet Data set identifier, multiple data sets are allowed
period Period identifier in ISO format. Multiple periods are allowed.
startDate Start date for the time span of the values to export
endDate End date for the time span of the values to export
created Include only registrations which were created since the given timestamp
createdDuration Include only registrations which were created within the given duration. The format is <value><time-unit>, where the supported time units are “d”, “h”, “m”, “s” (days, hours, minutes, seconds). The time unit is relative to the current time.
orgUnit Organisation unit identifier, can be specified multiple times. Not applicable if orgUnitGroup is given.
orgUnitGroup Organisation unit group identifier, can be specified multiple times. Not applicable if orgUnit is given.
children Whether to include the children in the hierarchy of the organisation units
limit The maximum number of registrations to include in the response.
idScheme Identifier property used for meta data objects in the response.
dataSetIdScheme Identifier property used for data sets in the response. Overrides idScheme.
orgUnitIdScheme Identifier property used for organisation units in the response. Overrides idScheme.
attributeOptionComboIdScheme Identifier property used for attribute option combos in the response. Overrides idScheme.

The dataSet and orgUnit parameters can be repeated in order to include multiple data sets and organisation units.

The period, start/end date, created and createdDuration parameters provde multple ways to set the time dimension for the request, thus only one can be used. For example, it doesn’t make sense to both set the start/end date and to set the periods.

An example request looks like this:

curl "https://play.dhis2.org/demo/api/26/completeDataSetRegistrations?dataSet=pBOMPrpg1QX&dataSet=pBOMPrpg1QX
  &startDate=2014-01-01&endDate=2014-01-31&orgUnit=YuQRtpLP10I&orgUnit=vWbkYPRmKyS&children=true"
  -H "Accept:application/xml" -u admin:district -v

You can get the response in xml and json format. You can indicate which response format you prefer through the Accept HTTP header like in the example above. For xml you use application/xml ; for json you use application/json .

1.32.3 Un-completing data sets

This section explains how you can un-register the completeness of a data set. To un-complete a data set you will interact with the completeDataSetRegistrations resource:

/api/26/completeDataSetRegistrations

This resource supports DELETE for un-registration. The following query parameters are supported:

Complete data set registrations query parameters
Query parameter Required Description
ds Yes Data set identifier
pe Yes Period identifier
ou Yes Organisation unit identifier
cc No (must combine with cp) Attribute combo identifier (for locking check)
cp No (must combine with cp) Attribute option identifiers, separated with ; for multiple values (for locking check)
multiOu No (default false) Whether registration applies to sub units