1.17 CSV metadata import

DHIS2 supports import of metadata in the CSV format. Columns which are not required can be omitted in the CSV file, but the order will be affected. If you would like to specify columns which appear late in the order but not specify columns which appear early in the order you can include empty columns ("") for them. The following object types are supported:

The formats for the currently supported object types for CSV import are listed in the following sections.

1.17.1 Data elements

Data Element CSV Format
Column Required Value (default first) Description
Name Yes Name. Max 230 char. Unique.
UID No UID Stable identifier. Exactly 11 alpha-numeric characters, beginning with a character. Will be generated by system if not specified.
Code No Stable code. Max 50 char.
Short name No 50 first char of name Will fall back to first 50 characters of name if unspecified. Max 50 char. Unique.
Description No Free text description.
Form name No Max 230 char.
Domain type No AGGREGATE | TRACKER Domain type for data element, can be aggregate or tracker. Max 16 char.
Value type No INTEGER | NUMBER | UNIT_INTERVAL | PERCENTAGE | INTEGER_POSITIVE | INTEGER_NEGATIVE | INTEGER_ZERO_OR_POSITIVE | FILE_RESOURCE | COORDINATE |TEXT | LONG_TEXT | LETTER | PHONE_NUMBER | EMAIL | BOOLEAN | TRUE_ONLY | DATE | DATETIME Value type. Max 16 char.
Aggregation operator No SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX | NONE Operator indicating how to aggregate data in the time dimension. Max 16 char.
Category combination UID No UID UID of category combination. Will default to default category combination if not specified.
Url No URL to data element resource. Max 255 char.
Zero is significant No false | true Indicates whether zero values will be stored for this data element.
Option set No UID UID of option set to use for data.
Comment option set No UID UID of option set to use for comments.

An example of a CSV file for data elements can be seen below. The first row will always be ignored. Note how you can skip columns and rely on default values to be used by the system. You can also skip columns which you do not use which appear to the right of the ones

name,uid,code,shortname,description
"Women participated in skill development training",,"D0001","Women participated development training"
"Women participated in community organizations",,"D0002","Women participated community organizations"

1.17.2 Organisation units

Organisation Unit CSV Format
Column Required Value (default first) Description
Name Yes Name. Max 230 characters. Unique.
UID No UID Stable identifier. Max 11 char. Will be generated by system if not specified.
Code No Stable code. Max 50 char.
Parent UID No UID UID of parent organisation unit.
Short name No 50 first char of name Will fall back to first 50 characters of name if unspecified. Max 50 characters. Unique.
Description No Free text description.
Opening date No 1970-01-01 Opening date of organisation unit in YYYY-MM-DD format.
Closed date No Closed date of organisation unit in YYYY-MM-DD format, skip if currently open.
Comment No Free text comment for organisation unit.
Feature type No NONE | MULTI_POLYGON | POLYGON | POINT | SYMBOL Geospatial feature type.
Coordinates No Coordinates used for geospatial analysis in Geo JSON format.
URL No URL to organisation unit resource. Max 255 char.
Contact person No Contact person for organisation unit. Max 255 char.
Address No Address for organisation unit. Max 255 char.
Email No Email for organisation unit. Max 150 char.
Phone number No Phone number for organisation unit. Max 150 char.

A minimal example for importing organisation units with a parent unit looks like this:

name,uid,code,parent
"West province",,"WESTP","ImspTQPwCqd"
"East province",,"EASTP","ImspTQPwCqd"

1.17.3 Validation rules

Validation Rule CSV Format
Column Required Value (default first) Description
Name Yes Name. Max 230 characters. Unique.
UID No UID Stable identifier. Max 11 char. Will be generated by system if not specified.
Code No Stable code. Max 50
Description No Free text description.
Instruction No Free text instruction.
Importance No MEDIUM | HIGH | LOW
Rule type No VALIDATION | SURVEILLANCE
Operator No equal_to | not_equal_to | greater_than | greater_than_or_equal_to | less_than | less_than_or_equal_to | compulsory_pair | exclusive_pair
Period type No Monthly | Daily | Weekly | Quarterly | SixMontly | Yearly
Left side expression Yes Mathematical formula based on data element and option combo UIDs.
Left side expression description Yes Free text.
Left side null if blank No false | true Boolean.
Right side expression Yes Mathematical formula based on data element and option combo UIDs.
Right side expression description Yes Free text.
Right side null if blank No false | true Boolean.

1.17.4 Option sets

Option Set CSV Format
Column Required Value (default first) Description
OptionSetName Yes Name. Max 230 characters. Unique. Should be repeated for each option.
OptionSetUID No UID Stable identifier. Max 11 char. Will be generated by system if not specified. Should be repeated for each option.
OptionSetCode No Stable code. Max 50 char. Should be repeated for each option.
OptionName Yes Option name. Max 230 characters.
OptionUID No UID Stable identifier. Max 11 char. Will be generated by system if not specified.
OptionCode Yes Stable code. Max 50 char.

The format for option sets is special. The three first values represent an option set. The three last values represent an option. The first three values representing the option set should be repeated for each option.

optionsetname,optionsetuid,optionsetcode,optionname,optionuid,optioncode
"Color",,"COLOR","Blue",,"BLUE"
"Color",,"COLOR","Green",,"GREEN"
"Color",,"COLOR","Yellow",,"YELLOW"
"Sex",,,"Male",,"MALE"
"Sex",,,"Female",,"FEMALE"
"Sex",,,"Unknown",,"UNKNOWN"
"Result",,,"High",,"HIGH"
"Result",,,"Medium",,"MEDIUM"
"Result",,,"Low",,"LOW"
"Impact","cJ82jd8sd32","IMPACT","Great",,"GREAT"
"Impact","cJ82jd8sd32","IMPACT","Medium",,"MEDIUM"
"Impact","cJ82jd8sd32","IMPACT","Poor",,"POOR"

1.17.5 Collection membership

In addition to importing objects, you can also choose to only import the group-member relationship between an object and group. Currently the following group and object pairs are supported

  • Organisation Unit Group - Organisation Unit

  • Data Element Group - Data Element

  • Indicator Group - Indicator

The CSV format for these imports are the same

Collection membership CSV Format
Column Required Value (default first) Description
UID Yes UID The UID of the collection to add an object to
UID Yes UID The UID of the object to add to the collection

1.17.6 Other objects

Data Element Group, Category Option, Category Option Group, Organisation Unit Group CSV Format
Column Required Value (default first) Description
Name Yes Name. Max 230 characters. Unique.
UID No UID Stable identifier. Max 11 char. Will be generated by system if not specified.
Code No Stable code. Max 50 char.
Short name No Short name. Max 50 characters.

An example for category options looks like this:

name,uid,code,shortname
"Male",,"MALE"
"Female",,"FEMALE"