Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-302

Creating observation groups feature does not work

    Details

    • Complexity:
      Low

      Description

      Observation groups are a way of grouping multiple observation under a single one. Webservices Obs resource supports observation groups using the tags "obsGroup" and "groupMembers". But this does not seem to work. Tried two ways of creating an observation group

      Method 1:
      Create the observations along with a parent observation. Here only the parent is pre-created

      echo '
      {
      "person":"5a3c5ee8-dadf-42af-9c63-44735069bf76",
      "obsDatetime":"2012-09-19T00:00:00.000+0530",
      "concept":"85692ca9-ee4b-4b89-8c5e-5abb8495c736",
      "location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
      "encounter":"e6432b42-4f07-4950-be01-a1ecbebdd949",
      "obsGroup":"bf9b3dfe-ec37-4e30-a449-813f93de467d",
      "groupMembers": [
      {
      "person":"5a3c5ee8-dadf-42af-9c63-44735069bf76",
      "obsDatetime":"2012-09-19T00:00:00.000+0530",
      "concept":"85692ca9-ee4b-4b89-8c5e-5abb8495c736",
      "location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
      "encounter":"e6432b42-4f07-4950-be01-a1ecbebdd949",
      "value":3
      },
      {
      "person":"5a3c5ee8-dadf-42af-9c63-44735069bf76",
      "obsDatetime":"2012-09-19T00:00:00.000+0530",
      "concept":"85692ca9-ee4b-4b89-8c5e-5abb8495c736",
      "location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
      "encounter":"e6432b42-4f07-4950-be01-a1ecbebdd949",
      "value":5
      }
      ]
      }
      ' | curl -i -H "Content-type: application/json" -X POST -d @- https://localhost:8443/openmrs1.9/ws/rest/v1/obs -k -b cookies.txt -3
      

      Method 2:
      All the observations are pre-created and an observation group is created.

      echo '
      {
      "person":"5a3c5ee8-dadf-42af-9c63-44735069bf76",
      "obsDatetime":"2012-09-19T00:00:00.000+0530",
      "concept":"85692ca9-ee4b-4b89-8c5e-5abb8495c736",
      "location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
      "encounter":"1dee2c17-5fd9-4fb7-be31-9a75d0b530d2",
      "obsGroup":"bf9b3dfe-ec37-4e30-a449-813f93de467d",
      "groupMembers": ["85e61f7e-d4b1-402b-a5ac-3ff8bb73cdbe","627f0a83-f6d4-4f65-9598-401406775674"]
      }
      ' | curl -i -H "Content-type: application/json" -X POST -d @- https://localhost:8443/openmrs1.9/ws/rest/v1/obs -k -b cookies.txt -3
      

      As Darius mentioned over email, the observation groups should be created like in Method 1. Also, in my view, none of the observations should be pre-created. In which case, the type of obsGroup be boolean indicating whether observation groups exist or not. Even better, there is no need for obsGroup field at all.

        Attachments

        1. add_obsgroup_error.txt
          8 kB
        2. add_obsgroup1_error.txt
          6 kB
        3. patch.txt
          4 kB

          Activity

            People

            • Assignee:
              dkayiwa Daniel Kayiwa
              Reporter:
              kavuri Sateesh Kavuri [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified