Can't create a deceased Patient via FHIR

It appears that there isn’t a way to create a deceased patient via FHIR api of OMRS.

See this simple notebook to reproduce the issue:

omrs-create-patient-fhir-issue | Kaggle

Also, there is another issue of identifier! The expected behavior is that one would not provide an id field while creating a new Patient & the server should create one & return it. But, that is not the case.

The same issue was talked about a couple of years ago as well: 500 Error Can't POST Patient into OpenMRS

The whole point of FHIR is interoperability. The FHIR layer of OMRS should support importing data from any other FHIR system in the same way. One can assume that a few field & extension transformations maybe required, but the OMRS case appears to be very different.

  "issue": [
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "'Patient#null' failed to validate with reason: causeOfDeath: Cause of Death or Cause of Death (non coded) is required for people marked as deceased., Select a preferred identifier"
    }
  ]
}

It would be great if experts here can point to a workaround for this (using FHIR APIs). Thanks

The identifier part was solved with better understanding of the identifier system in openmrs. However, the deceased issue is still there without any workaround.

There are different types of identifiers with which one can create a patient / person in the openmrs system. In order to create a new patient with UUID / numeric id one needs to setup a new identifier in the admin panel > Manager identifiers > add new.

The FHIR request needs to have this in the patient.identifier field:

  "identifier": [
    {
      "use": "official",
      "type": {      
        # The name of the identifier configured in OMRS.
        text: "Legacy ID",
        # Apparantly the coding field is optional.
        "coding": [{
           # UUID of the identifier configured in OMRS.
            "code": "22348099-3873-459e-a32e-d93b17eda533"
        }],
      },
      "value": "id-alpha-1"
    }
  ],

To use an autogenerator configured in OMRS, one needs to call the post api to get a new ID and then use it’s identifier.value in the request.

I think support for creating deceased patients isn’t implemented. We’re to take contributions though! Specifically, when marking a patient as deceased OpenMRS requires a cause of death, which is a coded value specifying the cause of death. We don’t currently have a mapping for that in the FHIR module, but it could be added.