# Missing fields in uploaded composition

**URL:** <https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925>\
**Category:** Platform\
**Tags:** rest-apis, archetype, template, ehrbase\
**Created:** [15 August 2022 11:21 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925 "2022-08-15T11:21:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mc1995](https://discourse.openehr.org/user_avatar/discourse.openehr.org/mc1995/32/1880_2.png) [@mc1995](https://discourse.openehr.org/u/mc1995)\
**Post date:** [15 August 2022 11:21 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925/1 "2022-08-15T11:21:01Z")

</div>

Hey guys,

I downloaded the `GECCO_Laborbefund` template ([Clinical Knowledge Manager](https://ckm.highmed.org/ckm/templates/1246.169.1229/export)) for testing purposes and pushed it on my EHRBase server. This seems to work, as I can retrieve an example of it via `/ehrbase/rest/ecis/v1/template/GECCO_Laborbefund/example?format=FLAT`, which looks like this:

```auto
{
  "laborbefund/category|terminology": "openehr",
  "laborbefund/category|value": "event",
  "laborbefund/category|code": "433",
  "laborbefund/context/status|code": "at0010",
  "laborbefund/context/status|terminology": "local",
  "laborbefund/context/status|value": "registriert",
  "laborbefund/context/kategorie:0": "Lorem ipsum",
  "laborbefund/context/start_time": "2022-02-03T04:05:06",
  "laborbefund/context/setting|code": "225",
  "laborbefund/context/setting|value": "home",
  "laborbefund/context/setting|terminology": "openehr",
  "laborbefund/context/_end_time": "2022-02-03T04:05:06",
  "laborbefund/context/_health_care_facility|name": "DOE, John",
  "laborbefund/laborergebnis:0/labortest-kategorie|code": "42",
  "laborbefund/laborergebnis:0/labortest-kategorie|terminology": "//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/labreport-labtest-category",
  "laborbefund/laborergebnis:0/labortest-kategorie|value": "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/labreport-labtest-category' available",
  "laborbefund/laborergebnis:0/probe:0/probenart|code": "42",
  "laborbefund/laborergebnis:0/probe:0/probenart|terminology": "//fhir.hl7.org//ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487",
  "laborbefund/laborergebnis:0/probe:0/probenart|value": "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available",
  "laborbefund/laborergebnis:0/probe:0/laborprobenidentifikator|id": "dev/null",
  "laborbefund/laborergebnis:0/probe:0/externer_identifikator|id": "dev/null",
  "laborbefund/laborergebnis:0/probe:0/zeitpunkt_des_probeneingangs": "2022-02-03T04:05:06",
  "laborbefund/laborergebnis:0/probe:0/probenentahmebedingung:0": "Lorem ipsum",
  "laborbefund/laborergebnis:0/probe:0/probenentnahmemethode": "Lorem ipsum",
  "laborbefund/laborergebnis:0/probe:0/körperstelle": "Lorem ipsum",
  "laborbefund/laborergebnis:0/probe:0/zeitpunkt_der_probenentnahme/date_time_value": "2022-02-03T04:05:06",
  "laborbefund/laborergebnis:0/probe:0/identifikator_des_probennehmers|id": "dev/null",
  "laborbefund/laborergebnis:0/probe:0/identifikator_der_übergeordneten_probe:0|id": "dev/null",
  "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|terminology": "local",
  "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|code": "at0062",
  "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|value": "Zufriedenstellend",
  "laborbefund/laborergebnis:0/probe:0/kommentar": "Lorem ipsum",
  "laborbefund/laborergebnis:0/probe:0/_uid": "71ef7e57-969e-3958-a30f-5541c4613b84",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|terminology": "//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/lab-tests-gecco",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|code": "42",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|value": "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/lab-tests-gecco' available",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/messwert/text_value": "Lorem ipsum",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|code": "42",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|value": "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation' available",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|terminology": "//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/testmethode/text_value": "Lorem ipsum",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/zeitpunkt_der_validierung": "2022-02-03T04:05:06",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|terminology": "local",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|code": "at0015",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|value": "Erfasst",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/zeitpunkt_ergebnis-status": "2022-02-03T04:05:06",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/probe_id/identifier_value|id": "dev/null",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/kommentar:0": "Lorem ipsum",
  "laborbefund/laborergebnis:0/pro_laboranalyt:0/_uid": "56adb4a6-4b59-3a5c-90ba-bae7a4ef78e3",
  "laborbefund/laborergebnis:0/schlussfolgerung": "Lorem ipsum",
  "laborbefund/laborergebnis:0/time": "2022-02-03T04:05:06",
  "laborbefund/laborergebnis:0/width": "PT42H",
  "laborbefund/laborergebnis:0/math_function|code": "145",
  "laborbefund/laborergebnis:0/math_function|value": "minimum",
  "laborbefund/laborergebnis:0/math_function|terminology": "openehr",
  "laborbefund/laborergebnis:0/details_der_testanforderung/identifikation_der_laboranforderung/identifier_value|id": "dev/null",
  "laborbefund/laborergebnis:0/details_der_testanforderung/_uid": "5cea753c-a209-3762-a059-0a17f29a297c",
  "laborbefund/laborergebnis:0/testmethode/text_value": "Lorem ipsum",
  "laborbefund/laborergebnis:0/language|terminology": "ISO_639-1",
  "laborbefund/laborergebnis:0/language|code": "de",
  "laborbefund/laborergebnis:0/encoding|code": "UTF-8",
  "laborbefund/laborergebnis:0/encoding|terminology": "IANA_character-sets",
  "laborbefund/laborergebnis:0/_uid": "3c6d6c1e-9532-3a6b-9e65-96b07a31e945",
  "laborbefund/laborergebnis:0/_work_flow_id|id": "28d43642-f3e4-3a63-a6d0-6fdda9d75465",
  "laborbefund/laborergebnis:0/_work_flow_id|id_scheme": "scheme",
  "laborbefund/laborergebnis:0/_work_flow_id|namespace": "unknown",
  "laborbefund/laborergebnis:0/_work_flow_id|type": "ANY",
  "laborbefund/laborergebnis:0/_guideline_id|id": "a8f48e4f-a3f4-39e6-a07e-1a7b4a099546",
  "laborbefund/laborergebnis:0/_guideline_id|id_scheme": "scheme",
  "laborbefund/laborergebnis:0/_guideline_id|namespace": "unknown",
  "laborbefund/laborergebnis:0/_guideline_id|type": "ANY",
  "laborbefund/language|code": "de",
  "laborbefund/language|terminology": "ISO_639-1",
  "laborbefund/territory|code": "DE",
  "laborbefund/territory|terminology": "ISO_3166-1",
  "laborbefund/composer|name": "Max Mustermann",
  "laborbefund/_uid": "60506a97-c96d-311d-8ac6-87882a186ac7"
}

```

So far so good. Now I want to use my data to upload a composition. In doing so, I did a quick sanity check by just uploading the the retrieved example template in FLAT format, which corresponds to a composition filled with default data (please correct me if I’m wrong). For this, I did a POST request to `/ehrbase/rest/ecis/v1/composition?format=FLAT&templateId=GECCO_Laborbefund&ehrId=a647b9a3-0cf9-48de-b4ea-2b66acc3e39b"`. I did reveice a 200 http code and a valid composition uid: `a6d5bb56-6f15-46d1-a1ab-7664682f8094::local.ehrbase.org::1`.

However, when I’m trying to retrieve this composition with `ehrbase/rest/ecis/v1/composition/a6d5bb56-6f15-46d1-a1ab-7664682f8094::local.ehrbase.org::1?format=FLAT`, I get the following output:

```auto
{
  "meta": {
    "href": {
      "url": "http://rbkehrbase.rbk.intra:8080/ehrbase/rest/ecis/v1/composition/89b197fc-c318-4e1c-96b7-fcf5929f9b15%3A%3Alocal.ehrbase.org%3A%3A1?format=FLAT/rest/ecis/v1/composition/89b197fc-c318-4e1c-96b7-fcf5929f9b15::local.ehrbase.org::1"
    }
  },
  "action": "RETRIEVE",
  "composition": {
    "laborbefund/category|terminology": "openehr",
    "laborbefund/category|value": "event",
    "laborbefund/category|code": "433",
    "laborbefund/context/status|code": "at0010",
    "laborbefund/context/status|terminology": "local",
    "laborbefund/context/status|value": "registriert",
    "laborbefund/context/kategorie:0": "Lorem ipsum",
    "laborbefund/context/start_time": "2022-02-03T04:05:06",
    "laborbefund/context/setting|code": "225",
    "laborbefund/context/setting|value": "home",
    "laborbefund/context/setting|terminology": "openehr",
    "laborbefund/context/_end_time": "2022-02-03T04:05:06",
    "laborbefund/context/_health_care_facility|name": "DOE, John",
    "laborbefund/laborergebnis:0/labortest-kategorie|code": "42",
    "laborbefund/laborergebnis:0/labortest-kategorie|terminology": "//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/labreport-labtest-category",
    "laborbefund/laborergebnis:0/labortest-kategorie|value": "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=https://www.netzwerk-universitaetsmedizin.de/fhir/ValueSet/labreport-labtest-category' available",
    "laborbefund/laborergebnis:0/probe:0/externer_identifikator|id": "dev/null",
    "laborbefund/laborergebnis:0/probe:0/_uid": "71ef7e57-969e-3958-a30f-5541c4613b84",
    "laborbefund/laborergebnis:0/pro_laboranalyt:0/testmethode/text_value": "Lorem ipsum",
    "laborbefund/laborergebnis:0/pro_laboranalyt:0/_uid": "56adb4a6-4b59-3a5c-90ba-bae7a4ef78e3",
    "laborbefund/laborergebnis:0/schlussfolgerung": "Lorem ipsum",
    "laborbefund/laborergebnis:0/time": "2022-02-03T04:05:06",
    "laborbefund/laborergebnis:0/width": "PT42H",
    "laborbefund/laborergebnis:0/math_function|code": "145",
    "laborbefund/laborergebnis:0/math_function|value": "minimum",
    "laborbefund/laborergebnis:0/math_function|terminology": "openehr",
    "laborbefund/laborergebnis:0/details_der_testanforderung/identifikation_der_laboranforderung/identifier_value|id": "dev/null",
    "laborbefund/laborergebnis:0/details_der_testanforderung/_uid": "5cea753c-a209-3762-a059-0a17f29a297c",
    "laborbefund/laborergebnis:0/testmethode/text_value": "Lorem ipsum",
    "laborbefund/laborergebnis:0/language|terminology": "ISO_639-1",
    "laborbefund/laborergebnis:0/language|code": "de",
    "laborbefund/laborergebnis:0/encoding|code": "UTF-8",
    "laborbefund/laborergebnis:0/encoding|terminology": "IANA_character-sets",
    "laborbefund/laborergebnis:0/_uid": "3c6d6c1e-9532-3a6b-9e65-96b07a31e945",
    "laborbefund/laborergebnis:0/_work_flow_id|id": "28d43642-f3e4-3a63-a6d0-6fdda9d75465",
    "laborbefund/laborergebnis:0/_work_flow_id|id_scheme": "scheme",
    "laborbefund/laborergebnis:0/_work_flow_id|namespace": "unknown",
    "laborbefund/laborergebnis:0/_work_flow_id|type": "ANY",
    "laborbefund/laborergebnis:0/_guideline_id|id": "a8f48e4f-a3f4-39e6-a07e-1a7b4a099546",
    "laborbefund/laborergebnis:0/_guideline_id|id_scheme": "scheme",
    "laborbefund/laborergebnis:0/_guideline_id|namespace": "unknown",
    "laborbefund/laborergebnis:0/_guideline_id|type": "ANY",
    "laborbefund/language|code": "de",
    "laborbefund/language|terminology": "ISO_639-1",
    "laborbefund/territory|code": "DE",
    "laborbefund/territory|terminology": "ISO_3166-1",
    "laborbefund/composer|name": "Max Mustermann",
    "laborbefund/_uid": "89b197fc-c318-4e1c-96b7-fcf5929f9b15::local.ehrbase.org::1"
  },
  "format": "FLAT",
  "templateId": "GECCO_Laborbefund",
  "ehrId": "a647b9a3-0cf9-48de-b4ea-2b66acc3e39b",
  "compositionUid": "89b197fc-c318-4e1c-96b7-fcf5929f9b15::local.ehrbase.org::1"
}

```

If we compare this to the example template, a lot of fields are missing. In particular, I cannot see any of the following fields:

```auto
 [1] "laborbefund/laborergebnis:0/probe:0/probenart|code"                              
 [2] "laborbefund/laborergebnis:0/probe:0/probenart|terminology"                       
 [3] "laborbefund/laborergebnis:0/probe:0/probenart|value"                             
 [4] "laborbefund/laborergebnis:0/probe:0/laborprobenidentifikator|id"                 
 [5] "laborbefund/laborergebnis:0/probe:0/zeitpunkt_des_probeneingangs"                
 [6] "laborbefund/laborergebnis:0/probe:0/probenentahmebedingung:0"                    
 [7] "laborbefund/laborergebnis:0/probe:0/probenentnahmemethode"                       
 [8] "laborbefund/laborergebnis:0/probe:0/körperstelle"                                
 [9] "laborbefund/laborergebnis:0/probe:0/zeitpunkt_der_probenentnahme/date_time_value"
[10] "laborbefund/laborergebnis:0/probe:0/identifikator_des_probennehmers|id"          
[11] "laborbefund/laborergebnis:0/probe:0/identifikator_der_übergeordneten_probe:0|id" 
[12] "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|terminology"              
[13] "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|code"                     
[14] "laborbefund/laborergebnis:0/probe:0/eignung_zum_testen|value"                    
[15] "laborbefund/laborergebnis:0/probe:0/kommentar"                                   
[16] "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|terminology"   
[17] "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|code"          
[18] "laborbefund/laborergebnis:0/pro_laboranalyt:0/untersuchter_analyt|value"         
[19] "laborbefund/laborergebnis:0/pro_laboranalyt:0/messwert/text_value"               
[20] "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|code"               
[21] "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|value"              
[22] "laborbefund/laborergebnis:0/pro_laboranalyt:0/interpretation|terminology"        
[23] "laborbefund/laborergebnis:0/pro_laboranalyt:0/zeitpunkt_der_validierung"         
[24] "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|terminology"       
[25] "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|code"              
[26] "laborbefund/laborergebnis:0/pro_laboranalyt:0/ergebnis-status|value"             
[27] "laborbefund/laborergebnis:0/pro_laboranalyt:0/zeitpunkt_ergebnis-status"         
[28] "laborbefund/laborergebnis:0/pro_laboranalyt:0/probe_id/identifier_value|id"      
[29] "laborbefund/laborergebnis:0/pro_laboranalyt:0/kommentar:0"

```

This behavior did not change when explictely setting one of fields such as `laborbefund/laborergebnis:0/pro_laboranalyt:0/messwert/text_value` with some real data before uploading the composition.  
Btw. ehrbase was installed three months ago with the `:next` tag  
Any idea what is going on here?

---

<div class="post-metadata">

**Author:** ![jgarciaroca](https://discourse.openehr.org/user_avatar/discourse.openehr.org/jgarciaroca/32/1663_2.png) [@jgarciaroca](https://discourse.openehr.org/u/jgarciaroca)\
**Post date:** [16 August 2022 06:55 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925/2 "2022-08-16T06:55:16Z")

</div>

Hi @mc1995,

The problem is already reported here: [EHRBase issues](https://github.com/ehrbase/ehrbase/issues/900). The initial title reported referred to just one data type but with the second comment added later it reports exactly the same problem that you are posting.

The workaround is to remove all “_some\_path\_here_/\_uid” fields as that seems to be the problematic one that makes all other not to be stored.

---

<div class="post-metadata">

**Author:** ![mc1995](https://discourse.openehr.org/user_avatar/discourse.openehr.org/mc1995/32/1880_2.png) [@mc1995](https://discourse.openehr.org/u/mc1995)\
**Post date:** [16 August 2022 07:57 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925/3 "2022-08-16T07:57:34Z")

</div>

@jgarciaroca thank you some much for pointing in the right direction.  
After removing all `_uid` fields from nested archetypes, all content is stored - Nice!

However, this raises two questions:  
a) why does the template validation allows to upload the modified composition (without the `_uid`)? I thought that composition must have all fields specified in the template.  
b) isn’t the `_uid` used to identify which archetypes are actually used within the composition? At least this is my understanding, therefore I hope that the bug is soon fixed.

Nevertheless, thanks again for helping!

---

<div class="post-metadata">

**Author:** ![stefanspiska](https://discourse.openehr.org/user_avatar/discourse.openehr.org/stefanspiska/32/819_2.png) [@stefanspiska](https://discourse.openehr.org/u/stefanspiska)\
**Post date:** [16 August 2022 14:04 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925/4 "2022-08-16T14:04:39Z")

</div>

@mc1995  
`_uid` comes from [Common Information Model](https://specifications.openehr.org/releases/RM/latest/common.html#_locatable_class).

It has nothing to to with templates but is simple a (optional) field which exist for all objects with inherent form locatable which are most.  
It is used to give a “Optional globally unique object identifier for root points of archetyped structures.” The example Endpoint fills it since it fills all fields with random data, but in practice its mostly just used on composition level. Which of course works with erhbase.

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [16 August 2022 15:13 UTC](https://discourse.openehr.org/t/missing-fields-in-uploaded-composition/2925/5 "2022-08-16T15:13:02Z")

</div>

> [@stefanspiska](#):
>
> but in practice its mostly just used on composition level

Probably worth considering putting UIDs routinely on the root points of Entries (i.e. Observation, Evaluation, AdminEntry etc, as well), since these contain the ‘hard data’ of the system.
