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

HibernateConceptDAO.getConcepts() will return Concepts that have voided names that match the passed name




      At one of our implementations, we have found that we are often seeing a warning in the logs that reads:

      Multiple concepts found for 'YES'

      . Doing a search on this message, it is being logged when the following method returns more than one Concept:

      HibernateConceptDAO.getConcepts("YES", Context.getLocale(), false, null, null);

      When I do a database query in the concept name table for this instance, I do in fact see that there are 3 concept names for "YES", attributed to 2 different concepts:

      • Concept 1065 has one matching Concept Name for "Yes". Neither the Concept nore the name are retired.
      • Concept 1894 has two matching Concept Names for "Yes", one spelled "Yes", another spelled "YES". Both of these are retired. However the Concept itself is not retired - it was changed such that it's concept name is "Yes, limited a lot".

      What seems to be happening is that the HibernateConceptDAO method is excluding retired Concepts from it's search, but is not excluding retired Concept Names from it's name search. Thus, multiple concepts are being returned for this method when you search for exact matches on "YES", but only one of these Concepts actually has a non-voided name equal to "YES".

      It would seem that we want to fix the above DAO method to also exclude retired Concept Names from the search.

      Gliffy Diagrams




              wyclif Wyclif Luyima
              mseaton Mike Seaton
              0 Vote for this issue
              5 Start watching this issue