Unit Test Results.

Designed for use with JUnit and Ant.

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

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

Tests

NameStatusResultTime(s)
testConstructor

Constraint

OCL

SuccessInvalid XML

Valid XML

0.001
testValidateSocialHistorySectionMaritalStatus

Constraint

CCD Social History Section Marital status SHOULD be represented as ClinicalDocument / recordTarget / patientRole / patient / maritalStatusCode. Additional information MAY be represented as social history observations (CONF-250)

OCL

self.getClinicalDocument().recordTarget->select(r | not r.patientRole.patient.maritalStatusCode.hasContent() )->isEmpty()

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<maritalStatusCode code="code" codeSystem="codesystem"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.010
testValidateSocialHistorySectionReligiousAffiliation

Constraint

CCD Social History Section Religious affiliation SHOULD be represented as ClinicalDocument / recordTarget / patientRole / patient / religiousAffiliationCode. Additional information MAY be represented as social history observations (CONF-251)

OCL

self.getClinicalDocument().recordTarget->select(r | not r.patientRole.patient.religiousAffiliationCode.hasContent() )->isEmpty()

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<religiousAffiliationCode code="code" codeSystem="codeSystem"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.011
testValidateSocialHistorySectionPatientRace

Constraint

CCD Social History Section A patients race SHOULD be represented as ClinicalDocument / recordTarget / patientRole / patient / raceCode. Additional information MAY be represented as social history observations (CONF-252)

OCL

self.getClinicalDocument().recordTarget->select(r | not r.patientRole.patient.raceCode.hasContent() )->isEmpty()

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<raceCode code="code" codeSystem="codeSystem"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.010
testValidateSocialHistorySectionPatientRaceCodeSystem

Constraint

CCD Social History Section The value for ClinicalDocument / recordTarget / patientRole / patient / raceCode MAY be selected from codeSystem 2.16.840.1.113883.5.104 (Race) (CONF-253)

OCL

self.getClinicalDocument().recordTarget->forAll(r | r.patientRole.patient.raceCode.codeSystem = '2.16.840.1.113883.5.104' )

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<raceCode code="code" codeSystem="2.16.840.1.113883.5.104"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.009
testValidateSocialHistorySectionPatientEthnicity

Constraint

CCD Social History Section A patients ethnicity SHOULD be represented as ClinicalDocument / recordTarget / patientRole / patient / ethnicGroupCode. Additional information MAY be represented as social history observations. (CONF-254)

OCL

self.getClinicalDocument().recordTarget->select(r | not r.patientRole.patient.ethnicGroupCode.hasContent() )->isEmpty()

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<ethnicGroupCode code="code" codeSystem="codesystem"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.010
testValidateSocialHistorySectionPatientEthnicityCodeSystem

Constraint

CCD Social History Section The value for ClinicalDocument / recordTarget / patientRole / patient / ethnicGroupCode MAY be selected from codeSystem 2.16.840.1.113883.5.50 (Ethnicity). (CONF-255)

OCL

self.getClinicalDocument().recordTarget->forAll(r | r.patientRole.patient.ethnicGroupCode.codeSystem = '2.16.840.1.113883.5.50' )

SuccessInvalid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient/>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

Valid XML


<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
<recordTarget>
<patientRole>
<patient>
<ethnicGroupCode code="code" codeSystem="2.16.840.1.113883.5.50"/>
</patient>
</patientRole>
</recordTarget>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.1.15"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>

0.008
testValidateSocialHistorySectionTemplateId

Constraint

The 'SocialHistorySectionTemplateId' invariant is violated on 'org.openhealthtools.mdht.uml.cda.mu2consol.impl.SocialHistorySectionImpl@143d9e05{#//}'

OCL

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

SuccessInvalid XML


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

Valid XML


<section xmlns="urn:hl7-org:v3">
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>

0.008
testValidateSocialHistorySectionCode

Constraint

Consol Social History Section SHALL contain exactly one [1..1] code (CONF:14819)/@code="29762-2" Social history (CodeSystem: 2.16.840.1.113883.6.1 LOINC) (CONF:14820)

OCL

(self.code.oclIsUndefined() or self.code.isNullFlavorUndefined()) implies (not self.code.oclIsUndefined() and self.code.oclIsKindOf(datatypes::CE) and let value : datatypes::CE = self.code.oclAsType(datatypes::CE) in value.code = '29762-2' and value.codeSystem = '2.16.840.1.113883.6.1')

SuccessInvalid XML


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

Valid XML


<section xmlns="urn:hl7-org:v3">
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
</section>

0.022
testValidateSocialHistorySectionTitle

Constraint

Consol Social History Section SHALL contain exactly one [1..1] title (CONF:7938)

OCL

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

SuccessInvalid XML


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

Valid XML


<section xmlns="urn:hl7-org:v3">
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
<title>title</title>
</section>

0.011
testValidateSocialHistorySectionText

Constraint

Consol Social History Section SHALL contain exactly one [1..1] text (CONF:7939)

OCL

not self.text.oclIsUndefined()

SuccessInvalid XML


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

Valid XML


<section xmlns="urn:hl7-org:v3">
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
<text/>
</section>

0.004
testValidateSocialHistorySectionSocialHistoryObservation

Constraint

Consol Social History Section MAY contain zero or more [0..*] entry (CONF:7953, CONF:7954) Contains exactly one [1..1] Social History Observation (templateId: 2.16.840.1.113883.10.20.22.4.38)

OCL

self.entry->exists(entry : cda::Entry | not entry.observation.oclIsUndefined() and entry.observation.oclIsKindOf(consol::SocialHistoryObservation))

SuccessInvalid XML


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

Valid XML


<section xmlns="urn:hl7-org:v3">
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Social history"/>
<entry>
<observation/>
</entry>
</section>

0.009
testGetSocialHistoryObservations

Constraint

OCL

SuccessInvalid XML

Valid XML

0.009
Properties »