Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4481

Mapping concept proposal to synonym can create duplicate concept names

    Details

    • Complexity:
      Low

      Description

      Problem

      When mapping a concept proposal to a synonym, OpenMRS may inappropriately generate duplicate concept names.

      Recreating the problem

      Use the concept proposal form to convert a proposed concept into a synonym when there are multiple proposals for that same text.

      Expected Behavior

      All proposals with the same text should be converted to synonyms and all should be referencing a single, new concept_name entry for that concept.

      Observed Behavior

      All proposals with the same text are converted to synonyms; however, each one generates a separate, duplicate entry within the concept_name table. For example, at AMPATH, we had a situation where a concept proposal ended up generating 143 duplicate (identical except for UUID) concept names from the 143 proposals for the same synonym.

      Technical Notes

      I believe the source of this bug is within line #968 of ConceptServiceImpl.java, where a new concept name is being created without checking to see if the name already exists for the concept. If you are resolving a single concept proposal, it should work fine; however, if you mapping multiple proposals to a concept as synonyms and calling this code within a loop (e.g., from ConceptProposalFormController.java), it will blindly (and incorrectly) add duplicate names to the concept as it loops through matching proposals.

      I believe the fix would be to make the ConceptService.mapConceptProposalToConcept() method so that it does not create a new concept name for the concept if there is already a name for the concept that is a case-insensitive match to the proposed name.

        Attachments

          Activity

            People

            • Assignee:
              pmuchowski PaweĊ‚ Muchowski
              Reporter:
              burke Burke Mamlin
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 30 minutes
                1d 30m