Way to Delete a concept in use by other objects.

Hey team,

I have a concept its updated in OCL to datatype Coded however its not updating on fetching

So have tried to delete it manually and then re-fetch however am facing this challenge

Cannot delete concept. Database constraints will be violated because this concept is in use by other objects.



Basically is there a way to force delete without deleting the all concepts from the db with all attached contraints

cc @dkayiwa @mozzy @ibacher

@ball I imagine you have encountered this or similar situations before. How have you handled this?

@jonathan You have an obs (observation) with data for that concept. What was the previous datatype?

image

Try running this to find the obs in your database. If you don’t need it, you can delete that obs:

select * from obs where concept_id = 168826;

This doesn’t look like your concept is actually maintained via the Open Concept Lab module. If it was, you should see a header like this:

(Note that the text here is fixed and doesn’t take into account that the concept in question was actually just created from a zip and not actually downloaded from OCL). This means that there’s no mechanism that will automatically update that concept.

thanks @ball the previous datatype was Numeric and was changed to Coded and seems according to @ibacher comment it might be the issue why its not updating

Actually @ibacher we use both dumps and ocl …so it might be that i used a dump with this concept …

thanks @grace, @ball this actually has helped out deleting the obs associated with the concept helps to delete the concept

@jonathan Glad that you fixed the problem.

It’s ok to delete an obs when it’s a test database, but you wouldn’t want to do this on production. You would likely chooise/create a new concept with a datatype of coded instead of numeric :wink:

2 Likes