Tracker data importation

Hi,

I am trying to import tracker data with DHIS 2.34.10 but still have this error :
Type : ImportSummary
Description : Event date is required.

This is my payload that includes tracked entity instance, enrollment and event :

{
“trackedEntityType”:“czw9M1HD6KQ”,
“orgUnit”:“KSkooYTy8FB”,
“attributes”:[
{
“attribute”:“KLw7ot4LUhx”,
“value”:“BBBBBB”
},
{
“attribute”:“bKSqm9C8lYv”,
“value”:“KKKKKKK”
},
{
“attribute”:“ClQxzV6outh”,
“value”:“30”
}
],
“enrollments”:{
“orgUnit”:“KSkooYTy8FB”,
“program”:“yTNIhqH5wbF”,
“enrollmentDate”:“2022-04-25”,
“incidentDate”:“2022-04-25”,
“events”:[
{
“program”:“yTNIhqH5wbF”,
“orgUnit”:“aeMCpJ3cC3w”,
“eventDate”:“2022-04-25”,
“programStage”:“TXLaVdn0Q0u”,
“DataValues”:[
{
“dataElement”:“tkQwPMKu1kK”,
“value”:“2022-04-25”
}
]
}
]
}
}

Did I make a mistake in this payload ?

Thank you !

Hi @benfrank,

Welcome to the community! :tada:

Thank you for your post! I believe you are using the import/export app and not an API request, right?

First I copied and pasted your payload to use it on play (changed the UIDs because they are different), and the JSON you wrote is correct with no mistakes (when sending an API request). I got this result on play/2.37.6:
“httpStatus”: “OK”,

"httpStatusCode": 200,
"status": "OK",

"message": "Import was successful.",

"response": {

    "responseType": "ImportSummaries",

    "status": "SUCCESS",

    "imported": 1,

That’s when I sent a POST request to https://play.dhis2.org/2.37.6/api/trackedEntityInstances - update: And when I tried to use the import/export app, it worked as well.

However, when I tried to use the Import / Export app on 2.37.6, it turned out the dates need to be in ISO format or UNIX epoch timestamp - so I got this error: image

But when I changed the date format, I still got this error so I’m not sure how to fix the date format yet or it could be a bug in 2.37.6 I’m not sure: image

Update:

I got an error because 2022-02-29 is not an actual date i.e. there’s no 29 in February 2022. :sweat_smile: And I tried to import using the date only not the time and it worked.

@benfrank please see:
Maybe if you try to change the dates to YYYY-MM-DDThh:mm:ss. For example, 2022-04-25T00:00:00. I’d say since you are using version 2.34.10 so I’d at least need to be testing this on 2.35 on play, would you try to reproduce this on play and see if you get the same issue?

2 Likes

Would there be a template to import using csv format?

2 Likes