← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Delete Validation Rules

 

Hi

I do NOT agree  that it should be possible to delete data elements that
have datavalue or tracker records - in such cases where there is real DATA,
the user must assess and delete such DATA first or else leave the data
element no longer in use (with its data) - we typically move such
historical data elements to an "inactive" data set.

On the other hand, I have found many meta-data objects where deletion is
being blocked due to (sometimes random) records in other meta-data tables -
meta-data that clearly won't be relevant any more (e.g. various tables
called "....dimensionitems" is a typical example). It is also a huge
problem that when e.g. data elements - even data elements with no actual
data - at some stage were included in some favourite, deletion is blocked
AND the error message says nothing about WHERE it is used. I always end up
spending considerable time tracking those down in the back end and deleting
them, before being able to delete the data element itself. Audit trails is
another example of "process" data that no longer is useful when e.g. a data
element is deleted.

Regards
Calle

On Mon, 20 Aug 2018 at 11:35, Em Le Hong <em.hispvietnam@xxxxxxxxx> wrote:

> Hi,
>
> I agree with Calle Hedberg that the system should automatically delete any
> dependent records related to validation rules.
> In DHIS2, this kind of issue is not only happen with Validation rules, but
> also with many other objects.
>
> For example to delete a data element, we need to delete its data value and
> audit trail. DHIS2 already provided API to delete data value and audit trail
> */api/26/maintenance/dataPruning/dataElement/<data-element-uid>*
>
> I hope DHIS2 will support to delete validation rules and other objects
> soon.
>
> On Wed, Aug 8, 2018 at 7:47 PM Calle Hedberg <calle.hedberg@xxxxxxxxx>
> wrote:
>
>> Hi
>>
>> Agree with Morten that it's a bug - it should be obvious that if you
>> delete a validation rule, any old validation rule results are no longer of
>> interest (with the rule deleted, you would not even know which rule any
>> remaining results were referring too).
>>
>> So the solution here is that when you delete a validation rule, the
>> system should automatically first delete any dependent records in the
>> following tables, which have validationruleid as a foreign key:
>>
>> "validationnotificationtemplatevalidationrules"
>> "validationresult"
>> "validationruleattributevalues"
>> "validationrulegroupmembers"
>> "validationruleorganisationunitlevels"
>> "validationrulesynchstatus"
>> "validationruletranslations"
>> "validationruleuseraccesses"
>> "validationruleusergroupaccesses"
>>
>> Regards
>> Calle
>>
>> On Wed, 8 Aug 2018 at 07:03, Morten Olav Hansen <morten@xxxxxxxxx> wrote:
>>
>>> Hi Em
>>>
>>> I'm not sure if there is any UI for deleting validation results, but you
>>> can do it yourself in the database.
>>>
>>> The validationresults are located in the table "validationresult", and
>>> it has a column called "validationruleid" which links to your validation
>>> rules.
>>>
>>> So you need to find that validation rule in the "validationrule" table,
>>> and use that "validationruleid" to delete the correct rows from the
>>> "validationresult" table.
>>>
>>> "DELETE FROM validationresult WHERE validationruleid=??"
>>>
>>> This does sound like a bug though, so please file one in JIRA
>>>
>>> --
>>> Morten Olav Hansen
>>> Senior Engineer, DHIS 2
>>> Team Integration Lead
>>> University of Oslo
>>> http://www.dhis2.org
>>>
>>> On Tue, Aug 7, 2018 at 5:07 PM, Em Le Hong <em.hispvietnam@xxxxxxxxx>
>>> wrote:
>>>
>>>> Dear all,
>>>>
>>>> DHIS 2.29
>>>>
>>>> I try to delete a validation rule on my database but the system
>>>> response a message:
>>>> Could not delete due to association with another object:
>>>> ValidationResult
>>>>
>>>> This mean we need to delete Validation Result before delete Validation
>>>> Rule
>>>>
>>>> Does anyone know how to delete Validation Result, if you don't mind
>>>> please share.
>>>>
>>>> Thanks,
>>>> --
>>>> *Em Le Hong*
>>>> DHIS2 Implementation| *HISP Vietnam *
>>>> em.hispvietnam@xxxxxxxxx | *Skype:* em.hispvietnam@xxxxxxxxx
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>> _______________________________________________
>>> 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
>>>
>>
>>
>> --
>>
>> *******************************************
>>
>> Calle Hedberg
>>
>> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>>
>> Tel/fax (home): +27-21-685-6472
>>
>> Cell: +27-82-853-5352
>>
>> Iridium SatPhone: +8816-315-19119
>>
>> Email: calle.hedberg@xxxxxxxxx
>>
>> Skype: calle_hedberg
>>
>> *******************************************
>>
>>
>
> --
> *Em Le Hong*
> DHIS2 Implementation| *HISP Vietnam *
> em.hispvietnam@xxxxxxxxx | *Skype:* em.hispvietnam@xxxxxxxxx
>
>
>
>
>
>

-- 

*******************************************

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@xxxxxxxxx

Skype: calle_hedberg

*******************************************

References