<!--  Problem act: 2.16.840.1.113883.10.20.1.27 -->

<!-- errors -->

<pattern id='p-2.16.840.1.113883.10.20.1.27-errors' see='#p-2.16.840.1.113883.10.20.1.27-errors'>
	<title>Problem act - errors validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.27"]'>
	<assert test="self::cda:act[@classCode='ACT'][@moodCode='EVN']">A problem act (templateId 2.16.840.1.113883.10.20.1.27) SHALL be represented with Act. The value for "Act / classCode" in a problem act SHALL be "ACT" 2.16.840.1.113883.5.6 ActClass STATIC. The value for "Act / moodCode" in a problem act SHALL be "EVN" 2.16.840.1.113883.5.1001 ActMood STATIC.</assert>
	<assert test="cda:id">A problem act SHALL contain at least one Act / id.</assert>
	<assert test="cda:code/@nullFlavor='NA'">The value for "Act / code / @NullFlavor" in a problem act SHALL be "NA" "Not applicable" 2.16.840.1.113883.5.1008 NullFlavor STATIC.</assert>
	<assert test="count(cda:effectiveTime) &lt; 2">A problem act MAY contain exactly one Act / effectiveTime, to indicate the timing of the concern (e.g. the time the problem was noted).</assert>
	<assert test="cda:entryRelationship">A problem act SHALL contain one or more Act / entryRelationship.</assert>
	<assert test="count(cda:templateId[@root='2.16.840.1.113883.10.20.1.41']) &lt; 2">A problem act MAY contain exactly one episode observation. The template identifier for an episode observation is 2.16.840.1.113883.10.20.1.41.</assert>
	<assert test="count(cda:templateId[@root='2.16.840.1.113883.10.20.1.48']) &lt; 2">A problem act MAY contain exactly one patient awareness.</assert>
	<report test='.'></report>
	</rule>
</pattern>

<!-- warning -->

<pattern id='p-2.16.840.1.113883.10.20.1.27-warning' see='#p-2.16.840.1.113883.10.20.1.27-warning'>
	<title>Problem act - warning validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.27"]'>
	<assert test=".//cda:templateId[@root='2.16.840.1.113883.10.20.1.28']">A problem act SHOULD include one or more problem observations (templateId 2.16.840.1.113883.10.20.1.28). </assert>
	<assert test="cda:entryRelationship[@typeCode='SUBJ']/cda:observation/cda:templateId[@root='2.16.840.1.113883.10.20.1.28'] 
               or cda:entryRelationship[@typeCode='SUBJ']/cda:observation/cda:templateId[@root='2.16.840.1.113883.10.20.1.18']">The target of a problem act with Act / entryRelationship / @typeCode=”SUBJ” SHOULD be a problem observation (in the Problem section) or alert observation (in the Alert section, see section 3.9 Alerts), but MAY be some other clinical statement.</assert>

	<report test='.'></report>
	</rule>
</pattern>

<!-- manual -->

<pattern id='p-2.16.840.1.113883.10.20.1.27-manual' see='#p-2.16.840.1.113883.10.20.1.27-manual'>
	<title>Problem act - manual validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.27"]'>
	<report test='.'></report>
	</rule>
</pattern>

