dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #49394
Deletion of Program and all associated objects via API v 2.25
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
Follow ups