Unable to create new drug reference maps during drug creation

Description

I have been working on adding support for DrugReferenceMaps to Initializer, to allow specifying Mappings when creating/updating new Drugs from CSV.

The paradigm here is that the row represents a Drug and associated properties, and saving the Drug should cascade down into the nested properties and save.

So, if a new Drug contains new, unsaved DrugReferenceMaps which in turn contain new, unsaved ConceptReferenceTerms, saving a Drug should cascade down and also correctly save the DrugReferenceMaps and ConceptReferenceTerms without throwing any errors.

Unfortunately this is not the case.

Investigating, and comparing to how ConceptMap is implemented, I find 2 key differences in the ConceptMap.hbm.xml and DrugReferenceMap.hbm.xml files, which both lead to errors in saving Drugs:

  1. ConceptMap has an unsaved-value="0" attribute on it's id property

  2. ConceptMap has a cascade="save-update" attribute on it's conceptReferenceTerm association

If I add both of these into the DrugReferenceMap.hbm.xml file, I am able to save a Drug with new, unsaved Maps and Terms.  If I do not, I get errors in saving.

  / /   - FYI - should be easy enough to fix in core (and backport to whatever branches are desired).

Activity

Show:

Nathan Ruhanga April 12, 2023 at 7:15 PM

Approving this ahead of 2.3.6 release.

Daniel Kayiwa March 2, 2023 at 2:23 PM

Back porting makes lots of sense. We could go as far back as you feel comfortable. I do not see any harm in this.

Mike Seaton March 2, 2023 at 2:06 PM

Thanks for the quick review and merge.  Thoughts on backporting?  This seems like a bug fix we'd be ok with backporting.  Not sure how far back to go?

Daniel Kayiwa March 2, 2023 at 8:42 AM
Edited

Fixed

Details

Assignee

Reporter

Complexity

Low

Priority

Created March 2, 2023 at 12:06 AM
Updated April 12, 2023 at 7:15 PM
Resolved April 12, 2023 at 7:15 PM