422 error when POSTing FHIR Observation resource?

I’m trying to POST FHIR Observation resource but getting 422 error [No matching concept found for the given codings]. I’m unable to understand how a user of OpenMRS can send the concepts.

Below is the JSON I’m POSTing.

{"resourceType":"Observation",
      "code":{ 
     "coding":[
        {
                "system":"http://www.pih.org/",
                "code":"5085",
                "display":"68eb46e4-236d-31e3-9c73-a0b288a135f4"
            },
            {
                "system":"http://ampath.com/",
                "code":"5085",
                "display":"6d3ab6b7-a71a-3a93-b807-38bf374882ca"
            },
            {
                "system":"org.openmrs.module.mdrtb",
                "code":"SYSTOLIC BLOOD PRESSURE",
                "display":"afa83433-4bd8-3e42-ab18-1cae376f9f5f"
            },
            {
                "system":"http://loinc.org",
                "code":"8480-6",
                "display":"b9d125ad-fea8-3a13-bccc-d8241461005c"
            },
            {
                "system":"http://ciel.org",
                "code":"5085",
                "display":"274b867d-daa5-3531-8c20-c896f75d179d"
            },
            {
                "system":"http://snomed.info/sct",
                "code":"271649006",
                "display":"0de59c34-7991-3cbd-95d4-78b1e5ac814f"
            },
            {
                "system":"http://www.pih.org/country/malawi",
                "code":"5085",
                "display":"754223ab-8890-30a1-a024-afac52525fa3"
            },
            {
                "system":"http://loinc.org",
                "code":"53665-6",
                "display":"eb874cae-4066-3907-af72-ff5860cbca12"
            },
            {
                "system":"http://openmrs.org",
                "code":"5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display":"SYSTOLIC BLOOD PRESSURE"
            }
     ] }, 
   "valueQuantity":{ 
     "value":120.0, 
     "units":"mmHg", 
     "system":"http://unitsofmeasure.org", 
     "code":"mmHg" }, 
   "appliesDateTime":"2016-04-04T00:00:00+05:30",
   "issued":"2016-04-05T11:13:20.000+05:30", 
   "status":"final",
   "reliability":"ok", 
   "subject":{ "reference":"Patient/010", 
              "display":"Jinny Bond(Identifier:10)" }, 
   "referenceRange":
   [ 
     { "high":
      { "value":0.0, 
       "units":"mmHg",
       "system":"http://unitsofmeasure.org", 
       "code":"mmHg" }
     }
   ]
  }

Hi there,

In this case, concepts are metadata, so they cannot be created as part of a POST action. I’m afraid that you can only work with concepts that already exist in the system :frowning: Does it work ok with existing concepts?

Hi @surangak, Thanks for the reply. Yes it’s working for existing concepts with system value as openmrs, but the value of code it takes as the uuid of the concept. Actually, i’m more concerned with how to add snowmed, Loinc, etc standards code in the system? Do you have any sql script for that ? Thanks. :slight_smile:

Hmm… are you guys using the MVP concept dictionary? if so, that comes a a significant amount of SNOMED and LOINC mappings. In fact, all the mappings that you can currently see at demo.openmrs.org. Other than than, there’s no real way to inject in sql mappings, unless you want to do them at a 1-1 basis :frowning:

Hi Surangak, I wasn’t using the MVP concept dictionary, just had the default openmrs’ concepts. I’ve asked Andrew to provide me the access to it. Let me try it out and then update you on it. Thanks :slight_smile: