Correct format for /composer/external_ref in FLAT compositions

EHRBase 0.17.2 gives the following error if /composer/external_ref not given in FLAT compositions.
"error": "java.lang.IllegalArgumentException: Message at /namespace (/composer/external_ref/namespace): Attribute namespace of class PARTY_REF does not match existence 1..1\nMessage at /scheme (/composer/external_ref/id/scheme): Attribute scheme of class GENERIC_ID does not match existence 1..1\nMessage at /value (/composer/external_ref/id/value): Attribute value of class GENERIC_ID does not match existence 1..1\nMessage at /type (/composer/external_ref/type): Attribute type of class PARTY_REF does not match existence 1..1\n",

Tried different syntaxes, but could not get it to work, without success. Can anyone give the correct syntax?

"vital_signs/composer/external_ref/id|type": "GENERIC_ID",
"vital_signs/composer/external_ref/id|value": "123456",
"vital_signs/composer/external_ref/id|scheme": "userUuid",
"vital_signs/composer/external_ref/namespace": "EHR.NETWORK", 
"vital_signs/composer/external_ref/type": "ANY",


1 Like

Hi Dileep,

for the case this error cannot solved here by providing a matching syntax, please feel free to open a ticket in github.




I also felt this was a bug and already raised a ticket😁


Hi Dileep,

I have not tested this but the normal way of populating externalRef in Better structured (according to their docs) is

“composer”: [
“|id”: “77756”,
“|id_scheme”: “HOSPITAL-NS”,
“|id_namespace”: “HOSPITAL-NS”,
“|name”: “Silvia Blake”
or flattened equivalent

We currently supported the structured parts. Will try to have these as well sonly

1 Like

Thanks Ian,
In 16.5, we could commit FLAT with just the composer name. It was not accepting the external_ref values. In 17.2, it is rejecting the same composition and complains about the missing external_ref values. But it does not accept any format that I tried.

So I am kind of stuck and unable to progress further.


I’m a bit confused, because those log entries are corresponding to the new Archie invariant checks, which are now implemented into EHRbase. But this is (or at least should) not the case as of version 0.17.2.

If you are instead using the latest up-to-date docker image (called next) this feature would be already available indeed. In that case the readme tries to warn about this and the documentation has a config entry to disable the validation. For instance, in the form of an env var: SERVER_DISABLESTRICTVALIDATION=true.
Of course, caution is advised when using this option and further data input can’t be guaranteed to be correct. But this should help resolving this blocker for you, for now.

Thanks Jake,
I have pulled ehrbase:latest image(pulled the latest code and used the docker compose file in that). So Archie invariant checks are probably included. Does that introduce any format changes in the FLAT format for external_ref?

Instead of bypassing this check, I would rather try and get the format right. Would you, by any chance, know the correct format?


I just manually checked it and there appears to be a bug in the internal transformation of the FLAT, so the external ref of the composer is not really piped through. There wouldn’t be anything you can do about it on the input level.
Let’s continue to add details to the issue on Github and it hopefully it will be addressed soon :slight_smile:

for Better this works

 "annual_review/composer|name": "Dr Smith",
    "annual_review/composer|id": "12345",
    "annual_review/composer|id_scheme": "scheme",
    "annual_review/composer|id_namespace": "namespace"

and creates

   "composer": {
        "_type": "PARTY_IDENTIFIED",
        "external_ref": {
            "_type": "PARTY_REF",
            "id": {
                "_type": "GENERIC_ID",
                "value": "12345",
                "scheme": "scheme"
            "namespace": "namespace",
            "type": "ANY"
        "name": "Dr Smith"