How to delete an entity in tracker capture

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley

Hi Stanley,

It is only version 2.25 that has UI support for deleting Tracked Entity Instance. For the other versions, one has to do it manually using sql statements.

···

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

Hi Stanley,

If the data has been entered from the Android client, and is still not sent to the server, you can delete with long pressing on the tracked entity instance and then press ‘delete’. If the icon next to the tracked entity instance is a orange disk, this means it is still unsent. If it is marked with a green tick then it is sent to the server, and at the moment we cannot delete it. It is on the roadmap to implement this feature

Regards,

Erling

···

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Abyot,

Could you help with the sql statements?

Thanks in advance.

Stanley

···

On Thu, Nov 3, 2016 at 11:22 AM, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

Hi Stanley,

It is only version 2.25 that has UI support for deleting Tracked Entity Instance. For the other versions, one has to do it manually using sql statements.

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Erling,

It was on a desktop and the data is already in the database.

Should i just deactivate the entity?

Thanks

···

On Thu, Nov 3, 2016 at 11:23 AM, Erling Fjelstad erling@dhis2.org wrote:

Hi Stanley,

If the data has been entered from the Android client, and is still not sent to the server, you can delete with long pressing on the tracked entity instance and then press ‘delete’. If the icon next to the tracked entity instance is a orange disk, this means it is still unsent. If it is marked with a green tick then it is sent to the server, and at the moment we cannot delete it. It is on the roadmap to implement this feature

Regards,

Erling

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

I don’t have ready made statements at hand.

But here is what you need to do - FOR THE TRACKED ENTITY INSTANCE in question

  1. Delete event values from trackedentitydatavalue
  2. Delete events from programstageinstance
  3. Delete enrollments from programinstance
  4. Delete attribute values from trackedentityattributevalue
  5. Delete the instance from trackedentityinstance

More on the associations:

trackedentityinstance uid → trackedentityinstance id → programinstance id → programstageinstance id

···

On Thu, Nov 3, 2016 at 10:27 AM, Stanley Kalyati skalyati@gmail.com wrote:

Abyot,

Could you help with the sql statements?

Thanks in advance.

Stanley

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 11:22 AM, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

Hi Stanley,

It is only version 2.25 that has UI support for deleting Tracked Entity Instance. For the other versions, one has to do it manually using sql statements.

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

has sql statement to delete?

···

On Thu, Nov 3, 2016 at 4:57 PM, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

I don’t have ready made statements at hand.

But here is what you need to do - FOR THE TRACKED ENTITY INSTANCE in question

  1. Delete event values from trackedentitydatavalue
  2. Delete events from programstageinstance
  3. Delete enrollments from programinstance
  4. Delete attribute values from trackedentityattributevalue
  5. Delete the instance from trackedentityinstance

More on the associations:

trackedentityinstance uid → trackedentityinstance id → programinstance id → programstageinstance id


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:27 AM, Stanley Kalyati skalyati@gmail.com wrote:

Abyot,

Could you help with the sql statements?

Thanks in advance.

Stanley

On Thu, Nov 3, 2016 at 11:22 AM, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

Hi Stanley,

It is only version 2.25 that has UI support for deleting Tracked Entity Instance. For the other versions, one has to do it manually using sql statements.

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Hi Stanley,
To add on to what Abyot - if you are doing it via sql statements then the following tables might also have been populated:

trackedentityaudit

trackedentitydatavalueaudit

trackedentityattributevalueaudit

programstageinstance_messageconversation

programstageinstancecomments

and would need to be cleaned up otherwise you will hit foreign key constraints.

I would think it would be a lot easier to update the organisationunit id in the following tables:

Programstageinstance

Programinstance

Trackedentityinstance

and the sql statement would be something like:

update programstageinstance

set organisationunitid = nnnnnnnn (new orgunit’s internal id)

where organisationunitid = nnnnnnn (current orgunit’s internal id)

(this will move all the trackerdata from the current orgunit to the new orgunit)

and

exactly the same for programinstance and trackedentityinstance.

Afterwards you would have to clear cache and re-run analytics

Regards

Ant

This message and any attachments are subject to a disclaimer published at http://www.hisp.org/policies.html#comms_disclaimer. Please read the disclaimer before opening any attachment or taking any other action in terms of this electronic transmission. If you cannot access the disclaimer, kindly send an email to disclaimer@hisp.org and a copy will be provided to you. By replying to this e-mail or opening any attachment you agree to be bound by the provisions of the disclaimer.

···

On 3 November 2016 at 11:57, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

I don’t have ready made statements at hand.

But here is what you need to do - FOR THE TRACKED ENTITY INSTANCE in question

  1. Delete event values from trackedentitydatavalue
  2. Delete events from programstageinstance
  3. Delete enrollments from programinstance
  4. Delete attribute values from trackedentityattributevalue
  5. Delete the instance from trackedentityinstance

More on the associations:

trackedentityinstance uid → trackedentityinstance id → programinstance id → programstageinstance id


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:27 AM, Stanley Kalyati skalyati@gmail.com wrote:

Abyot,

Could you help with the sql statements?

Thanks in advance.

Stanley

On Thu, Nov 3, 2016 at 11:22 AM, Abyot Asalefew Gizaw abyot@dhis2.org wrote:

Hi Stanley,

It is only version 2.25 that has UI support for deleting Tracked Entity Instance. For the other versions, one has to do it manually using sql statements.

Abyot A. Gizaw.

Senior Engineer, DHIS2

University of Oslo

http://www.dhis2.org

On Thu, Nov 3, 2016 at 10:16 AM, Stanley Kalyati skalyati@gmail.com wrote:

Colleagues,

My colleague entered a tracked entity in a wrong OU and i want to delete that.Can someone tell me how to delete this entity? or move this entity to another OU.

You usual support is always appreciated.

Stanley


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Ant Snyman

Cell: 0824910449

Landline: 028 2713242

Health Information Systems Program - SA

1 Like

Do you mean 2.25 and above? And even in that case, where is the GUI button/icon that allows for deleting a tracked entity?

Hi, @bikashg

Here it is:

2 Likes

Thank you @jaime.bosque . It helped a lot. Also can you please say how to delete persons for whom only the enrollment was deleted. In such cases, It is not possible to get to the screenshot like you have posted above because such persons don’t appear in the Tracker Capture list.

If you search for that person, despite being deleted, it is not shown? I just did a test on the Play servers and I could get it…

1 Like

That was it. Thanks! Not immediately clear how to do it but now I know :slight_smile:

1 Like