Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2c471e60 authored by nab's avatar nab
Browse files

implement choice and add them to system testing

parent 40e05ee1
No related branches found
No related tags found
2 merge requests!30Develop,!28Feature/choices implementation
Pipeline #536470 failed
Showing
with 487 additions and 57 deletions
......@@ -12,7 +12,7 @@ public enum SpecificationType {
DATATYPE("datatype"),
FIXEDVAL("fixed value"),
CLOSED("closed"),
CHOICE("chocie");
CHOICE("choice");
private String value;
......
<?xml version="1.0"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdtc="urn:hl7-org:sdtc" xsi:schemaLocation="http://www.w3schools.com/RedsDevils ./xsd/CDA.xsd">
<!-- START HEADER: REQUIRED ELEMENTS FOR XSD VALIDATION -->
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<id root="1.2.3.4.5.1.7.5.10567878.0"/>
<code code="34133-9" codeSystem="2.16.840.1.113883.6.1" displayName="Summarization of Episode Note"/>
<effectiveTime value="20201201100749-0500"/>
<confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
<recordTarget>
<patientRole nullFlavor="UNK">
<id root="1.2.3.4.5.1.7" extension="19173"/>
</patientRole>
</recordTarget>
<author nullFlavor="UNK" >
<time value="20220101100749-0500"/>
<assignedAuthor>
<id root="2.2.2.2.2.2.2"/>
</assignedAuthor>
</author>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.2.2.2.2.2.2"/>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<componentOf>
<encompassingEncounter>
<effectiveTime value="20201201"/>
</encompassingEncounter>
</componentOf>
<!-- END OF HEADER -->
<!-- START OF TEST ELEMENTS -->
<component>
<structuredBody>
<component>
<section>
<templateId root="1.1.1.1.1.1.1.1"/>
<id root="1.2.3.5.6"/>
<code code="29545-1" codeSystem="2.11.111.1.111111.1.1" codeSystemName="LOINC"/>
<title>CDA For Test</title>
<entry>
<substanceAdministration classCode="SBADM" moodCode="EVN">
<realmCode/>
<!-- Test Choice CONF:0008 NEED TO BE True 2_3 -->
<!-- Test CONF:0005 "1_1" "IVL_TS" "value" ==> TRUE-->
<effectiveTime value="10122020" xsi:type="IVL_TS" ></effectiveTime>
<!-- Test CONF:0006 "0_1" not"PIVL_TS" operator="A" ==> FALSE-->
<effectiveTime operator="A" xsi:type="TS" ></effectiveTime>
<!-- Test CONF:0006 "1_1" TRUE-->
<effectiveTime xsi:type="EIVL_TS" >
<low value="10102020"/>
<high value="10122021"/>
</effectiveTime>
<!-- <consumable typeCode="AUT"/>-->
</substanceAdministration>
</entry>
</section>
</component>
</structuredBody>
</component>
<!-- END OF TEST ELEMENTS -->
</ClinicalDocument>
\ No newline at end of file
<decor>
<project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="card-" defaultLanguage="en-US">
<project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="choice-" defaultLanguage="en-US">
</project>
<rules>
......@@ -24,49 +24,44 @@
<element name="cda:entry" minimumMultiplicity="1" maximumMultiplicity="*" id="2.16.840.1.113883.3.1937.99.3.9.5341">
<element name="cda:substanceAdministration" minimumMultiplicity="1" maximumMultiplicity="*" id="2.16.840.1.113883.3.1937.99.3.9.5347">
<!-- Test element: NEED TO BE FALSE 1_1 -->
<element name="cda:realmCode" minimumMultiplicity="1" maximumMultiplicity="1">
<item label="CONF:0004"></item>
</element>
<!-- Test Choice: NEED TO BE True 2_3 -->
<choice minimumMultiplicity="2" maximumMultiplicity="3">
<!-- <choice minimumMultiplicity="1" maximumMultiplicity="1">-->
<!-- <element name="cda:effectiveTime">-->
<!-- </element>-->
<!-- </choice>-->
<choice minimumMultiplicity="6" maximumMultiplicity="*">
<element name="cda:effectiveTime" datatype="TS" minimumMultiplicity="1" maximumMultiplicity="2" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.5850">
<!-- Test element: NEED TO BE True 1_1 -->
<element name="cda:effectiveTime[(@value or @nullFlavor)]" datatype="IVL_TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.5850">
<attribute name="value" datatype="ts" isOptional="true" id="2.16.840.1.113883.3.1937.99.3.9.5851"></attribute>
<item label="CONF:0005"></item>
</element>
<element name="cda:effectiveTime[not(@operator='A')]" datatype="IVL_TS" minimumMultiplicity="5" maximumMultiplicity="7" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.222">
<element name="cda:low" datatype="TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" id="2.16.840.1.113883.3.1937.99.3.9.223">
</element>
<element name="cda:high" datatype="TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" id="2.16.840.1.113883.3.1937.99.3.9.224">
</element>
<!-- Test element: NEED TO BE FALSE (dataType not "PIVL_TS") -->
<element name="cda:effectiveTime[(@operator='A')]" datatype="PIVL_TS" minimumMultiplicity="0" maximumMultiplicity="1" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.222">
<item label="CONF:0006"></item>
</element>
<element name="cda:effectiveTime" datatype="IVL_TS" minimumMultiplicity="5" maximumMultiplicity="7" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.222">
<!-- Test element: NEED TO BE True 1_1 -->
<element name="cda:effectiveTime" datatype="EIVL_TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="C" id="2.16.840.1.113883.3.1937.99.3.9.222">
<element name="cda:low" datatype="TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" id="2.16.840.1.113883.3.1937.99.3.9.223">
</element>
<element name="cda:high" datatype="TS" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" id="2.16.840.1.113883.3.1937.99.3.9.224">
</element>
<item label="CONF:0007"></item>
</element>
<!-- Test element: NEED TO BE True 0_1 (typeCode not "CSM")-->
<element name="hl7:consumable[not(@typeCode='CSM')]" conformance="R" id="2.16.840.1.113883.3.1937.777.11.9.651" minimumMultiplicity="0" maximumMultiplicity="1">
</element>
<item label="CONF:0008"></item>
</choice>
<!-- <element name="cda:effectiveTime[@operator='A']" datatype="SXCM_TS" minimumMultiplicity="0" maximumMultiplicity="1" conformance="R" id="2.16.840.1.113883.3.1937.99.3.9.225">-->
<!-- <attribute name="operator" value="A" datatype="cs" id="2.16.840.1.113883.3.1937.99.3.9.226">-->
<!-- </attribute>-->
<!-- <assert role="error" test="count(preceding-sibling::cda:effectiveTime) = 1 and .[@operator='A'][@xsi:type='PIVL_TS' or @xsi:type='EIVL_TS']">SHOULD contain zero or one [0..1] effectiveTime (CONF:7513) such that it</assert>-->
<!-- </element>-->
<!-- -->
<attribute name="classCode"/>
<attribute name="moodCode" />
</element>
<item label="CONF:0007"></item>
</element>
</element>
</element>
</template>
</rules>
......
<detailedResult>
<DocumentValidXSD>
<XSDMessage>
<Severity>error</Severity>
<Message>cvc-elt.4.3: Type 'TS' is not validly derived from the type definition, 'SXCM_TS', of element 'effectiveTime'.</Message>
<columnNumber>72</columnNumber>
<lineNumber>53</lineNumber>
</XSDMessage>
<XSDMessage>
<Severity>error</Severity>
<Message>cvc-complex-type.3.2.2: Attribute 'operator' is not allowed to appear in element 'effectiveTime'.</Message>
<columnNumber>72</columnNumber>
<lineNumber>53</lineNumber>
</XSDMessage>
<XSDMessage>
<Severity>error</Severity>
<Message>cvc-complex-type.2.4.a: Invalid content was found starting with element 'low'. One of '{"urn:hl7-org:v3":event, "urn:hl7-org:v3":offset}' is expected.</Message>
<columnNumber>56</columnNumber>
<lineNumber>57</lineNumber>
</XSDMessage>
<XSDMessage>
<Severity>error</Severity>
<Message>cvc-complex-type.2.4.b: The content of element 'substanceAdministration' is not complete. One of '{"urn:hl7-org:v3":effectiveTime, "urn:hl7-org:v3":priorityCode, "urn:hl7-org:v3":repeatNumber, "urn:hl7-org:v3":routeCode, "urn:hl7-org:v3":approachSiteCode, "urn:hl7-org:v3":doseQuantity, "urn:hl7-org:v3":rateQuantity, "urn:hl7-org:v3":maxDoseQuantity, "urn:hl7-org:v3":administrationUnitCode, "urn:hl7-org:v3":subject, "urn:hl7-org:v3":specimen, "urn:hl7-org:v3":consumable}' is expected.</Message>
<columnNumber>51</columnNumber>
<lineNumber>62</lineNumber>
</XSDMessage>
<Result>FAILED</Result>
<nbOfErrors>4</nbOfErrors>
<nbOfWarnings>0</nbOfWarnings>
</DocumentValidXSD>
<DocumentWellFormed>
<Result>PASSED</Result>
</DocumentWellFormed>
<MDAValidation>
<Warning>
<Test>NullFlavorChecker</Test>
<Location>/ClinicalDocument/recordTarget/patientRole</Location>
<Description>In /ClinicalDocument/recordTarget/patientRole nullFlavor is defined but the element still defines attributes and sub-elements</Description>
<Identifiant>NullFlavorChecker</Identifiant>
<Type>Null Flavor Check</Type>
</Warning>
<Warning>
<Test>NullFlavorChecker</Test>
<Location>/ClinicalDocument/author</Location>
<Description>In /ClinicalDocument/author nullFlavor is defined but the element still defines attributes and sub-elements</Description>
<Identifiant>NullFlavorChecker</Identifiant>
<Type>Null Flavor Check</Type>
</Warning>
<Note>
<Test>test_IDs</Test>
<Location>/ClinicalDocument</Location>
<Description>Success: Found all IDs referenced</Description>
</Note>
<Note>
<Test>choice001</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:templateId[@root='1.1.1.1.1.1.1.1'], the attribute root SHALL be present</Description>
<Identifiant>choice-TestCardinality-choice001</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0001"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice002</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'], the element(s) hl7:templateId[@root='1.1.1.1.1.1.1.1'] SHALL not have nullFlavor (mandatory) (Item : CONF:0001)</Description>
<Identifiant>choice-TestCardinality-choice002</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0001"/>
<Type>Mandatory</Type>
</Note>
<Note>
<Test>choice003</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'] SHALL contain at most ONE hl7:templateId[@root='1.1.1.1.1.1.1.1'] (Item : CONF:0001)</Description>
<Identifiant>choice-TestCardinality-choice003</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0001"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice004</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'] SHALL contain at least ONE hl7:templateId[@root='1.1.1.1.1.1.1.1'] (Item : CONF:0001)</Description>
<Identifiant>choice-TestCardinality-choice004</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0001"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice005</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:code, the attribute code SHALL be present</Description>
<Identifiant>choice-TestCardinality-choice005</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0002"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice006</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:code, the attribute code SHALL have the value '29545-1' if present</Description>
<Identifiant>choice-TestCardinality-choice006</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0002"/>
<Type>Fixed value</Type>
</Note>
<Note>
<Test>choice007</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:code, the attribute codeSystem SHALL have the value '2.11.111.1.111111.1.1' if present</Description>
<Identifiant>choice-TestCardinality-choice007</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0002"/>
<Type>Fixed value</Type>
</Note>
<Note>
<Test>choice008</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'], the element(s) hl7:code SHALL not have nullFlavor (mandatory) (Item : CONF:0002)</Description>
<Identifiant>choice-TestCardinality-choice008</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0002"/>
<Type>Mandatory</Type>
</Note>
<Note>
<Test>choice009</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'] SHALL contain at least ONE hl7:code (Item : CONF:0002)</Description>
<Identifiant>choice-TestCardinality-choice009</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0002"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice010</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'] SHALL contain at least ONE hl7:title (Item : CONF:0003)</Description>
<Identifiant>choice-TestCardinality-choice010</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0003"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice011</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, the element defined by /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration/hl7:effectiveTime shall verify this requirement : (@value or @nullFlavor) (Item : CONF:0005)</Description>
<Identifiant>choice-TestCardinality-choice011</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0005;CONF:0008"/>
<Type>Context</Type>
</Note>
<Note>
<Test>choice012</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at most ONE hl7:effectiveTime (Item : CONF:0005)</Description>
<Identifiant>choice-TestCardinality-choice012</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0005;CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice013</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at least ONE hl7:effectiveTime (Item : CONF:0005)</Description>
<Identifiant>choice-TestCardinality-choice013</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0005;CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice014</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, the element defined by /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration/hl7:effectiveTime shall verify this requirement : (@operator='A') (Item : CONF:0006)</Description>
<Identifiant>choice-TestCardinality-choice014</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0006;CONF:0008"/>
<Type>Context</Type>
</Note>
<Note>
<Test>choice015</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at most ONE hl7:effectiveTime (Item : CONF:0006)</Description>
<Identifiant>choice-TestCardinality-choice015</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0006;CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice016</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at most ONE hl7:effectiveTime (Item : CONF:0007)</Description>
<Identifiant>choice-TestCardinality-choice016</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0007;CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Error>
<Test>choice017</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at least ONE hl7:effectiveTime (Item : CONF:0007)</Description>
<Identifiant>choice-TestCardinality-choice017</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0007;CONF:0008"/>
<Type>Cardinality</Type>
</Error>
<Note>
<Test>choice018</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, the element defined by /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration/hl7:consumable shall verify this requirement : not(@typeCode='CSM')</Description>
<Identifiant>choice-TestCardinality-choice018</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0008"/>
<Type>Context</Type>
</Note>
<Warning>
<Test>choice019</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHOULD contain at least ONE hl7:consumable</Description>
<Identifiant>choice-TestCardinality-choice019</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0008"/>
<Type>Cardinality</Type>
</Warning>
<Note>
<Test>choice020</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry, the number of elements of type 'effectiveTime', 'effectiveTime', 'effectiveTime', 'consumable' SHALL be lower or equal to 3 (Item : CONF:0008)</Description>
<Identifiant>choice-TestCardinality-choice020</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice021</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, in /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry, the number of elements of type 'effectiveTime', 'effectiveTime', 'effectiveTime', 'consumable' SHALL be bigger or equal to 2 (Item : CONF:0008)</Description>
<Identifiant>choice-TestCardinality-choice021</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0008"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice022</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at most ONE hl7:realmCode (Item : CONF:0004)</Description>
<Identifiant>choice-TestCardinality-choice022</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0004"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice023</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry/hl7:substanceAdministration SHALL contain at least ONE hl7:realmCode (Item : CONF:0004)</Description>
<Identifiant>choice-TestCardinality-choice023</Identifiant>
<assertion idScheme="choice" assertionId="CONF:0004"/>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice024</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1']/hl7:entry SHALL contain at least ONE hl7:substanceAdministration</Description>
<Identifiant>choice-TestCardinality-choice024</Identifiant>
<Type>Cardinality</Type>
</Note>
<Note>
<Test>choice025</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>In Test Cardinality Template, /hl7:section[hl7:templateId/@root='1.1.1.1.1.1.1.1'] SHALL contain at least ONE hl7:entry</Description>
<Identifiant>choice-TestCardinality-choice025</Identifiant>
<Type>Cardinality</Type>
</Note>
<Error>
<Test>structure</Test>
<Location>All the document</Location>
<Description>The tool is not able to find urn:hl7-org:v3:ClinicalDocument element as the root of the validated document.</Description>
</Error>
<Note>
<Test>test_IDs</Test>
<Location>/ClinicalDocument</Location>
<Description>Success: Found all IDs referenced</Description>
</Note>
<Warning>
<Test>rmim052</Test>
<Location>/ClinicalDocument/component/structuredBody/component[0]/section</Location>
<Description>Section.text SHALL be specified, as it is a required element (RMIM-052)</Description>
<Identifiant>cdabasic-SectionSpec-rmim052</Identifiant>
<assertion idScheme="RMIM" assertionId="RMIM-052"/>
<Type>Mandatory</Type>
</Warning>
<Error>
<Test>structure</Test>
<Location>All the document</Location>
<Description>The tool is not able to find urn:hl7-org:v3:ClinicalDocument element as the root of the validated document.</Description>
</Error>
<Note>
<Test>test_IDs</Test>
<Location>/ClinicalDocument</Location>
<Description>Success: Found all IDs referenced</Description>
</Note>
<Result>FAILED</Result>
</MDAValidation>
<ValidationResultsOverview>
<ValidationDate>2022, 06 13</ValidationDate>
<ValidationTime>05:11:10</ValidationTime>
<ValidationServiceName>Gazelle CDA Validation : choice</ValidationServiceName>
<ValidationTestResult>FAILED</ValidationTestResult>
</ValidationResultsOverview>
</detailedResult>
......@@ -24,4 +24,8 @@ datatype.expected=datatype/expected_datatype.xml
context.bbr=context/decor_context.xml
context.cda=context/cda_context.xml
context.expected=context/expected_context.xml
\ No newline at end of file
context.expected=context/expected_context.xml
choice.bbr=choice/decor_choice.xml
choice.cda=choice/cda_choice.xml
choice.expected=choice/expected_choice.xml
\ No newline at end of file
......@@ -92,6 +92,14 @@ public class SystemTests {
runTest();
}
@Ignore
@Test
public void choiceTest() throws ReportGenerationException, TestRunnerException, SpecificationException,
EnvironementException, ResultTransformationException {
this.specificationType = SpecificationType.CHOICE;
runTest();
}
private void runTest() throws ReportGenerationException, TestRunnerException,
......
......@@ -6,6 +6,7 @@ import gnu.trove.map.hash.THashMap;
import net.ihe.gazelle.goc.common.utils.XPATHOCLGroup;
import net.ihe.gazelle.goc.common.utils.XPATHOCLRule;
import net.ihe.gazelle.goc.common.utils.XSITypeOCL;
import net.ihe.gazelle.tempmodel.decor.dt.utils.DTUtils;
import org.apache.commons.lang.StringUtils;
import net.ihe.gazelle.goc.uml.utils.OwnedRuleUtil;
......@@ -50,6 +51,11 @@ public class AssertAnalyzer extends AssertProcessorImpl {
protected List<OwnedRule> listGeneratedOwnedRule;
protected Boolean generateDTDistinguisher = Boolean.FALSE;
@SuppressWarnings("unchecked")
@Override
public void process(Assert t, Object... objects) {
......@@ -59,7 +65,11 @@ public class AssertAnalyzer extends AssertProcessorImpl {
if (objects.length>1) {
this.listGeneratedOwnedRule = (List<OwnedRule>) objects[1];
}
if (!GenerationProperties.ignoreAssertionGeneration && verifyThatAssertIsProcessable(this.currentAssert)){
if(objects.length>2){
this.generateDTDistinguisher = (Boolean) objects[2];
}
if (!GenerationProperties.ignoreAssertionGeneration && verifyThatAssertIsProcessable(this.currentAssert)){;
super.process(t, objects);
}
}
......@@ -288,6 +298,13 @@ public class AssertAnalyzer extends AssertProcessorImpl {
ImportElementHandler.handleAddingElement("CommonOperationsStatic");
}
}
if(this.generateDTDistinguisher && currentAssert.getParentObject() instanceof RuleDefinition){
RuleDefinition parentRD = (RuleDefinition) currentAssert.getParentObject();
OCLGenerator generator = new OCLGenerator();
res = generator.appendDTDistinguisher(parentRD, res);
}
return res;
}
......@@ -422,9 +439,16 @@ public class AssertAnalyzer extends AssertProcessorImpl {
XSITypeOCL xsiTypeOCL = (XSITypeOCL)xpathoclRule;
String not = xsiTypeOCL.isNegativeOperation()?"not(":"";
String closingNot = not.equals("not(")?")":"";
String formattedType = xsiTypeOCL.getType().replace("_","");
subRule = prefix+"->forAll("+not+"oclIsKindOf("+formattedType+")"
String dt = DTUtils.getUMLDatatype(xsiTypeOCL.getType());
if(dt==null){
return null;
}
//String formattedType = xsiTypeOCL.getType().replace("_","");
subRule = prefix+"->forAll("+not+"oclIsKindOf("+dt+")"
+closingNot+")"+stringOperation;
ImportElementHandler.handleAddingElement(dt);
}
else{
subRule = prefix+"->forAll(aa | CommonOperationsStatic::validateByXPATHV2(aa, '"
......
package net.ihe.gazelle.tempgen.action;
import net.ihe.gazelle.goc.template.definer.model.Taml;
import net.ihe.gazelle.goc.uml.utils.XMIUtil;
import net.ihe.gazelle.goc.xmi.XMI;
import net.ihe.gazelle.goc.xmi.XMIMarshaller;
......@@ -21,6 +22,8 @@ import javax.xml.bind.JAXBException;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -83,12 +86,6 @@ public class HL7TemplatesConverter {
log.warn("Converting Decor to XMI");
//
if(ignoreChoicesPredicates){
log.info("///////////////////////////////////// Ignored all Predicates Choices ///////////////////////////////////////// ");
}
else{
log.info("///////////////////////////////////// The choices predicates was processing ///////////////////////////////");
}
XMI xmi = convertFlattenedDecorToXMI(decor, ignoreTemplateIdRequirements,ignoreChoicesPredicates);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMIMarshaller.printXMI(xmi, baos);
......@@ -143,29 +140,42 @@ public class HL7TemplatesConverter {
//The entrypoint to convert the decor to OCL!
(new DecorAnalyzer()).process(decor, xmi, Boolean.valueOf(ignoreTemplateIdRequirements),ignoreChoicesPredicates);
//Skip incorrect OCL
//cleanTAML(xmi);
clearXMI(xmi);
return xmi;
}
private void clearXMI(XMI xmi){
for(PackagedElement packagedElement:xmi.getModel().getPackagedElement()){
for(int ownedRule=0;ownedRule<packagedElement.getOwnedRule().size();ownedRule++) {
if(cleanOCL(packagedElement.getOwnedRule().get(ownedRule))==null) {
packagedElement.getOwnedRule().remove(packagedElement.getOwnedRule().get(ownedRule));
TamlHandler.removeTAML(packagedElement.getOwnedRule().get(ownedRule));
ArrayList<String> removedOrIds = new ArrayList<>();
for(Iterator<PackagedElement> itpe = xmi.getModel().getPackagedElement().listIterator(); itpe.hasNext();){
PackagedElement currentPe = itpe.next();
for(Iterator<OwnedRule> itor = currentPe.getOwnedRule().listIterator(); itor.hasNext();){
OwnedRule currentOr = itor.next();
if(!isOclClean(currentOr)){
log.info("Removing wrong OCL: {}",currentOr.getId());
//TamlHandler.removeTAML(currentOr);
removedOrIds.add(currentOr.getId());
itor.remove();
}
}
}
for(Iterator<Taml> ittaml = xmi.getTaml().listIterator(); ittaml.hasNext();){
Taml currentTaml = ittaml.next();
if(removedOrIds.contains(currentTaml.getBaseConstraint())){
ittaml.remove();
}
}
}
private OwnedRule cleanOCL(OwnedRule ownedRule){
private boolean isOclClean(OwnedRule ownedRule){
String mat= ownedRule.getSpecification().getBody();
String matr= "\\)[A-Za-z]+";
Pattern pattern = Pattern.compile(matr);
Matcher matcher = pattern.matcher(ownedRule.getSpecification().getBody());
if(!matcher.find()){
return ownedRule;
return true;
}
return null;
return false;
}
}
......@@ -13,6 +13,7 @@ import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
import net.ihe.gazelle.tempmodel.org.decor.art.model.TemplateDefinition;
import net.ihe.gazelle.tempmodel.org.decor.art.utils.*;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.ecore.EDataType;
import java.util.ArrayList;
import java.util.List;
......@@ -443,10 +444,14 @@ public class OCLGenerator {
}
String rdName = RuleDefinitionUtil.getRealNameOfRuleDefinition(ruleDefinition);
StringBuilder selectionRule = new StringBuilder(rdName);
if(ruleDefinition.getDatatype() == null){
return constraint;
}
String datatype = ruleDefinition.getDatatype().getLocalPart();
if(datatype == null){
return constraint;
}
ImportElementHandler.handleAddingElement(datatype);
String datatypeForOCL = datatype.replace("_","");
selectionRule.append("->select(aa | CommonOperationsStatic::compareExactType(aa, '")
.append(datatypeForOCL)
......
......@@ -15,6 +15,7 @@ import net.ihe.gazelle.tempmodel.dpath.utils.DPathExtractor;
import net.ihe.gazelle.tempmodel.org.decor.art.behavior.HasItem;
import net.ihe.gazelle.tempmodel.org.decor.art.model.*;
import net.ihe.gazelle.tempmodel.org.decor.art.utils.*;
import org.eclipse.uml2.uml.DataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -271,7 +272,7 @@ public class RuleDefinitionAnalyzer extends RuleDefinitionProcessorImpl {
public void process_asserts(List<Assert> decorAsserts) {
if (decorAsserts != null) {
for (Assert assert1 : decorAsserts) {
(new AssertAnalyzer()).process(assert1, this.currentPackagedElement, this.listGeneratedOwnedRule);
(new AssertAnalyzer()).process(assert1, this.currentPackagedElement, this.listGeneratedOwnedRule,this.generateDTDistinguisher);
}
}
}
......@@ -501,6 +502,10 @@ public class RuleDefinitionAnalyzer extends RuleDefinitionProcessorImpl {
if (datatype == null) {
return;
}
if(Boolean.TRUE.equals(this.generateDTDistinguisher)){
ImportElementHandler.handleAddingElement(DTUtils.getUMLDatatype(datatype.getLocalPart()));
return;
}
String dt = datatype.getLocalPart();
String typeRD = RuleDefinitionUtil.getUMLTypeName(selectedRuleDefinition);
if (dt != null) {
......@@ -536,6 +541,9 @@ public class RuleDefinitionAnalyzer extends RuleDefinitionProcessorImpl {
if (constraintGenerator == null) {
return;
}
// if(this.generateDTDistinguisher && constraintGenerator instanceof RDDatatypeAnalyzer){
// return;
// }
OwnedRule ownedRule = OwnedRuleUtil.initOwnedRule();
ownedRule.setConstrainedElement(pe.getId());
String specification = constraintGenerator.generateOCLConstraint(this.selectedRuleDefinition);
......
......@@ -129,7 +129,22 @@ public class RuleDefinitionFlattenProc extends RuleDefinitionProcessorImpl {
DParent userDParent = DPathExtractor.extractDElementFromDPath(name);
if (userDParent != null) {
this.currentRdNameAsXpath.setProcessed(true);
flattenDecorNameForDParent(userDParent);
//flattenDecorNameForDParent(userDParent)
Assert customAssert = new Assert();
String assertFromName = AssertUtil.extractAssertFromName(this.currentRuleDefinition.getName());
customAssert.setTest(assertFromName);
if(assertFromName!=null){
this.currentRuleDefinition.getLetOrAssertOrReport().add(customAssert);
this.currentRuleDefinition.setName(RuleDefinitionUtil.getRealNameOfRuleDefinition(currentRuleDefinition));
this.currentRdNameAsXpath.setProcessed(true);
}
else{
this.currentRdNameAsXpath.setProcessed(false);
ProblemHandler.handleRuleDefinitionError(currentRuleDefinition,
"The name specified cannot be processed by the tool : " + name,
FlattenAnalyzerEnum.RD_FLATTEN_PROCESS.getValue());
}
} else {
this.currentRdNameAsXpath.setProcessed(false);
ProblemHandler.handleRuleDefinitionError(currentRuleDefinition,
......@@ -137,16 +152,14 @@ public class RuleDefinitionFlattenProc extends RuleDefinitionProcessorImpl {
FlattenAnalyzerEnum.RD_FLATTEN_PROCESS.getValue());
}
}
} else {
Assert customAssert = new Assert();
customAssert.setTest(AssertUtil.extractAssertFromName(this.currentRuleDefinition.getName()));
this.currentRuleDefinition.getLetOrAssertOrReport().add(customAssert);
this.currentRuleDefinition.setName(RuleDefinitionUtil.getRealNameOfRuleDefinition(currentRuleDefinition));
this.currentRdNameAsXpath.setProcessed(false);
ProblemHandler.handleRuleDefinitionError(currentRuleDefinition,
"The name specified cannot be processed by the tool : " + name,
FlattenAnalyzerEnum.RD_FLATTEN_PROCESS.getValue());
}
// else {
// Assert customAssert = new Assert();
// customAssert.setTest(AssertUtil.extractAssertFromName(this.currentRuleDefinition.getName()));
// this.currentRuleDefinition.getLetOrAssertOrReport().add(customAssert);
// this.currentRuleDefinition.setName(RuleDefinitionUtil.getRealNameOfRuleDefinition(currentRuleDefinition));
// this.currentRdNameAsXpath.setProcessed(false);
// }
}
/**
......
......@@ -120,6 +120,7 @@ public final class AssertUtil {
String[] splitInnerXPATH = innerXPATH.split(" ");
XPATHOCLGroup group = new XPATHOCLGroup();
for(int j=0;j<splitInnerXPATH.length;j+=2){
splitInnerXPATH[j] = splitInnerXPATH[j].replaceAll("\\(?\\)?","");
XPATHOCLRule rule;
String operationString = j!=splitInnerXPATH.length-1?splitInnerXPATH[j+1]:"";
if(splitInnerXPATH[j].contains("@xsi:type")){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment