Uploaded image for project: 'mUzima'
  1. mUzima
  2. MUZIMA-276

Resolving conflict between Rest web services and Muzima Registration modules

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Labels:
    • Story Points:
      3

      Description

      There's a conflict between Openmrs Rest web services module and mUzima Registration module. In absense of muzimaregistration module, encounter processing via Rest web services runs as expected, but with muzimaregistration, the processing fails because the related patient cannot be found.

      The issue arises because when an Encounter is posted via REST, the Rest web services delegates retrieval of related patient to a resource that's registered to retrieve a Patient (where muzima's org.openmrs.module.muzimaregistration.web.resource.RegistrationResource qualifies), if no such resource is registered, it delegates to a resource that can retrieve a Person (which is registered by Rest web services). However, the work of RegistrationResource within mUzima workflow is to retrieve patients' registration data from a custom table, and not from openmrs patient tables.

      So far RegistrationResource is the only class that registers a CRUD resource for retrieving patients, by extending DataDelegatingCrudResource<Patient>. A solution is to redesign the class so that it does not appear to Rest web services as the sole registered resource to retrieve patients.

      Here is a discussion over scrum proposing a solution:

      7:55 AM <nribeka> one way would be to create a mock object extending patient object
      7:55 AM <msavai> You'll get this error: http://pastebin.com/Q1qQ5QY4
      7:55 AM <nribeka> and then make the rest support this object instead of patient object.
      7:56 AM <msavai> ok win
      7:57 AM <msavai> I see
      7:57 AM <nribeka> msavai: follow this approach https://github.com/muzima/openmrs-module-muzima/blob/development/omod/src/main/java/org/openmrs/module/muzima/web/resource/openmrs/CohortMemberResource.java
      7:57 AM <nribeka> this happened before
      7:58 AM <nribeka> in this class, cohort member resource handle the wrapper object CohortMember
      7:58 AM <nribeka> the cohort member is just a wrapper for CohortMember1_8
      7:58 AM <nribeka> https://github.com/muzima/openmrs-module-muzima/blob/development/omod/src/main/java/org/openmrs/module/muzima/web/resource/wrapper/CohortMember.java
      7:59 AM <msavai> I see
      8:00 AM <ayeung> thanks, nribeka and msavai
      8:00 AM <nribeka> it's pretty odd how openmrs handle rest path
      8:00 AM <nribeka> it should be for each path, find the handler independent of the object.
      8:01 AM <nribeka> o well. please try that approach msavai
      8:01 AM <msavai> cool. Thanks.
      8:01 AM <msavai> So shall I create a ticket for this? Then we can include it in future scrum?
      8:01 AM <ayeung> msavai: yes, please do

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                nribeka Nyoman Ribeka
                Reporter:
                msavai Simon Savai (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: