ehrbase / ehrbase

An open source openEHR server
http://ehrbase.org
Apache License 2.0
259 stars 104 forks source link

Constraint reference is not supported #638

Open ppazos opened 3 years ago

ppazos commented 3 years ago

Configuration information

<status>
  <ehrbase_version>0.17.2</ehrbase_version>
  <openehr_sdk_version>30e3c81</openehr_sdk_version>
  <archie_version>1.0.3</archie_version>
  <jvm_version>Oracle Corporation 11.0.6+10</jvm_version>
  <os_version>Linux amd64 4.15.0-91-generic</os_version>
  <postgres_version>PostgreSQL 10.14 (Ubuntu 10.14-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit</postgres_version>
</status>

Steps to reproduce

This issue is the same fixed by https://github.com/ehrbase/ehrbase/issues/594 but with a different template.

I have merged develop into my branch and still getting this error: o.e.v.constraints.wrappers.CDvCodedText : Constraint reference is not supported, path: /content[openEHR-EHR-SECTION.adhoc.v1]/items[openEHR-EHR-OBSERVATION.demo.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0004]/items[at0011]

That happens with the POST /composition of the RIPPLE example: (upload the template first)

EHRbase.postman_collection.json.txt

Actual result

In the response I get an exception message.

Expected result (Acceptance Criteria)

ppazos commented 3 years ago

After discussing with Thomas, I think the solution for this one is to add template validation on POST /template for constraint codes without a definition.

REF: https://discourse.openehr.org/t/is-unbinded-constraint-code-valid-in-archetypes-templates/1976/5

For instance the RIPPLE template has a constraint code ac0001 on the DV_CODED_TEXT of at0011, and the missing definition of the ac0001 seems to be what makes this commit fail.

I'm also trying to find the source files of the RIPPLE conformance template to add the definition of the ac0001 to the right archetype then regenerate the OPT.

ppazos commented 3 years ago

While working in the conformance test cases found that the type of constraint when there is a CONSTRAINT_REF in ADL is mapped to a C_CODE_REFERENCE in the OPT.

I would like to confirm is this issue is due to EHRBASE not supporting C_CODE_REFERENCE or because of the missing constraint_bindings.

Please @chevalleyc @stefanspiska @birgerhaarbrandt do you have some insights on C_CODE_REFERENCE being supported by the OPT model we use internally? Thanks.

ppazos commented 3 years ago

I found where in the code this log is shown:

https://github.com/ehrbase/openEHR_SDK/blob/develop/validation/src/main/java/org/ehrbase/validation/constraints/wrappers/CDvCodedText.java#L89