← Back to team overview

dhis2-devs team mailing list archive

Re: trackedEntityInstances SYNC

 

Hello Dávid,


I created a TEI in the demo server with two enrollments (one ACTIVE and other COMPLETED), I deleted the enrollments and I tried to import this payload with this API call:

https://play.dhis2.org/2.30/api/trackedEntityInstances?strategy=SYNC


I got the same ignored issue:

"responseType": "ImportSummary",
                            "status": "ERROR",
                            "description": "TrackedEntityInstance hhO3vubtIma already has an active enrollment in program ur1Edk5Oe2n",
                            "importCount": {
                                "imported": 0,
                                "updated": 0,
                                "ignored": 1,
                                "deleted": 0

PAYLOAD:

{
   "created":"2018-11-05T10:26:56.542",
   "orgUnit":"DiszpKrYNg8",
   "createdAtClient":"2018-11-06T16:41:52.442",
   "trackedEntityInstance":"hhO3vubtIma",
   "lastUpdated":"2018-11-06T16:41:52.442",
   "trackedEntityType":"nEenWmSyUEp",
   "lastUpdatedAtClient":"2018-11-06T16:41:52.442",
   "inactive":false,
   "deleted":false,
   "featureType":"NONE",
   "programOwners":[
      {
         "ownerOrgUnit":"ImspTQPwCqd",
         "program":"ur1Edk5Oe2n",
         "trackedEntityInstance":"hhO3vubtIma"
      }
   ],
   "enrollments":[
      {
         "storedBy":"admin",
         "created":"2018-11-06T16:40:59.955",
         "orgUnit":"ImspTQPwCqd",
         "createdAtClient":"2018-11-06T16:40:59.955",
         "program":"ur1Edk5Oe2n",
         "trackedEntityInstance":"hhO3vubtIma",
         "enrollment":"EyoT6jskQAX",
         "lastUpdated":"2018-11-06T16:41:22.565",
         "trackedEntityType":"nEenWmSyUEp",
         "lastUpdatedAtClient":"2018-11-06T16:41:22.565",
         "orgUnitName":"Sierra Leone",
         "enrollmentDate":"2018-11-06T00:00:00.000",
         "completedDate":"2018-11-06T16:41:22.552",
         "deleted":false,
         "incidentDate":"2018-11-06T00:00:00.000",
         "completedBy":"admin",
         "status":"COMPLETED",
         "notes":[

         ],
         "relationships":[

         ],
         "attributes":[

         ],
         "events":[
            {
               "storedBy":"admin",
               "dueDate":"2018-11-06T00:00:00.000",
               "createdAtClient":"2018-11-06T16:41:00.743",
               "program":"ur1Edk5Oe2n",
               "event":"zoW7ej6wv1B",
               "programStage":"ZkbAXlQUYJG",
               "orgUnit":"ImspTQPwCqd",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"EyoT6jskQAX",
               "enrollmentStatus":"COMPLETED",
               "status":"SCHEDULE",
               "orgUnitName":"Sierra Leone",
               "lastUpdatedAtClient":"2018-11-06T16:41:00.781",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-06T16:41:00.781",
               "created":"2018-11-06T16:41:00.743",
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            }
         ]
      },
      {
         "storedBy":"admin",
         "created":"2018-11-06T16:41:52.128",
         "orgUnit":"ImspTQPwCqd",
         "createdAtClient":"2018-11-06T16:41:52.128",
         "program":"ur1Edk5Oe2n",
         "trackedEntityInstance":"hhO3vubtIma",
         "enrollment":"WghdhVHnRpy",
         "lastUpdated":"2018-11-06T16:41:52.442",
         "trackedEntityType":"nEenWmSyUEp",
         "lastUpdatedAtClient":"2018-11-06T16:41:52.442",
         "orgUnitName":"Sierra Leone",
         "enrollmentDate":"2018-11-06T00:00:00.000",
         "deleted":false,
         "incidentDate":"2018-11-06T00:00:00.000",
         "status":"ACTIVE",
         "notes":[

         ],
         "relationships":[

         ],
         "attributes":[

         ],
         "events":[
            {
               "storedBy":"admin",
               "dueDate":"2018-11-06T00:00:00.000",
               "createdAtClient":"2018-11-06T16:41:52.422",
               "program":"ur1Edk5Oe2n",
               "event":"awBRcZTrYeh",
               "programStage":"ZkbAXlQUYJG",
               "orgUnit":"ImspTQPwCqd",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"WghdhVHnRpy",
               "enrollmentStatus":"ACTIVE",
               "status":"SCHEDULE",
               "orgUnitName":"Sierra Leone",
               "lastUpdatedAtClient":"2018-11-06T16:41:52.440",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-06T16:41:52.440",
               "created":"2018-11-06T16:41:52.422",
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            }
         ]
      },
      {
         "storedBy":"system",
         "created":"2018-11-05T10:26:56.720",
         "orgUnit":"DiszpKrYNg8",
         "createdAtClient":"2018-11-05T10:26:56.720",
         "program":"WSGAb5XwJ3Y",
         "trackedEntityInstance":"hhO3vubtIma",
         "enrollment":"XIPQpWx7LY4",
         "lastUpdated":"2018-11-05T10:27:59.325",
         "trackedEntityType":"nEenWmSyUEp",
         "lastUpdatedAtClient":"2018-11-05T10:27:59.325",
         "orgUnitName":"Ngelehun CHC",
         "enrollmentDate":"2018-11-05T00:00:00.000",
         "followup":false,
         "deleted":false,
         "incidentDate":"2018-11-05T00:00:00.000",
         "status":"ACTIVE",
         "notes":[

         ],
         "relationships":[

         ],
         "attributes":[

         ],
         "events":[
            {
               "storedBy":"system",
               "dueDate":"2018-11-05T00:00:00.000",
               "createdAtClient":"2018-11-05T10:26:57.271",
               "program":"WSGAb5XwJ3Y",
               "event":"t3PcuYySRHx",
               "programStage":"WZbXY0S00lP",
               "orgUnit":"DiszpKrYNg8",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"XIPQpWx7LY4",
               "enrollmentStatus":"ACTIVE",
               "status":"ACTIVE",
               "orgUnitName":"Ngelehun CHC",
               "lastUpdatedAtClient":"2018-11-05T10:26:57.294",
               "eventDate":"2018-11-05T00:00:00.000",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-05T10:26:57.294",
               "created":"2018-11-05T10:26:57.271",
               "followup":false,
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            },
            {
               "storedBy":"system",
               "dueDate":"2018-11-05T00:00:00.000",
               "createdAtClient":"2018-11-05T10:27:21.003",
               "program":"WSGAb5XwJ3Y",
               "event":"ZFLj4VyFdlr",
               "programStage":"PUZaKR0Jh2k",
               "orgUnit":"DiszpKrYNg8",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"XIPQpWx7LY4",
               "enrollmentStatus":"ACTIVE",
               "status":"SCHEDULE",
               "orgUnitName":"Ngelehun CHC",
               "lastUpdatedAtClient":"2018-11-05T10:27:21.020",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-05T10:27:21.020",
               "created":"2018-11-05T10:27:21.003",
               "followup":false,
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            },
            {
               "storedBy":"system",
               "dueDate":"2018-12-31T00:00:00.000",
               "createdAtClient":"2018-11-05T10:27:33.728",
               "program":"WSGAb5XwJ3Y",
               "event":"fC7Eyg0Rt2y",
               "programStage":"edqlbukwRfQ",
               "orgUnit":"DiszpKrYNg8",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"XIPQpWx7LY4",
               "enrollmentStatus":"ACTIVE",
               "status":"SCHEDULE",
               "orgUnitName":"Ngelehun CHC",
               "lastUpdatedAtClient":"2018-11-05T10:27:33.745",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-05T10:27:33.745",
               "created":"2018-11-05T10:27:33.728",
               "followup":false,
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            },
            {
               "storedBy":"system",
               "dueDate":"2019-08-12T00:00:00.000",
               "createdAtClient":"2018-11-05T10:27:59.305",
               "program":"WSGAb5XwJ3Y",
               "event":"yJsLjK6dxoq",
               "programStage":"PFDfvmGpsR3",
               "orgUnit":"DiszpKrYNg8",
               "trackedEntityInstance":"hhO3vubtIma",
               "enrollment":"XIPQpWx7LY4",
               "enrollmentStatus":"ACTIVE",
               "status":"SCHEDULE",
               "orgUnitName":"Ngelehun CHC",
               "lastUpdatedAtClient":"2018-11-05T10:27:59.324",
               "attributeCategoryOptions":"xYerKDKCefk",
               "lastUpdated":"2018-11-05T10:27:59.324",
               "created":"2018-11-05T10:27:59.305",
               "followup":false,
               "deleted":false,
               "attributeOptionCombo":"HllvX50cXC0",
               "dataValues":[

               ],
               "notes":[

               ],
               "relationships":[

               ]
            }
         ]
      }
   ],
   "relationships":[

   ],
   "attributes":[
      {
         "lastUpdated":"2018-11-05T10:26:56.552",
         "storedBy":"system",
         "code":"MMD_PER_NAM",
         "displayName":"First name",
         "created":"2018-11-05T10:26:56.552",
         "valueType":"TEXT",
         "attribute":"w75KJ2mc4zz",
         "value":"test1"
      },
      {
         "lastUpdated":"2018-11-06T16:40:59.157",
         "storedBy":"admin",
         "displayName":"TB identifier",
         "created":"2018-11-06T16:40:59.157",
         "valueType":"TEXT",
         "attribute":"xs8A6tQJY0s",
         "value":"4925406469"
      },
      {
         "lastUpdated":"2018-11-05T10:26:56.555",
         "storedBy":"system",
         "displayName":"Last name",
         "created":"2018-11-05T10:26:56.555",
         "valueType":"TEXT",
         "attribute":"zDhUuAYrxNC",
         "value":"test1"
      },
      {
         "lastUpdated":"2018-11-05T10:26:56.548",
         "storedBy":"system",
         "code":"MMD_PER_ID",
         "displayName":"Unique ID",
         "created":"2018-11-05T10:26:56.548",
         "valueType":"NUMBER",
         "attribute":"lZGmxYbs97q",
         "value":"6708704"
      },
      {
         "lastUpdated":"2018-11-06T16:40:59.129",
         "storedBy":"admin",
         "displayName":"Gender",
         "created":"2018-11-06T16:40:59.129",
         "valueType":"TEXT",
         "attribute":"cejWyOfXge6",
         "value":"Female"
      }
   ]
}



Thank you very much! Tomàs.

De: Dávid Katuščák [mailto:david@xxxxxxxxx]
Enviado el: 06 November 2018 16:08
Para: Tomas Sala
CC: dhis2-devs
Asunto: Re: [Dhis2-devs] trackedEntityInstances SYNC

Hi Tomas,

It looks like this can be a possible bug (the program allows only 1 ACTIVE enrollment, the system imports first the ACTIVE one and then it doesn't consider that the second is COMPLETE and not ACTIVE. But I need to confirm this).

Could you please provide a payload you are sending into the DHIS2? (If you test it on Demo DB (and the payload is for Demo DB) it will be a plus). You can send it directly to my email if you want.

Regarding mergeMode: I think, merging does not apply here and it applies only to data values.

On Tue, Nov 6, 2018 at 12:39 PM, Tomas Sala <tomas.sala@xxxxxxxxxxxxxxxxx<mailto:tomas.sala@xxxxxxxxxxxxxxxxx>> wrote:
Hi,

I am trying to import a trackedEntityInstance with two enrollments using the strategy SYNC, one is ACTIVE and the other one is COMPLETED. It only import the ACTIVE one and ignore the other one:

"responseType": "ImportSummary",
                            "status": "ERROR",
                            "description": "TrackedEntityInstance z8txd6oJzR6 already has an active enrollment in program ORvg6A5ed7z",
                            "importCount": {
                                "imported": 0,
                                "updated": 0,
                                "ignored": 1,
                                "deleted": 0


I’m making this POST  call  /trackedEntityInstances?strategy=SYNC&mergeMode=MERGE

Is it possible to avoid DHIS ignoring the COMPLETED enrolment and import both of them?

Thank you!

Tomàs Sala Camarena
Ehealth Technician, eHealth Team
eHealth & Operations Applications (´Apps4OPS´)
Projects & IT Unit
Médecins Sans Frontières (MSF) Spain – Barcelona Office
Fixed: +34 933 213 043
Email / Skype: tomas.sala@xxxxxxxxxxxxxxxxx<mailto:tomas.sala@xxxxxxxxxxxxxxxxx> - www.msf.org<http://www.msf.org/>














_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx<mailto:dhis2-devs@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp



--
Best regards / Mvh,
David Katuscak

Follow ups

References