EHRBase 0.16.5 - Create EHR error while using Postman

I am testing the latest dev branch. I have been able to successfully build and run the server. The http://localhost:8080/ehrbase/rest/openehr/v1/ehr works fine from the integrated swagger UI.

However when i am testing this from postman, I get the following error

  >   {
    "error": "Message at /archetype_node_id (/other_details/archetype_node_id):  Attribute archetype_node_id of class ITEM_TREE does not match existence 1..1\nMessage at /name (/other_details/name):  Attribute name of class ITEM_TREE does not match existence 1..1\nMessage at /archetype_node_id (/archetype_node_id):  Attribute archetype_node_id of class EHR_STATUS does not match existence 1..1\nMessage at /name (/name):  Attribute name of class EHR_STATUS does not match existence 1..1\n",
    "status": "Bad Request"
}

Any idea what could be happening?

If I change the subject.id.type to PersonID (from the default GENERIC_ID) I get the following error

{
“error”: “Could not resolve type id ‘PersonID’ as a subtype of com.nedap.archie.base.OpenEHRBase: no such class found\n at [Source: (String)”{"_type":“EHR_STATUS”,“subject”:{“external_ref”:{“id”:{"_type":“PersonID”,“value”:“ins01”,“scheme”:“id_scheme”},“namespace”:“ehr_craft”,“type”:“PERSON”}},“other_details”:{"_type":“ITEM_TREE”,“items”:[]},“is_modifiable”:“true”,“is_queryable”:“true”}"; line: 1, column: 153] (through reference chain: com.nedap.archie.rm.ehr.EhrStatus[“subject”]->com.nedap.archie.rm.generic.PartySelf[“external_ref”]->com.nedap.archie.rm.support.identification.PartyRef[“id”])",
“status”: “Bad Request”
}

Are there specific values allowed for subject.id.type? (and the other input fields?)

regards

Hi Dileep,

Can you copy the body of the POST here ?

The RM type needs to be a PartySelf for EhrStatus.subject. I think you are supplying the wrong kind of id. See the relevant part of the RM here. Note, in the REST API the fields of these types are not always exactly as you see in the RM.

This is the POST body that I used. I took it from the Swagger

{
“_type”: “EHR_STATUS”,
“subject”: {
“external_ref”: {
“id”: {
“_type”: “GENERIC_ID”,
“value”: “ins01”,
“scheme”: “id_scheme”
},
“namespace”: “ehr_craft”,
“type”: “PERSON”
}
},
“other_details”: {
“_type”: “ITEM_TREE”,
“items”: []
},
“is_modifiable”: “true”,
“is_queryable”: “true”
}

I am able to create EHR successfully using this example from the openEHR REST APi specs.

{
  "_type": "EHR_STATUS",
  "archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1",
  "name": {
    "value": "EHR Status"
  },
  "subject": {
    "external_ref": {
      "id": {
        "_type": "GENERIC_ID",
        "value": "ins01",
        "scheme": "id_scheme"
      },
      "namespace": "examples",
      "type": "PERSON"
    }
  },
  "is_modifiable": true,
  "is_queryable": true
}

But if I change the subject.id.type to something other than GENERIC_ID it fails with the following error

BODY
{
  "_type": "EHR_STATUS",
  "archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1",
  "name": {
    "value": "EHR Status"
  },
  "subject": {
    "external_ref": {
      "id": {
        "_type": "PERSON ID",
        "value": "333",
        "scheme": "personUuid"
      },
      "namespace": "examples",
      "type": "PERSON"
    }
  },
  "is_modifiable": true,
  "is_queryable": true
}

Result

{
“error”: “Could not resolve type id ‘PERSON ID’ as a subtype of com.nedap.archie.base.OpenEHRBase: no such class found\n at [Source: (String)”{"_type":“EHR_STATUS”,“archetype_node_id”:“openEHR-EHR-EHR_STATUS.generic.v1”,“name”:{“value”:“EHR Status”},“subject”:{“external_ref”:{“id”:{"_type":“PERSON ID”,“value”:“333”,“scheme”:“personUuid”},“namespace”:“examples”,“type”:“PERSON”}},“is_modifiable”:true,“is_queryable”:true}"; line: 1, column: 238] (through reference chain: com.nedap.archie.rm.ehr.EhrStatus[“subject”]->com.nedap.archie.rm.generic.PartySelf[“external_ref”]->com.nedap.archie.rm.support.identification.PartyRef[“id”])",
“status”: “Bad Request”
}

So is there any constraint on subject.id.type?

``

regards

Hi Dileep,
This has to be a specific RM class inherited from OBJECT_Id

so GENERIC_ID works or

subject: {
external_ref: {
id: {
_type: “HIER_OBJECT_ID”,
value: ‘{{subjectId}}’,
},
namespace: ‘examples’,
type: “PERSON”
}
}

see Software Engineering Portal

1 Like