Error while creating patient with "Old Identification Number"

I am getting the following error in the http response while trying to create a patient using “Old Identification Number” as an identifier type. https://pastebin.com/pfU7xXZd

I have actually created a patient create component which is having option for all the identifier types. While selecting either OpenMRS ID or Openmrs Identification Number, it works fine. I tested the Openmrs id type by generating id’s through module id-gen and for Openmrs Identification Number, it throws a genuine error that the id generated is not for the validation scheme "Luhn CheckDigit Validator ". So, this makes sense. But in case of Old Identification Number, I am getting that I am missing a required identifier “OpenMRS ID”. If we go as per this reference, I haven’t missed any required field needed in order to create a patient (as both identifier types except this one are working fine).

So, Am I missing something or is it normal to get this error with an invalid identifier. I didn’t even found any patient record having old identification number to get some reference. So, its getting a bit tougher to find the reason for this error.

Note : I am using openmrs standalone platform v2.6.0

Ref : @pascal @dkayiwa

Patient is missing the following required identifier(s): OpenMRS ID

This is the error message. It means that you are trying to create a patient without a value for one or more of the required identifiers (in this case OpenMRS ID). Query the identifierType resource and note which identifiers have "required": true. There must be a value for all of those identifiers when creating a patient.

While selecting either OpenMRS ID or Openmrs Identification Number, it works fine.

You said that you got a validation error when trying Openmrs Identification Number. My suspicion is that if you try with a value that passes the Luhn check, you will get the same error as above if you try to create the patient without a value for OpenMRS ID (because this identifier is configured as required).

See also my comment here.

1 Like

But, required is false in case of both the identifiers except the “OpenMRS ID” identifier (if we query this : http://localhost:8081/openmrs-standalone/ws/rest/v1/patientidentifiertype?v=full)

That means that only OpenMRS ID is required. In other words, there must always be a value for the OpenMRS ID identifier when creating a patient.

So, when you try to create patient with only a value for Old Identification Number (and not for OpenMRS ID), then you will see the error you posted above.

Thanks @pascal

As the refapp only presents me the patient data with the “OpenMRS ID” identifier, so I was wondering, is there any way to search patients through their identifiertype ? or do you have any patient data having identifier type as “old identification number” ? so that I can get an idea of the structure i.e where to put the OpenMRS Id in the json structure while creating patient.

I went through this example, but here also openmrs id is used as the identifier type.

will it be like this ? :

"person": {
    "names": [{
      "givenName": "Julia",
      "familyName": "Harper",
    }],
    "gender": "F",
  },
  "identifiers": [{
    "OpenMRS ID": "05a29f94-c0ed-11e2-94be-8c13b969e334",       <= like this
    "identifierType": "", 
    "identifier": "",
    "location": "",
  }]

Something like the following should work.

{
  "person": {
    "names": [{
      "givenName": "Agnes",
      "familyName": "Wong"
    }],
    "gender": "F"
  },
  "identifiers": [{
    "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334", // OpenMRS ID
    "identifier": "GVUMLE", // valid Luhn mod 30 check digit
    "location": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f" // Default Location
  },
  {
    "identifierType": "8d793bee-c2cc-11de-8d13-0010c6dffd0f", // Old OpenMRS Identifier
    "identifier": "ABCDEF-2", // valid according to https://psb.re/luhn
    "location": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f" // Default Location
  }]
}

Thanks @pascal I will try this !