dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #49415
Re: Deletion of Program and all associated objects via API v 2.25
Hi Lorill,
Is the data element linked to a chart, pivot or map?
Regards,
Jason
On Mon, May 29, 2017 at 9:58 PM, Lorill Crees <lcrees@xxxxxxxxxx> wrote:
> Hi,
>
> Further to this, for some of our programs we are unable to delete
> programdataelements via the Web API due to the following error:
>
> ERROR: update or delete on table "programdataelement" violates foreign key
> constraint "fk_datadimensionitem_programdataelementid" on table
> "datadimensionitem" Detail: Key (programdataelementid)=(541878) is still
> referenced from table "datadimensionitem".
>
> What do I need to do to be able to delete these programdataelements? I
> have already deleted all the events and tracked entity instances prior to
> deleting programdataelements. I have even tried rerunning analytics prior
> to deleting.
>
> Please let me know. Thanks,
>
> Lorill
>
> On Fri, May 26, 2017 at 2:33 PM, Lorill Crees <lcrees@xxxxxxxxxx> wrote:
>
>> Hi,
>>
>> We have been working on functionality to delete full Programs and all
>> associated data and metadata via the Web API using:
>>
>> Version:
>> 2.25
>> Build revision:
>> ee7e61b
>> Build date:
>> 2017-05-19 12:47
>>
>> The instance being used is assuming that attributes and data elements are
>> specific to a particular program/program stage and will not be reused
>> across programs.
>>
>> I wanted to check to see if there are any other objects we need to worry
>> about for deletion that we may be missing.
>>
>> This is our methodology in order of execution, all via the Web API:
>>
>> 1. Delete Program and Program Stage Data
>> 1. delete all program stage events
>> 2. delete all tracked entity instances
>> 2. Delete Program and Program Stage Metadata
>> 1. delete all related program indicators
>> 2. delete all related program rules
>> 3. delete all related program rule variables (I'm not sure why
>> these aren't deleted automatically via the program rule deletion)
>> 4. delete programDataElements (is it correct that these are
>> generated by analytics?)
>> 5. delete all related indicators for programStage data elements
>> 6. delete underlying data elements
>> 7. delete related option sets and related options
>> 8. delete programTrackedEntityAttributes
>> 9. delete related trackedEntityAttributes
>> 10. delete related option sets and related options
>> 3. Delete Program and Program Stages
>> 1. delete program stages
>> 2. unassign program from all user roles (we note that the dataset
>> deletion API call takes care of this step but the program deletion API call
>> doesn't and throws an error if we miss this step)
>> 3. delete program
>>
>> I see some things in the program payload such as:
>>
>> - "notificationTemplates": [],
>> - "translations": [],
>> - "userGroupAccesses": [],
>> - "attributeValues": [],
>> - "validationCriterias": [],
>>
>> Do any of these need to be explicitly deleted in order to delete a
>> program or will they cascade? Are there any other associated objects I
>> haven't mentioned that we need to delete? So far we've been implementing on
>> a trial and error basis.
>>
>> Please let me know if there are any other considerations we should be
>> incorporating into our logic.
>>
>> Thanks,
>>
>> Lorill
>> --
>> Lorill Crees
>> Project Leader / Senior Developer
>> 2Paths Solutions Ltd. <http://www.2paths.com>
>>
>> lcrees@xxxxxxxxxx
>> skype: lorill2paths
>> (604) 689-4123 x 15 <(604)%20689-4123>
>>
>
>
>
> --
> Lorill Crees
> Project Leader / Senior Developer
> 2Paths Solutions Ltd. <http://www.2paths.com>
>
> lcrees@xxxxxxxxxx
> skype: lorill2paths
> (604) 689-4123 x 15
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
--
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049
Follow ups
References