Skip to content

Commit

Permalink
Feature/add db serialisation conformance test (#311)
Browse files Browse the repository at this point in the history
* add test for feeder_audit with multimedia and locatable attributes

* add test for locatable attributes on element.

* fix action double serialization of workflow_id and guideline_id

see CDR-44

* add test for section

see CDR-44

* add DbConformanceTest

see CDR-44

* edit CHANGELOG.md

see CDR-44

* added test for null_reason

see CDR-44
  • Loading branch information
stefanspiska authored Feb 2, 2022
1 parent 762ecca commit 33fcf39
Show file tree
Hide file tree
Showing 16 changed files with 892 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note: version releases in the 0.x.y range may introduce breaking changes.
- cleanup created templates (https://github.com/ehrbase/openEHR_SDK/issues/298)
- WebTemplate based validation (see https://github.com/ehrbase/openEHR_SDK/pull/309)
- flat: created conformance tests (see https://github.com/ehrbase/openEHR_SDK/pull/310; https://github.com/ehrbase/openEHR_SDK/pull/305; https://github.com/ehrbase/openEHR_SDK/pull/304; https://github.com/ehrbase/openEHR_SDK/pull/301)
- db-serialising: created conformance test (see https://github.com/ehrbase/openEHR_SDK/pull/311)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ public ActionAttributes(CompositionSerializer compositionSerializer, ItemStack i

public Map<String, Object> toMap(Action action){

if (action.getWorkflowId() != null) {
map = toMap(TAG_WORKFLOW_ID, action.getWorkflowId(), action.getName());
}

if (action.getGuidelineId() != null) {
map = toMap(TAG_GUIDELINE_ID, action.getGuidelineId(), action.getName());
}

if (action.getTime() != null && !action.getTime().equals(new DvDateTime())) {
map = toMap(TAG_TIME, action.getTime(), action.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public void process(

handleRmAttribute(term, rmObject.getNullFlavour(), values, context, "null_flavour");
}

if (rmObject.getNullReason() != null) {

handleRmAttribute(term, rmObject.getNullReason(), values, context, "null_reason");
}

}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package org.ehrbase.serialisation.flatencoding.std.umarshal.postprocessor;

import com.nedap.archie.rm.datastructures.Element;
import com.nedap.archie.rm.datavalues.DvCodedText;
import com.nedap.archie.rm.datavalues.DvText;
import org.apache.commons.lang3.StringUtils;
import org.ehrbase.client.classgenerator.shareddefinition.NullFlavour;
import org.ehrbase.serialisation.walker.Context;
Expand All @@ -42,6 +44,18 @@ public void process(
Set<String> consumedPaths,
Context<Map<FlatPathDto, String>> context) {

Map<FlatPathDto, String> reasonValues = FlatHelper.filter(values, term + "/_null_reason", false);

if(!reasonValues.isEmpty()){

if( FlatHelper.isDvCodedText(reasonValues,term + "_null_reason")){
rmObject.setNullReason(new DvCodedText());
} else {
rmObject.setNullReason(new DvText());
}
handleRmAttribute(term,rmObject.getNullReason(),reasonValues,consumedPaths,context,"null_reason");
}

setValue(
term + PATH_DIVIDER + "_null_flavour",
"value",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ public enum CompositionTestDataConformanceSDTJson implements CompositionTestData
"ehrbase_conformance_admin_entry",
"ehrbase_conformance_admin_entry.json",
OperationalTemplateTestData.CONFORMANCE),
EHRBASE_CONFORMANCE_FEEDER_AUDIT_MULTIMEDIA(
"ehrbase_conformance_feeder_audit_multimedia",
"ehrbase_conformance_feeder_audit_multimedia.json",
OperationalTemplateTestData.CONFORMANCE),
EHRBASE_CONFORMANCE_SECTION(
"ehrbase_conformance_section",
"ehrbase_conformance_section.json",
OperationalTemplateTestData.CONFORMANCE),
EHRBASE_CONFORMANCE_ELEMENT_FEEDER_AUDIT(
"ehrbase_conformance_Element_feeder_audit",
"ehrbase_conformance_Element_feeder_audit.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"conformance-ehrbase.de.v0/context/setting|terminology": "openehr",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity|magnitude": 65.9,
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity|unit": "unit",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_uid":"9fcc1c70-9349-444d-b9cb-8fa817697f5e",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_link:0|type": "problem",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_link:0|meaning": "problem related note",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_link:0|target": "ehr://ehr.network/347a5490-55ee-4da9-b91a-9bba710f730e",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_feeder_audit/originating_system_audit|version_id": "final",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_feeder_audit/originating_system_audit|system_id": "orig",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_feeder_audit/originating_system_audit/location|id": "12342341",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_null_flavour|code": "253",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_null_flavour|value": "unknown",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_null_flavour|terminology": "openehr",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/dv_quantity/_null_reason": "sample reason",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/time": "2021-12-21T16:02:58.0094262+01:00",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/language|code": "en",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/language|terminology": "ISO_639-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,42 @@
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|namespace": "HOSPITAL-NS",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|id": "335645",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|id_scheme": "HOSPITAL-NS",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_uid":"9fcc1c70-9349-444d-b9cb-8fa817697f5e",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_link:0|type": "problem",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_link:0|meaning": "problem related note",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_link:0|target": "ehr://ehr.network/347a5490-55ee-4da9-b91a-9bba710f730e",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit|version_id": "final",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit|system_id": "orig",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/location|id": "12342341",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/location|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/location|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/location|name": "Org 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/subject|id": "456",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/subject|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/subject|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/subject|name": "Per 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/provider|id": "456",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/provider|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/provider|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit/provider|name": "Per 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_audit|time": "2021-12-21T16:02:58.0094262+01:00",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:0|id": "id1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:0|issuer": "issuer1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:0|assigner": "assigner1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:0|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:1|id": "id2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:1|issuer": "issuer2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:1|assigner": "assigner2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/originating_system_item_id:1|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/original_content": "Hello world!",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/original_content|formalism": "text/plain",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:0|id": "id1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:0|issuer": "issuer1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:0|assigner": "assigner1",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:0|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:1|id": "id2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:1|issuer": "issuer2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:1|assigner": "assigner2",
"conformance-ehrbase.de.v0/conformance_section/conformance_action/_feeder_audit/feeder_system_item_id:1|type": "PERSON",
"conformance-ehrbase.de.v0/composer|name": "Silvia Blake"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,42 @@
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|namespace": "HOSPITAL-NS",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|id": "335645",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|id_scheme": "HOSPITAL-NS",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_uid":"9fcc1c70-9349-444d-b9cb-8fa817697f5e",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_link:0|type": "problem",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_link:0|meaning": "problem related note",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_link:0|target": "ehr://ehr.network/347a5490-55ee-4da9-b91a-9bba710f730e",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit|version_id": "final",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit|system_id": "orig",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/location|id": "12342341",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/location|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/location|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/location|name": "Org 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/subject|id": "456",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/subject|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/subject|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/subject|name": "Per 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/provider|id": "456",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/provider|id_namespace": "uk.org.nmc",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/provider|id_scheme": "NMC",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit/provider|name": "Per 1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_audit|time": "2021-12-21T16:02:58.0094262+01:00",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:0|id": "id1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:0|issuer": "issuer1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:0|assigner": "assigner1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:0|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:1|id": "id2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:1|issuer": "issuer2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:1|assigner": "assigner2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/originating_system_item_id:1|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/original_content": "Hello world!",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/original_content|formalism": "text/plain",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:0|id": "id1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:0|issuer": "issuer1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:0|assigner": "assigner1",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:0|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:1|id": "id2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:1|issuer": "issuer2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:1|assigner": "assigner2",
"conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_feeder_audit/feeder_system_item_id:1|type": "PERSON",
"conformance-ehrbase.de.v0/composer|name": "Silvia Blake"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_feeder_audit/feeder_system_item_id:1|issuer": "issuer2",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_feeder_audit/feeder_system_item_id:1|assigner": "assigner2",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_feeder_audit/feeder_system_item_id:1|type": "PERSON",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_uid":"9fcc1c70-9349-444d-b9cb-8fa817697f5e",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_link:0|type": "problem",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_link:0|meaning": "problem related note",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/conformance_cluster/_link:0|target": "ehr://ehr.network/347a5490-55ee-4da9-b91a-9bba710f730e",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/any_event:0/time": "2021-12-21T16:02:58.0094262+01:00",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/language|code": "en",
"conformance-ehrbase.de.v0/conformance_section/conformance_observation/language|terminology": "ISO_639-1",
Expand Down
Loading

0 comments on commit 33fcf39

Please sign in to comment.