Reminder: Create & find trunk-related issues here. Legacy Trac tickets are still available. Problems? Workflow feedback? Need a module project? Open a support ticket.

OpenMRS Trunk

Changing a concept's datatype from Coded to something else does not remove its answers from the database

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Must Must
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: OpenMRS 1.6.0
  • Component/s: None
  • Severity:
    3
  • Keywords:
  • Description:
    Hide
    • Create a concept, give it datatype=Coded, and give it answers. Save it.
    • Edit that concept, change its datatype to N/A. Save it.
    • Edit that concept again, and choose Coded again from the datatype dropdown: the original answers are still there. You can see this in the database as well.

    In particular this is breaking concept synching for PIH, because there's now a cycle where a concept that's now N/A "contains" a question, which contains the first N/A concept. (The database thinks it contains it anyway.)

    I propose that if you change a concept's datatype from Coded to anything else, then the service and/or DAO should forcibly delete its answers.

    (Same should happen with sets that are re-saved as isSet=false, but I haven't checked whether there's a bug there or not.)

    Show
    • Create a concept, give it datatype=Coded, and give it answers. Save it.
    • Edit that concept, change its datatype to N/A. Save it.
    • Edit that concept again, and choose Coded again from the datatype dropdown: the original answers are still there. You can see this in the database as well.
    In particular this is breaking concept synching for PIH, because there's now a cycle where a concept that's now N/A "contains" a question, which contains the first N/A concept. (The database thinks it contains it anyway.) I propose that if you change a concept's datatype from Coded to anything else, then the service and/or DAO should forcibly delete its answers. (Same should happen with sets that are re-saved as isSet=false, but I haven't checked whether there's a bug there or not.)

Activity

Hide
Burke Mamlin added a comment - 2009-04-15 22:55:08 EDT

Sounds okay as long as an exception is thrown if the concept has been used – i.e., if there are are observations or published forms referring to the concept, then you should not be able to change the datatype.

Show
Burke Mamlin added a comment - 2009-04-15 22:55:08 EDT Sounds okay as long as an exception is thrown if the concept has been used – i.e., if there are are observations or published forms referring to the concept, then you should not be able to change the datatype.
Hide
Ben Wolfe added a comment - 2009-09-02 19:10:15 EDT

This does not happen to ConceptSets because there is an explicit call to clear the sets if isSet==false.

Fixed the concept datatypes persisting in rev:10183 in trunk.

Show
Ben Wolfe added a comment - 2009-09-02 19:10:15 EDT This does not happen to ConceptSets because there is an explicit call to clear the sets if isSet==false. Fixed the concept datatypes persisting in rev:10183 in trunk.

People

Dates

  • Created:
    2009-04-15 21:43:50 EDT
    Updated:
    2010-07-09 01:28:09 EDT
    Resolved:
    2010-07-01 22:43:42 EDT