From f821a072d4afb56e47d53be176493512b6fcadaf Mon Sep 17 00:00:00 2001 From: "stefan.spiska" Date: Thu, 3 Feb 2022 08:51:36 +0100 Subject: [PATCH 1/3] fix db serialization of entry see CDR-219 & CDR-221 --- .../attributes/CareEntryAttributes.java | 8 +- .../attributes/EntryAttributes.java | 6 +- .../attributes/InstructionAttributes.java | 11 +- .../dbencoding/CompositionSerializer.java | 1 + .../db/DbConformanceTest.java | 125 ------------------ 5 files changed, 18 insertions(+), 133 deletions(-) diff --git a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/CareEntryAttributes.java b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/CareEntryAttributes.java index fffbe9945..4e39e62bb 100644 --- a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/CareEntryAttributes.java +++ b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/CareEntryAttributes.java @@ -20,10 +20,12 @@ import com.nedap.archie.rm.composition.CareEntry; import org.ehrbase.serialisation.dbencoding.CompositionSerializer; import org.ehrbase.serialisation.dbencoding.ItemStack; +import org.ehrbase.serialisation.dbencoding.RmObjectEncoding; import java.util.Map; import static org.ehrbase.serialisation.dbencoding.CompositionSerializer.TAG_GUIDELINE_ID; + /** populate the attributes for RM CareEntry */ public abstract class CareEntryAttributes extends EntryAttributes { @@ -34,8 +36,10 @@ public CareEntryAttributes( public Map toMap(CareEntry careEntry) { - if (careEntry.getGuidelineId() != null) - map = toMap(TAG_GUIDELINE_ID, careEntry.getGuidelineId(), careEntry.getName()); + if (careEntry.getGuidelineId() != null) { + + map.put(TAG_GUIDELINE_ID, new RmObjectEncoding(careEntry.getGuidelineId()).toMap()); + } map = super.toMap(careEntry); diff --git a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/EntryAttributes.java b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/EntryAttributes.java index 765bc580a..e7a6325cd 100644 --- a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/EntryAttributes.java +++ b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/EntryAttributes.java @@ -51,8 +51,10 @@ protected Map toMap(Entry entry){ map.put(TAG_ENCODING, new RmObjectEncoding(entry.getEncoding()).toMap()); } - if (entry.getWorkflowId() != null) - map = toMap(TAG_WORKFLOW_ID, entry.getWorkflowId(), entry.getName()); + if (entry.getWorkflowId() != null) { + + map.put(TAG_WORKFLOW_ID, new RmObjectEncoding(entry.getWorkflowId()).toMap()); + } if (entry.getOtherParticipations() != null && !entry.getOtherParticipations().isEmpty()){ map.put(TAG_OTHER_PARTICIPATIONS, new OtherParticipationAttributes(entry.getOtherParticipations(), compositionSerializer).toMap()); diff --git a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/InstructionAttributes.java b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/InstructionAttributes.java index 9ec12d5ec..4c9e17bc8 100644 --- a/serialisation/src/main/java/org/ehrbase/serialisation/attributes/InstructionAttributes.java +++ b/serialisation/src/main/java/org/ehrbase/serialisation/attributes/InstructionAttributes.java @@ -17,15 +17,15 @@ package org.ehrbase.serialisation.attributes; -import static org.ehrbase.serialisation.dbencoding.CompositionSerializer.TAG_EXPIRY_TIME; -import static org.ehrbase.serialisation.dbencoding.CompositionSerializer.TAG_NARRATIVE; - import com.nedap.archie.rm.composition.Instruction; -import java.util.Map; import org.ehrbase.serialisation.dbencoding.CompositionSerializer; import org.ehrbase.serialisation.dbencoding.ItemStack; import org.ehrbase.serialisation.dbencoding.RmObjectEncoding; +import java.util.Map; + +import static org.ehrbase.serialisation.dbencoding.CompositionSerializer.*; + /** * populate the attributes for RM Instruction (narrative) */ @@ -45,6 +45,9 @@ public Map toMap(Instruction instruction) { if (instruction.getExpiryTime() != null) { map.put(TAG_EXPIRY_TIME, new RmObjectEncoding(instruction.getExpiryTime()).toMap()); } + if (instruction.getWfDefinition() != null) { + map.put(TAG_WF_DEFINITION, new RmObjectEncoding(instruction.getWfDefinition()).toMap()); + } map = super.toMap(instruction); diff --git a/serialisation/src/main/java/org/ehrbase/serialisation/dbencoding/CompositionSerializer.java b/serialisation/src/main/java/org/ehrbase/serialisation/dbencoding/CompositionSerializer.java index 852d4d480..63588f124 100644 --- a/serialisation/src/main/java/org/ehrbase/serialisation/dbencoding/CompositionSerializer.java +++ b/serialisation/src/main/java/org/ehrbase/serialisation/dbencoding/CompositionSerializer.java @@ -96,6 +96,7 @@ public enum WalkerOutputMode { public static final String TAG_ISM_TRANSITION_REASON = "/careflow_step"; public static final String TAG_TRANSITION = "/transition"; public static final String TAG_WORKFLOW_ID = "/workflow_id"; + public static final String TAG_WF_DEFINITION = "/wf_definition"; public static final String TAG_GUIDELINE_ID = "/guideline_id"; public static final String TAG_OTHER_PARTICIPATIONS = "/other_participations"; public static final String TAG_PROVIDER = "/provider"; // care entry provider diff --git a/serialisation_conformance_test/src/test/java/org/ehrbase/conformance_test/db/DbConformanceTest.java b/serialisation_conformance_test/src/test/java/org/ehrbase/conformance_test/db/DbConformanceTest.java index 051b132c1..82fc1a1ef 100644 --- a/serialisation_conformance_test/src/test/java/org/ehrbase/conformance_test/db/DbConformanceTest.java +++ b/serialisation_conformance_test/src/test/java/org/ehrbase/conformance_test/db/DbConformanceTest.java @@ -98,131 +98,6 @@ private static List testRoundTripArguments(){ new String[] {})); break; - case EHRBASE_CONFORMANCE_OBSERVATION: - case EHRBASE_CONFORMANCE_FEEDER_AUDIT_MULTIMEDIA: - arguments.add( - Arguments.of( - test, - new String[] {}, - new String[] { - // see https://jira.vitagroup.ag/browse/CDR-219 - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_guideline_id|type, value: GUIDELINE", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_guideline_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_guideline_id|id, value: 3445", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_guideline_id|id_scheme, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_work_flow_id|type, value: WORKFLOW", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_work_flow_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_work_flow_id|id, value: 335645", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_observation/_work_flow_id|id_scheme, value: HOSPITAL-NS" - }, - new String[] { - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/workflow_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/workflow_id/type", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/workflow_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/guideline_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/guideline_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-OBSERVATION.conformance_observation.v0, 1]/guideline_id/type" - })); - break; - - case EHRBASE_CONFORMANCE_EVALUATION: - arguments.add( - Arguments.of( - test, - new String[] {}, - new String[] { - // see https://jira.vitagroup.ag/browse/CDR-219 - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_guideline_id|type, value: GUIDELINE", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_guideline_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_guideline_id|id, value: 3445", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_guideline_id|id_scheme, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_work_flow_id|type, value: WORKFLOW", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_work_flow_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_work_flow_id|id, value: 335645", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_evaluation/_work_flow_id|id_scheme, value: HOSPITAL-NS" - }, - new String[] { - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/workflow_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/workflow_id/type", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/workflow_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/guideline_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/guideline_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-EVALUATION.conformance_evaluation.v0, 1]/guideline_id/type" - })); - break; - case EHRBASE_CONFORMANCE_ACTION: - arguments.add( - Arguments.of( - test, - new String[] {}, - new String[] { - // see https://jira.vitagroup.ag/browse/CDR-219 - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_guideline_id|type, value: GUIDELINE", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_guideline_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_guideline_id|id, value: 3445", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_guideline_id|id_scheme, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|type, value: WORKFLOW", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|id, value: 335645", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_action/_work_flow_id|id_scheme, value: HOSPITAL-NS" - }, - new String[] { - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/workflow_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/workflow_id/type", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/workflow_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/guideline_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/guideline_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ACTION.conformance_action_.v0, 1]/guideline_id/type" - })); - break; - case EHRBASE_CONFORMANCE_INSTRUCTION: - arguments.add( - Arguments.of( - test, - new String[] {}, - new String[] { - // see https://jira.vitagroup.ag/browse/CDR-219 - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_guideline_id|type, value: GUIDELINE", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_guideline_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_guideline_id|id, value: 3445", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_guideline_id|id_scheme, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_work_flow_id|type, value: WORKFLOW", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_work_flow_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_work_flow_id|id, value: 335645", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_work_flow_id|id_scheme, value: HOSPITAL-NS", - // https://jira.vitagroup.ag/browse/CDR-221 - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_wf_definition|value, value: wf_definition", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_instruction/_wf_definition|formalism, value: formalism" - }, - new String[] { - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/workflow_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/workflow_id/type", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/workflow_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/guideline_id/namespace", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/guideline_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-INSTRUCTION.conformance_instruction.v0, 1]/guideline_id/type" - })); - break; - - case EHRBASE_CONFORMANCE_ADMIN_ENTRY: - arguments.add( - Arguments.of( - test, - new String[] {}, - new String[] { - // see https://jira.vitagroup.ag/browse/CDR-219 - - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|type, value: WORKFLOW", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|namespace, value: HOSPITAL-NS", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|id, value: 335645", - "Extra path: conformance-ehrbase.de.v0/conformance_section/conformance_admin_entry/_work_flow_id|id_scheme, value: HOSPITAL-NS" - }, - new String[] { - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ADMIN_ENTRY.conformance_admin_entry.v0, 1]/workflow_id/id", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ADMIN_ENTRY.conformance_admin_entry.v0, 1]/workflow_id/type", - "/content[openEHR-EHR-SECTION.conformance_section.v0, 1]/items[openEHR-EHR-ADMIN_ENTRY.conformance_admin_entry.v0, 1]/workflow_id/namespace" - })); - break; case EHRBASE_CONFORMANCE_DATA_TYPES_DV_EHR_URI: // see https://jira.vitagroup.ag/browse/CDR-214 From 23c0d6b8343bf64ebf9122c129602f55bfc2833b Mon Sep 17 00:00:00 2001 From: "stefan.spiska" Date: Thu, 3 Feb 2022 08:26:28 +0100 Subject: [PATCH 2/3] add conformace_test to sonar --- CHANGELOG.md | 2 +- serialisation_conformance_test/pom.xml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f2d1df1..626eaa449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ Note: version releases in the 0.x.y range may introduce breaking changes. - Fix issue in AQL regarding LIMIT and OFFSET (https://github.com/ehrbase/openEHR_SDK/pull/296) - Fix issue while unmarshalling FLAT composition that contains ELEMENT with children DV_CODED_TEXT and DV_TEXT (https://github.com/ehrbase/openEHR_SDK/pull/300) - Fix missing 'type' attribute in ExternalRef encoding (https://github.com/ehrbase/openEHR_SDK/pull/303) -- +- Fix db-serialising: date-time dv_order attributes (https://github.com/ehrbase/openEHR_SDK/pull/314) ## 1.16.0 ### Added diff --git a/serialisation_conformance_test/pom.xml b/serialisation_conformance_test/pom.xml index 98d3bffa4..ace592fc0 100644 --- a/serialisation_conformance_test/pom.xml +++ b/serialisation_conformance_test/pom.xml @@ -36,8 +36,8 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + ${surefireArgLine} com.github.better-care:web-template-tests AnySomeConstrainedTest @@ -91,6 +91,9 @@ WebTemplateContentTest.java WorkflowIdTestOverwrite XdsBuilderTest + DbConformanceTest + DbConformanceTest + FlatConformanceTest From 915ddc484eae26390b2f3f012fc9007e58921f85 Mon Sep 17 00:00:00 2001 From: "stefan.spiska" Date: Thu, 3 Feb 2022 09:46:40 +0100 Subject: [PATCH 3/3] edit CHANGELOG.md --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 626eaa449..c86463f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,12 @@ Note: version releases in the 0.x.y range may introduce breaking changes. - Upgrade to Archie 1.0.4 ([#292](https://github.com/ehrbase/openEHR_SDK/pull/292)) - 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) +- 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) +- db-serialising: fix handing of guideline_id & work_flow_id & + wf_definition (https://github.com/ehrbase/openEHR_SDK/pull/315) ### Fixed