<!--  Status observation: 2.16.840.1.113883.10.20.1.57 -->

<!-- errors -->

<pattern id='p-2.16.840.1.113883.10.20.1.57-errors' see='#p-2.16.840.1.113883.10.20.1.57-errors'>
	<title>Status observation - errors validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.57"]'>
    <assert test="self::cda:observation">A status observation (templateId 2.16.840.1.113883.10.20.1.57) SHALL be represented with Observation.</assert>
    <assert test="parent::*[cda:entryRelationship/@typeCode='REFR']">A status observation SHALL be the target of an entryRelationship whos value for “entryRelationship / typeCode” SHALL be “REFR”  2.16.840.1.113883.5.1002 ActRelationshipType STATIC</assert>
    <assert test="@classCode='OBS'">The value for “Observation / classCode” in a status observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</assert>
    <assert test="@moodCode='EVN'">The value for “Observation / moodCode” in a status observation SHALL be “EVN” 2.16.840.1.113883.5.1001 ActMood STATIC</assert>
    <assert test="count(cda:code)=1">A status observation SHALL contain exactly one Observation / code.</assert>
    <assert test="cda:code[@code='33999-4'][@codeSystem='2.16.840.1.113883.6.1']">The value for “Observation / code” in a status observation SHALL be “33999-4” “Status” 2.16.840.1.113883.6.1 LOINC STATIC</assert>
    <assert test="count(cda:statusCode)=1">A status observation SHALL contain exactly one Observation / statusCode.</assert>
    <assert test="cda:statusCode[@code='completed']">The value for “Observation / statusCode” in a status observation SHALL be “completed”  2.16.840.1.113883.5.14 ActStatus STATIC.</assert>
    <assert test="(count(@*)=2) and @classCode and @moodCode">A status observation SHALL NOT contain any additional Observation attributes.</assert>
    <assert test="count(cda:participant)=0">A status observation SHALL NOT contain any Observation participants.</assert>
	</rule>
</pattern>

<!-- warning -->

<pattern id='p-2.16.840.1.113883.10.20.1.57-warning' see='#p-2.16.840.1.113883.10.20.1.57-warning'>
	<title>Status observation - warning validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.57"]'>
	<report test='.'></report>
	</rule>
</pattern>

<!-- manual -->

<pattern id='p-2.16.840.1.113883.10.20.1.57-manual' see='#p-2.16.840.1.113883.10.20.1.57-manual'>
	<title>Status observation - manual validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.57"]'>
	<report test='.'></report>
	</rule>
</pattern>

