<!--  Purpose section: 2.16.840.1.113883.10.20.1.13 -->

<!-- errors -->

<pattern id='p-2.16.840.1.113883.10.20.1.13-errors' see='#p-2.16.840.1.113883.10.20.1.13-errors'>
	<title>Purpose section - errors validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.13"]'>
	<assert test="self::cda:section">The root of a purpose section shall be 'section' in the HL7 namespace.</assert>
	<assert test="cda:text">The Purpose section SHALL contain a narrative block.</assert>
	<assert test="cda:code[@code='48764-5'][@codeSystem='2.16.840.1.113883.6.1']">The value for Section / code SHALL be "48764-5" "Summary purpose" 2.16.840.1.113883.6.1 LOINC STATIC.</assert>
	<assert test="cda:title">The Purpose section SHALL contain Section / title.</assert>
	<report test='.'>PURPOSE SECTION LOINC CODE NEEDS UPDATING WHEN FINAL SPEC IS RELEASED. </report>
	</rule>
</pattern>

<!-- warning -->

<pattern id='p-2.16.840.1.113883.10.20.1.13-warning' see='#p-2.16.840.1.113883.10.20.1.13-warning'>
	<title>Purpose section - warning validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.13"]'>
	<assert test='descendant::*[cda:templateId/@root="2.16.840.1.113883.10.20.1.30"]'>The Purpose section SHOULD include one or more purpose activities (templateId 2.16.840.1.113883.10.20.1.30).</assert>
	<assert test="contains(translate(cda:title,'QWERTYUIOPASDFGHJKLZXCVBNM','qwertyuiopasdfghjklzxcvbnm'),'purpose')">Section / title SHOULD be valued with a case-insensitive language-insensitive text string containing “purpose”.</assert>
	</rule>
</pattern>

<!-- manual -->

<pattern id='p-2.16.840.1.113883.10.20.1.13-manual' see='#p-2.16.840.1.113883.10.20.1.13-manual'>
	<title>Purpose section - manual validation phase</title>
	<rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.1.13"]'>
	<report test='.'></report>
	</rule>
</pattern>

