Unit Test Results.

Designed for use with JUnit and Ant.

Class org.openhealthtools.mdht.uml.cda.ccd.tests.ResultObservationTest

NameTestsErrorsFailuresTime(s)Time StampHost
ResultObservationTest14000.2202013-01-31T13:34:19JKMSoftware-desktop

Tests

NameStatusResultTime(s)
testConstructor

Constraint

OCL

SuccessInvalid XML

Valid XML

0.001
testValidateResultObservationCodeValue

Constraint

Consol Result Observation The value for 'code' in a result observation SHOULD be selected from LOINC (codeSystem 2.16.840.1.113883.6.1) or SNOMED CT (codeSystem 2.16.840.1.113883.6.96) Laboratory results SHOULD be from LOINC (CodeSystem: 2.16.840.1.113883.6.1) or other constrained terminology named by the US Department of Health and Human Services Office of National Coordinator or other federal agency. Local and/or regional codes for laboratory results are allowed. The Local and/or regional codes SHOULD be sent in the translation element. (CONF:7166)

OCL

self.code.isNullFlavorDefined() or self.code.codeSystem = '2.16.840.1.113883.6.1' or self.code.codeSystem = '2.16.840.1.113883.6.96'

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<code codeSystem="invalidCodeSystem"/>
</observation>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<code codeSystem="2.16.840.1.113883.6.1"/>
</observation>

0.011
testValidateResultObservationReferenceRangeRequired

Constraint

CCD Result Observation SHOULD satisfy: Contain one or more referenceRange to show the normal range of values for the observation result (CONF-419)

OCL

not self.referenceRange->isEmpty()

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.31"/>
<referenceRange/>
</observation>

0.064
testValidateResultObservationNoObservationRangeCode

Constraint

Consol Result Observation SHOULD contain zero or more [0..*] referenceRange. Such referenceRanges, if present, SHALL contain exactly one [1..1] observationRange. This observationRange SHALL NOT contain [0..0] code (CONF:7152)

OCL

self.referenceRange->forAll(range : cda::ReferenceRange | range.observationRange.code.code.oclIsUndefined())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<referenceRange>
<observationRange>
<code code="Test"/>
</observationRange>
</referenceRange>
</observation>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<referenceRange>
<observationRange>
<code/>
</observationRange>
</referenceRange>
</observation>

0.024
testValidateResultObservationInformationSource

Constraint

CCD Result Observation SHALL satisfy: Contains one or more sources of information. (CONF-421)

OCL

not self.informant->isEmpty() or not self.getSection().informant->isEmpty()or not self.getClinicalDocument().informant->isEmpty()or self.reference->exists(ref : cda::Reference | ref.typeCode = vocab::x_ActRelationshipExternalReference::XCRPT)or (self.entryRelationship->exists(rel : cda::EntryRelationship | rel.typeCode = vocab::x_ActRelationshipEntryRelationship::REFR and rel.observation.code.code = '48766-0'))

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.31"/>
<informant/>
</observation>

0.025
testValidateResultObservationTemplateId

Constraint

The 'ResultObservationTemplateId' invariant is violated on 'org.openhealthtools.mdht.uml.cda.mu2consol.impl.ResultObservationImpl@69e6c569{#//}'

OCL

self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.22.4.2')

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
</observation>

0.007
testValidateResultObservationMoodCode

Constraint

OCL

self.moodCode=vocab::x_ActMoodDocumentObservation::EVN

SuccessInvalid XML


Skip Fail Test

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
</observation>

0.003
testValidateResultObservationId

Constraint

Consol Result Observation SHALL contain at least one [1..*] id (CONF:7137)

OCL

(self.id->isEmpty() or self.id->exists(element | element.isNullFlavorUndefined())) implies (not self.id->isEmpty())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3">
<id/>
</observation>

0.011
testValidateResultObservationEffectiveTime

Constraint

Consol Result Observation SHALL contain exactly one [1..1] effectiveTime (CONF:7140, CONF:7141)

OCL

(self.effectiveTime.oclIsUndefined() or self.effectiveTime.isNullFlavorUndefined()) implies (not self.effectiveTime.oclIsUndefined())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<effectiveTime/>
</observation>

0.011
testValidateResultObservationStatusCode

Constraint

Consol Result Observation SHALL contain exactly one [1..1] statusCode (CONF:7134), where the @code SHALL be selected from ValueSet Result Status 2.16.840.1.113883.11.20.9.39 STATIC 2012-04-27 (CONF:14849)

OCL

(self.statusCode.oclIsUndefined() or self.statusCode.isNullFlavorUndefined()) implies (not self.statusCode.oclIsUndefined() and self.statusCode.oclIsKindOf(datatypes::CS) and let value : datatypes::CS = self.statusCode.oclAsType(datatypes::CS) in value.code = 'aborted' or value.code = 'active' or value.code = 'cancelled' or value.code = 'completed' or value.code = 'held' or value.code = 'suspended')

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<statusCode code="completed"/>
</observation>

0.011
testValidateResultObservationCode

Constraint

Consol Result Observation SHALL contain exactly one [1..1] code (CONF:7133)

OCL

(self.code.oclIsUndefined() or self.code.isNullFlavorUndefined()) implies (not self.code.oclIsUndefined())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<code xsi:type="CE"/>
</observation>

0.010
testValidateResultObservationMethodCode

Constraint

Consol Result Observation MAY contain zero or one [0..1] methodCode (CONF:7148)

OCL

(self.methodCode->isEmpty() or self.methodCode->exists(element | element.isNullFlavorUndefined())) implies (not self.methodCode->isEmpty())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<methodCode/>
</observation>

0.012
testValidateResultObservationInterpretationCode

Constraint

Consol Result Observation SHOULD contain zero or more [0..*] interpretationCode (CONF:7147)

OCL

(self.interpretationCode->isEmpty() or self.interpretationCode->exists(element | element.isNullFlavorUndefined())) implies (not self.interpretationCode->isEmpty())

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<interpretationCode/>
</observation>

0.011
testValidateResultObservationValue

Constraint

Consol Result Observation SHALL contain exactly one [1..1] value (CONF:7143)

OCL

(self.value->isEmpty() or self.value->exists(element | element.isNullFlavorUndefined())) implies (self.value->size() = 1)

SuccessInvalid XML


<observation xmlns="urn:hl7-org:v3"/>

Valid XML


<observation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<value xsi:type="CD"/>
</observation>

0.012
Properties »