<!--  Social history observation: 2.16.840.1.113883.10.20.1.33 -->

<!-- errors -->

<pattern id='p-2.16.840.1.113883.10.20.1.33-errors' see='#p-2.16.840.1.113883.10.20.1.33-errors'>
	<title>Social history observation - errors validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.33"]'>
    <assert test="self::cda:observation">A social history observation (templateId 2.16.840.1.113883.10.20.1.33) SHALL be represented with Observation.</assert>
    <assert test="@classCode='OBS'">The value for “Observation / classCode” in a social history 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 social history observation SHALL be “EVN” 2.16.840.1.113883.5.1001 ActMood STATIC.</assert>
    <assert test="cda:id">A social history observation SHALL contain at least one Observation / id.</assert>
    <assert test="count(cda:statusCode)=1">A social history observation SHALL include exactly one Observation / statusCode.</assert>
    <assert test="cda:statusCode[@code='completed']">The value for “Observation / statusCode” in a social history observation SHALL be “completed”  2.16.840.1.113883.5.14 ActStatus STATIC.</assert>
	</rule>
</pattern>

<!-- warning -->

<pattern id='p-2.16.840.1.113883.10.20.1.33-warning' see='#p-2.16.840.1.113883.10.20.1.33-warning'>
	<title>Social history observation - warning validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.33"]'>
	<assert test="cda:code[@codeSystem='2.16.840.1.113883.6.1' or @codeSystem='2.16.840.1.113883.6.96' ]">The value for “Observation / code” in a social history 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).</assert>
	</rule>
</pattern>

<!-- manual -->

<pattern id='p-2.16.840.1.113883.10.20.1.33-manual' see='#p-2.16.840.1.113883.10.20.1.33-manual'>
	<title>Social history observation - manual validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.33"]'>
	<report test='.'></report>
	</rule>
</pattern>

