Not able to create a Patient using FHIR /Patient

I locally setup backend of openmrs , And trying to create a patient using FHIR module /Patient with Payload :{ “resourceType” : “Patient”, “id” : “pat1”, “text” : { “status” : “generated”, “div” : “” }, “identifier” : [{ “use” : “usual”, “type” : { “coding” : [{ “system” : “identifierType - HL7 Terminology (THO) v6.1.0”, “code” : “MR” }] }, “system” : “http://openmrs.org/identifier”, “value” : “10000” }], “active” : true, “name” : [{ “use” : “official”, “family” : “Duck”, “given” : [“Donald”] }], “gender” : “male”, “contact” : [{ “relationship” : [{ “coding” : [{ “system” : “”, “code” : “E” }] }], “organization” : { “reference” : “Organization/1”, “display” : “Walt Disney Corporation” } }], “managingOrganization” : { “reference” : “Organization/1”, “display” : “ACME Healthcare, Inc” }, “link” : [{ “other” : { “reference” : “Patient/pat2” }, “type” : “seealso” }] } Repsonse :{ “resourceType”: “OperationOutcome”, “text”: { “status”: “generated”, “div”: “” }, “issue”: [ { “severity”: “error”, “code”: “processing”, “diagnostics”: “‘Patient#null’ failed to validate with reason: Select a preferred identifier” } ] }

Note that OpenMRS is not a generic FHIR store and does not actually support arbitrary FHIR data. But, in this particular case, at least one identifier must be marked as having it’s use field set to official. Presumably the one using the http://openmrs.org/identifier type-identifier.

Hi @ibacher , is it correct I took from this link :Patient - FHIR v5.0.0

payload : {
  "resourceType" : "Patient",
  "id" : "pat1",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"border: 1px #661aff solid; background-color: #e6e6ff; padding: 10px;\"><b>Donald Duck (OFFICIAL)</b> male, DoB Unknown ( Medical record number: 654321\u00a0(use:\u00a0USUAL))</p><hr/><table class=\"none\"><tr><td><table class=\"grid\"><tr><td style=\"background-color: #f3f5da\" title=\"Record is active\">Active:</td><td colspan=\"3\">true</td></tr><tr><td style=\"background-color: #f3f5da\" title=\"Nominated Contact: Employer\">Employer:</td><td colspan=\"3\"><ul><li>Organization: <a href=\"organization-example-gastro.html\">Organization/1: Walt Disney Corporation</a> &quot;Gastroenterology&quot;</li></ul></td></tr><tr><td style=\"background-color: #f3f5da\" title=\"Patient Links\">Links:</td><td colspan=\"3\"><ul><li>Managing Organization: <a href=\"organization-example-gastro.html\">Organization/1: ACME Healthcare, Inc</a> &quot;Gastroenterology&quot;</li><li>Also see: <a href=\"patient-example-b.html\">Patient/pat2</a> &quot;Duck DONALD&quot;</li></ul></td></tr></table></td><td><img src=\"13f2d978-cac6-493f-a3cf-16c32e3ad411.png\" alt=\"patient photo\"/></td></tr></table></div>"
  },
  "identifier" : [{
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/v2-0203",
        "code" : "MR"
      }]
    },
    "system" : "http://openmrs.org/identifier",
    "value" : "10000"
  }],
  "active" : true,
  "name" : [{
    "use" : "official",
    "family" : "Duck",
    "given" : ["Donald"]
  }],
  "gender" : "male",
  "contact" : [{
    "relationship" : [{
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/v2-0131",
        "code" : "E"
      }]
    }],
    "organization" : {
      "reference" : "Organization/1",
      "display" : "Walt Disney Corporation"
    }
  }],
  "managingOrganization" : {
    "reference" : "Organization/1",
    "display" : "ACME Healthcare, Inc"
  },
  "link" : [{
    "other" : {
      "reference" : "Patient/pat2"
    },
    "type" : "seealso"
  }]
}

And want to know that any other modules are required for creation patient using fhir2 modules, I cloned Rest, core and fhir2 modules and put .omod zip into core .openmrs folder, Is it correct way to setup openmrs backend locally, I want backend enpoints for my custom app that must follow fhir standard , And one more think that metadata also require for this patient creation?

We don’t currently support FHIR R5, just R4, though for patient, that shouldn’t be an issue. What modules are required to create a patient are much more a factor of how you configured you’re OpenMRS instance. By default, you shouldn’t need anything other than OpenMRS core, but depending on how your identifiers are setup.

Actually I want backend endpoints part of openmrs that must support fhir standard, So which modules i need to clone? I cloned core and rest and fhir2 and any others modules require for endpoints locally run.

No. You only need a version of core and the fhir2 module.

And what about Authentication and Authorization endpoints and RBAC in FHIR2 Module, And fhir2 module provide all end points as rest module endpoints Like /visit endoints in rest module.

And Is all resources is implemented in fhir2 as per fhir standard.

RBAC is built into OpenMRS core. The FHIR2 module does not cover all areas covered by the REST module because not all objects and operations are representable in FHIR, but where items in the core data model are representable in FHIR, the FHIR2 module provides some version of it. For example, Visits are covered, but they are exposed as FHIR Encounters, since the notion of Encounter in OpenMRS is narrower than that in FHIR.

All the resources implemented by the FHIR2 module are compliant with the FHIR standard, but that does not mean that they are able to produce or consume arbitrary FHIR resources. The resources must conform to the profiles in our implementation guide.