Uploaded image for project: 'Logic Module'
  1. Logic Module
  2. LOGIC-27

Logic Service should use one consistent locale for rule authorship

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Needs Assessment
    • Priority: Should
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Complexity:
      Undetermined

      Description

      OpenMRS 1.4. The line:

      new LogicCriteria("TYPE OF PATIENT").equalTo(conceptService.getConcept(3389)).last(), "hospitalized");

      fails in French because getCriterion, in HibernateLogicObsDAO because the line:

      Concept concept = Context.getConceptService().getConcept(rootToken);

      defaults to the user's locale when looking up the concept.

      I assume that the HibernateDAOEncounter class will fail similarly, because of the use of the (deprecated)

      Concept concept = Context.getConceptService().getConceptByIdOrName(conceptName);

      If we're going to use concept names as tokens, we need to be able to explicitly pass in a locale.

      the stack trace is what you'd expect:

      org.openmrs.logic.LogicException: Concept: TYPE OF PATIENT does not exist
      [java] at org.openmrs.logic.db.hibernate.HibernateLogicObsDAO.getCriterion(HibernateLogicObsDAO.java:90)
      [java] at org.openmrs.logic.db.hibernate.HibernateLogicObsDAO.logicToHibernate(HibernateLogicObsDAO.java:303)
      [java] at org.openmrs.logic.db.hibernate.HibernateLogicObsDAO.getObservations(HibernateLogicObsDAO.java:352)
      [java] at org.openmrs.logic.datasource.ObsDataSource.read(ObsDataSource.java:60)
      [java] at org.openmrs.logic.LogicContext.read(LogicContext.java:243)
      [java] at org.openmrs.logic.rule.ReferenceRule.eval(ReferenceRule.java:78)
      [java] at org.openmrs.logic.LogicContext.eval(LogicContext.java:147)
      [java] at org.openmrs.logic.impl.LogicServiceImpl.eval(LogicServiceImpl.java:175)
      [java] at org.openmrs.logic.impl.LogicServiceImpl.eval(LogicServiceImpl.java:163)
      [java] at org.openmrs.logic.impl.LogicServiceImpl.eval(LogicServiceImpl.java:188)
      ...

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                Unassigned
                Reporter:
                dthomas Dave Thomas
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated: