CaboLabs / openEHR-SDK

Java/Groovy Support of openEHR Operational Templates, Reference Model, Data Generators and other tools for www.CaboLabs.com projects
Apache License 2.0
11 stars 16 forks source link

[INGEN] check this validation error #124

Open ppazos opened 3 years ago

ppazos commented 3 years ago
POST /ehrbase/rest/openehr/v1/ehr/6e14bb00-5d33-4078-b3ea-6f38cbff60c7/composition HTTP/1.1
Host: localhost:8080
User-Agent: RESTinstance/1.1.0
Accept-Encoding: gzip, deflate
Accept: application/json
Connection: keep-alive
Content-Type: application/json
Prefer: return=representation
Authorization: Basic ZWhyYmFzZS11c2VyOlN1cGVyU2VjcmV0UGFzc3dvcmQ=
Content-Length: 2396

{"_type": "COMPOSITION", "name": {"_type": "DV_TEXT", "value": "Minimal"}, "archetype_details": {"archetype_id": {"value": "openEHR-EHR-COMPOSITION.minimal.v1"}, "template_id": {"value": "minimal_action_2"}, "rm_version": "1.0.2"}, "archetype_node_id": "openEHR-EHR-COMPOSITION.minimal.v1", "language": {"terminology_id": {"value": "ISO_639-1"}, "code_string": "en"}, "territory": {"terminology_id": {"value": "ISO_3166-1"}, "code_string": "UY"}, "category": {"value": "event", "defining_code": {"terminology_id": {"value": "openehr"}, "code_string": "433"}}, "composer": {"_type": "PARTY_IDENTIFIED", "external_ref": {"id": {"_type": "HIER_OBJECT_ID", "value": "2461ccd2-e50b-4d01-9cd6-3432924c7900"}, "namespace": "DEMOGRAPHIC", "type": "PERSON"}, "name": "Dr. Yamamoto"}, "context": {"start_time": {"value": "2021-10-12T20:29:59.258-03:00"}, "setting": {"value": "emergency care", "defining_code": {"terminology_id": {"value": "openehr"}, "code_string": "227"}}, "participations": [{"function": {"value": "legal guardian consent author"}, "performer": {"_type": "PARTY_RELATED", "name": "Alexandra Alamo", "relationship": {"value": "mother", "defining_code": {"terminology_id": {"value": "openehr"}, "code_string": "10"}}}, "mode": {"value": "not specified", "defining_code": {"terminology_id": {"value": "openehr"}, "code_string": "193"}}}]}, "content": [{"_type": "ACTION", "name": {"_type": "DV_TEXT", "value": "Minimal 2"}, "archetype_details": {"archetype_id": {"value": "openEHR-EHR-ACTION.minimal_2.v1"}, "template_id": {"value": "minimal_action_2"}, "rm_version": "1.0.2"}, "archetype_node_id": "openEHR-EHR-ACTION.minimal_2.v1", "language": {"terminology_id": {"value": "ISO_639-1"}, "code_string": "en"}, "encoding": {"terminology_id": {"value": "IANA_character-sets"}, "code_string": "UTF-8"}, "subject": {"_type": "PARTY_SELF"}, "time": {"_type": "DV_DATE_TIME", "value": "2021-10-12T20:29:59.329-03:00"}, "description": {"_type": "ITEM_TREE", "name": {"_type": "DV_TEXT", "value": "Tree"}, "archetype_node_id": "at0001", "items": [{"_type": "ELEMENT", "name": {"_type": "DV_TEXT", "value": "Proportion"}, "archetype_node_id": "at0002", "value": {"_type": "DV_PROPORTION", "numerator": 3, "denominator": 1.0, "type": 3, "precision": 1}}]}, "ism_transition": {"current_state": {"value": "planned", "defining_code": {"terminology_id": {"value": "openehr"}, "code_string": "526"}}}}]}HTTP/1.1 400 
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json
Transfer-Encoding: chunked
Date: Wed, 13 Oct 2021 03:38:46 GMT
Connection: close

{"error":"org.ehrbase.validation.constraints.wrappers.ValidationException: :-Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002]:Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], ELT02:Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], ELT01:Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], ELT01:Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], Validation error at /content[openEHR-EHR-ACTION.minimal_2.v1]/description[at0001]/items[at0002], BOOL01:TRUE value is not allowed.\n\n","status":"Bad Request"}
ppazos commented 3 years ago

The issue is related to https://github.com/ehrbase/ehrbase/issues/256

Because is_integral attribute is mandatory in the OPT but it is a function in the RM not an attribute, and the function depends on the precision attribute.

This was discussed in the SEC https://discourse.openehr.org/t/dv-proportion-is-integral-in-opts-and-validation-rules/899/14

ppazos commented 3 years ago

This is not an issue of the data generator but of modeling tools not handling the is_integral as a function. Though we might add a check for this in the meantime so the user can know about this issue.