Index: ccr/trunk/p/GPLCCR0.m
===================================================================
--- ccr/trunk/p/GPLCCR0.m	(revision 25)
+++ ccr/trunk/p/GPLCCR0.m	(revision 34)
@@ -1,625 +1,625 @@
-GPLCCR0 ; CCDCCR/GPL - CCR TEMPLATE AND ACCESS ROUTINES; 5/31/08
-        ;;0.1;CCDCCR;nopatch;noreleasedate
-        W "This is a CCR TEMPLATE with processing routines",!
-        W !
-        Q
-        ;
-ZT(ZARY,BAT,LINE) ; private routine to add a line to the ZARY array
-        ; ZARY IS PASSED BY NAME
-        ; BAT is a string identifying the section
-        ; LINE is a test which will evaluate to true or false
-        ; I '$G(@ZARY) D
-        . S @ZARY@(0)=0 ; initially there are no elements
-        . W "GOT HERE LOADING "_LINE,!
-        N CNT ; count of array elements
-        S CNT=@ZARY@(0) ; contains array count
-        S CNT=CNT+1 ; increment count
-        S @ZARY@(CNT)=LINE ; put the line in the array
-        ; S @ZARY@(BAT,CNT)="" ; index the test by battery
-        S @ZARY@(0)=CNT ; update the array counter
-        Q
-        ;
-ZLOAD(ZARY,ROUTINE)  ; load tests into ZARY which is passed by reference
-       ; ZARY IS PASSED BY NAME
-       ; ZARY = name of the root, closed array format (e.g., "^TMP($J)")
-       ; ROUTINE = NAME OF THE ROUTINE - PASSED BY VALUE
-       K @ZARY S @ZARY=""
-       S @ZARY@(0)=0 ; initialize array count
-       N LINE,LABEL,BODY
-       N INTEST S INTEST=0 ; switch for in the TEMPLATE section
-       N SECTION S SECTION="[anonymous]" ; NO section LABEL
-       ;
-       N NUM F NUM=1:1 S LINE=$T(+NUM^@ROUTINE) Q:LINE=""  D
-       . I LINE?." "1";<TEMPLATE>".E S INTEST=1 ; entering section
-       . I LINE?." "1";</TEMPLATE>".E S INTEST=0 ; leaving section
-       . I INTEST  D  ; within the section
-       . . I LINE?." "1";><".E  D  ; sub-section name found
-       . . . S SECTION=$P($P(LINE,";><",2),">",1) ; pull out name
-       . . I LINE?." "1";;".E  D  ; line found
-       . . . D ZT(ZARY,SECTION,$P(LINE,";;",2)) ; put the line in the array
-       Q
-       ;
-LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
-        D ZLOAD(ARY,"GPLCCR0")
-        ; ZWR @ARY
-        Q
-        ;
-;<TEMPLATE>
-;;<?xml version="1.0" encoding="UTF-8"?>
-;;<?xml-stylesheet type="text/xsl" href="ccr_20060420.xsl"?>
-;;<ContinuityOfCareRecord xmlns="urn:astm-org:CCR">
-;;<CCRDocumentObjectID>871bd605-e8f8-4b80-9918-4b03f781129e</CCRDocumentObjectID>
-;;<Language>
-;;<Text>English</Text>
-;;</Language>
-;;<Version>V1.0</Version>
-;;<DateTime>
-;;<ExactDateTime>@@DATETIME@@2008-03-18T23:10:58Z</ExactDateTime>
-;;</DateTime>
-;;<Patient>
-;;<ActorID>@@ACTORPATIENT@@</ActorID>
-;;</Patient>
-;;<From>
-;;<ActorLink>
-;;<ActorID>@@ACTORFROM@@</ActorID>
-;;</ActorLink>
-;;<ActorLink>
-;;<ActorID>@@ACTORFROM2@@</ActorID>
-;;</ActorLink>
-;;</From>
-;;<To>
-;;<ActorLink>
-;;<ActorID>@@ACTORTO@@</ActorID>
-;;<ActorRole>
-;;<Text>Primary Provider</Text>
-;;</ActorRole>
-;;</ActorLink>
-;;</To>
-;;<Purpose>
-;;<Description>
-;;<Text>@@PURPOSEDESCRIPTION@@CEND PHR</Text>
-;;</Description>
-;;</Purpose>
-;;<Body>
-;;<Problems>
-;;<Problem>
-;;<CCRDataObjectID>@@PROBLEMOBJECTID@@</CCRDataObjectID>
-;;<Type>
-;;<Text>Problem</Text>
-;;</Type>
-;;<Description>
-;;<Text>@@PROBLEMDESCRIPTION@@</Text>
-;;<Code>
-;;<Value>@@PROBLEMCODEVALUE@@</Value>
-;;<CodingSystem>ICD9CM</CodingSystem>
-;;<Version>@@PROBLEMCODINGVERSION@@</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@PROBLEMSOURCEACTORID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</Problem>
-;;</Problems>
-;;<FamilyHistory>
-;;<FamilyProblemHistory>
-;;<CCRDataObjectID></CCRDataObjectID>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;<FamilyMember>
-;;<ActorID>AA0003</ActorID>
-;;<ActorRole>
-;;<Text>Father</Text>
-;;</ActorRole>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</FamilyMember>
-;;<Problem>
-;;<Type>
-;;<Text>Problem</Text>
-;;</Type>
-;;<Description>
-;;<Text>Heart Disease</Text>
-;;<Code>
-;;<Value>C0018799</Value>
-;;<CodingSystem>UMLS Concept</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;<Code>
-;;<Value>429.9</Value>
-;;<CodingSystem>ICD9CM</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;<Code>
-;;<Value>56265001</Value>
-;;<CodingSystem>SNOMEDCT</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</Problem>
-;;</FamilyProblemHistory>
-;;<FamilyProblemHistory>
-;;<CCRDataObjectID>BB0003</CCRDataObjectID>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;<FamilyMember>
-;;<ActorID>AA0004</ActorID>
-;;<ActorRole>
-;;<Text>Grandparents</Text>
-;;</ActorRole>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</FamilyMember>
-;;<Problem>
-;;<Type>
-;;<Text>Problem</Text>
-;;</Type>
-;;<Description>
-;;<Text>Arthritis</Text>
-;;<Code>
-;;<Value>C0003873</Value>
-;;<CodingSystem>UMLS Concept</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;<Code>
-;;<Value>714.0</Value>
-;;<CodingSystem>ICD9CM</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;<Code>
-;;<Value>69896004</Value>
-;;<CodingSystem>SNOMEDCT</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</Problem>
-;;<Problem>
-;;<Type>
-;;<Text>Problem</Text>
-;;</Type>
-;;<Description>
-;;<Text>Diabetes Mellitus</Text>
-;;<Code>
-;;<Value>C0375113</Value>
-;;<CodingSystem>UMLS Concept</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;<Code>
-;;<Value>250.00</Value>
-;;<CodingSystem>ICD9CM</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</Problem>
-;;<Problem>
-;;<Type>
-;;<Text>Problem</Text>
-;;</Type>
-;;<Description>
-;;<Text>Parkinson's disease NOS</Text>
-;;<Code>
-;;<Value>332.0</Value>
-;;<CodingSystem>ICD9CM</CodingSystem>
-;;<Version>2007</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</Problem>
-;;</FamilyProblemHistory>
-;;</FamilyHistory>
-;;<SocialHistory>
-;;<SocialHistoryElement>
-;;<CCRDataObjectID>BB0004</CCRDataObjectID>
-;;<Type>
-;;<Text>Marital Status</Text>
-;;</Type>
-;;<Description>
-;;<Text>Married</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</SocialHistoryElement>
-;;<SocialHistoryElement>
-;;<CCRDataObjectID>BB0005</CCRDataObjectID>
-;;<Type>
-;;<Text>Ethnic Origin</Text>
-;;</Type>
-;;<Description>
-;;<Text>Not Hispanic or Latino</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</SocialHistoryElement>
-;;<SocialHistoryElement>
-;;<CCRDataObjectID>BB0006</CCRDataObjectID>
-;;<Type>
-;;<Text>Race</Text>
-;;</Type>
-;;<Description>
-;;<Text>White</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</SocialHistoryElement>
-;;<SocialHistoryElement>
-;;<CCRDataObjectID>BB0007</CCRDataObjectID>
-;;<Type>
-;;<Text>Occupation</Text>
-;;</Type>
-;;<Description>
-;;<Text>Physician</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;</SocialHistoryElement>
-;;</SocialHistory>
-;;<Medications>
-;;<Medication>
-;;<CCRDataObjectID>BB0008</CCRDataObjectID>
-;;<DateTime>
-;;<Type>
-;;<Text>Begin Date</Text>
-;;</Type>
-;;<Age>
-;;<Value>42</Value>
-;;<Units>
-;;<Unit>Years</Unit>
-;;</Units>
-;;</Age>
-;;</DateTime>
-;;<Type>
-;;<Text>Medication</Text>
-;;</Type>
-;;<Status>
-;;<Text>Active</Text>
-;;</Status>
-;;<Source>
-;;<Actor>
-;;<ActorID>AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;<Product>
-;;<ProductName>
-;;<Text>simvastatin</Text>
-;;<Code>
-;;<Value>36567</Value>
-;;<CodingSystem>RXNORM</CodingSystem>
-;;<Version>2005</Version>
-;;</Code>
-;;</ProductName>
-;;<BrandName>
-;;<Text>Simvastatin</Text>
-;;<Code>
-;;<Value>00093715510</Value>
-;;<CodingSystem>NDC</CodingSystem>
-;;<Version>2005</Version>
-;;</Code>
-;;</BrandName>
-;;<Strength>
-;;<Value>40</Value>
-;;<Units>
-;;<Unit>mg</Unit>
-;;</Units>
-;;</Strength>
-;;<Form>
-;;<Text>tablet</Text>
-;;</Form>
-;;</Product>
-;;<Directions>
-;;<Direction>
-;;<Description>
-;;<Text>1  PO 1 time per day</Text>
-;;</Description>
-;;<Dose>
-;;<Value>1</Value>
-;;</Dose>
-;;<Route>
-;;<Text>PO</Text>
-;;</Route>
-;;<Frequency>
-;;<Value>1 time per day</Value>
-;;</Frequency>
-;;</Direction>
-;;</Directions>
-;;</Medication>
-;;</Medications>
-;;<VitalSigns>
-;;<Result>
-;;<CCRDataObjectID>@@DATAOBJECTID@@BB0009</CCRDataObjectID>
-;;<DateTime>
-;;<Type>
-;;<Text>Assessment Time</Text>
-;;</Type>
-;;<ExactDateTime>@@HEIGHTWEIGHTDATATIME@@2008-03-18</ExactDateTime>
-;;</DateTime>
-;;<Description>
-;;<Text>Height &amp; Weight</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@HEIGHTWEIGHTSOURCE@@AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;<Test>
-;;<CCRDataObjectID>@@DATAOBJECTID@@BB0010</CCRDataObjectID>
-;;<Type>
-;;<Text>Observation</Text>
-;;</Type>
-;;<Description>
-;;<Text>Height</Text>
-;;<Code>
-;;<Value>50373000</Value>
-;;<CodingSystem>SNOMED</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@HEIGHTSOURCEID@@AA0002</ActorID>
-;;</Actor>
-;;</Source>
-;;<TestResult>
-;;<Value>@@HEIGHTINCHES@@68</Value>
-;;<Units>
-;;<Unit>in</Unit>
-;;</Units>
-;;</TestResult>
-;;</Test>
-;;<Test>
-;;<CCRDataObjectID>@@DATAOBJECTID@@BB0011</CCRDataObjectID>
-;;<Type>
-;;<Text>Observation</Text>
-;;</Type>
-;;<Description>
-;;<Text>Weight</Text>
-;;<Code>
-;;<Value>363808001</Value>
-;;<CodingSystem>SNOMED</CodingSystem>
-;;<Version>2006</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@WEIGHTSOURCEID@@AA0002</ActorID>
-;;</Actor>
-;;</Source>
-;;<TestResult>
-;;<Value>@@WEIGHTLBS@@180</Value>
-;;<Units>
-;;<Unit>lb</Unit>
-;;</Units>
-;;</TestResult>
-;;</Test>
-;;</Result>
-;;<Result>
-;;<CCRDataObjectID>@@DATAOBJECTID@@BB0012</CCRDataObjectID>
-;;<Description>
-;;<Text>Blood Type</Text>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@BLOODTYPESOURCEID@@AA0001</ActorID>
-;;</Actor>
-;;</Source>
-;;<Test>
-;;<CCRDataObjectID>@@DATAOBJECTID@@BB0013</CCRDataObjectID>
-;;<Type>
-;;<Text>Result</Text>
-;;</Type>
-;;<Description>
-;;<Text>Blood Type</Text>
-;;<Code>
-;;<Value>278149003</Value>
-;;<CodingSystem>SNOMED</CodingSystem>
-;;<Version>2005</Version>
-;;</Code>
-;;</Description>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@BLOODTYPESOURCEID2@@AA0002</ActorID>
-;;</Actor>
-;;</Source>
-;;<TestResult>
-;;<Value>@@BLOODTYPERESULT@@A+</Value>
-;;</TestResult>
-;;</Test>
-;;</Result>
-;;</VitalSigns>
-;;<HealthCareProviders>
-;;<Provider>
-;;<ActorID>AA0005</ActorID>
-;;<ActorRole>
-;;<Text>Primary Provider</Text>
-;;</ActorRole>
-;;</Provider>
-;;</HealthCareProviders>
-;;</Body>
-;;<Actors>
-;;<Actor>
-;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
-;;<Person>
-;;<Name>
-;;<CurrentName>
-;;<Given>@@ACTORGIVENNAME@@</Given>
-;;<Middle>@@ACTORMIDDLENAME@@</Middle>
-;;<Family>@@ACTORFAMILYNAME@@</Family>
-;;</CurrentName>
-;;</Name>
-;;<DateOfBirth>
-;;<ExactDateTime>@@ACTORDATEOFBIRTH@@</ExactDateTime>
-;;</DateOfBirth>
-;;<Gender>
-;;<Text>@@ACTORGENDER@@</Text>
-;;</Gender>
-;;</Person>
-;;<IDs>
-;;<Type>
-;;<Text>SSN</Text>
-;;</Type>
-;;<ID>@@ACTORSSN@@</ID>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@ACTORSSNSOURCEID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</IDs>
-;;<Address>
-;;<Type>
-;;<Text>@@ACTORADDRESSTYPE@@</Text>
-;;</Type>
-;;<Line1>@@ACTORADDRESSLINE1@@</Line1>
-;;<Line2>@@ACTORADDRESSLINE2@@</Line2>
-;;<City>@@ACTORADDRESSCITY@@</City>
-;;<State>@@ACTORADDRESSSTATE@@</State>
-;;<PostalCode>@@ACTORADDRESSZIPCODE@@</PostalCode>
-;;</Address>
-;;<Telephone>
-;;<Value>@@ACTORTELEPHONE@@</Value>
-;;<Type>
-;;<Text>@@ACTORTELEPHONETYPE@@</Text>
-;;</Type>
-;;</Telephone>
-;;<EMail>
-;;<Value>@@ACTOREMAIL@@</Value>
-;;</EMail>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@ACTORADDRESSSOURCEID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</Actor>
-;;<Actor>
-;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
-;;<InformationSystem>
-;;<Name>@@ACTORINFOSYSNAME@@</Name>
-;;<Version>@@ACTORINFOSYSVER@@</Version>
-;;</InformationSystem>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@ACTORINFOSYSSOURCEID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</Actor>
-;;<Actor>
-;;<ActorObjectID>AA0003</ActorObjectID>
-;;<Person>
-;;<Name>
-;;<DisplayName>@@ACTORDISPLAYNAME@@</DisplayName>
-;;</Name>
-;;</Person>
-;;<Relation>
-;;<Text>@@ACTORRELATION@@</Text>
-;;</Relation>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@ACTORRELATIONSOURCEID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</Actor>
-;;<Actor>
-;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
-;;<Person>
-;;<Name>
-;;<CurrentName>
-;;<Given>@@ACTORGIVENNAME@@</Given>
-;;<Family>@@ACTORFAMILYNAME@@</Family>
-;;</CurrentName>
-;;</Name>
-;;</Person>
-;;<Specialty>
-;;<Text>@@ACTORSPECIALITY@@</Text>
-;;</Specialty>
-;;<Address>
-;;<Type>
-;;<Text>@@ACTORADDRESSTYPE@@</Text>
-;;</Type>
-;;<Line1>@@ACTORADDRESSLINE1@@</Line1>
-;;<City>@@ACTORADDRESSLINE2@@</City>
-;;<State>@@ACTORADDRESSSTATE@@</State>
-;;</Address>
-;;<Source>
-;;<Actor>
-;;<ActorID>@@ACTORSOURCEID@@</ActorID>
-;;</Actor>
-;;</Source>
-;;</Actor>
-;;</Actors>
-;;<Signatures>
-;;<CCRSignature>
-;;<SignatureObjectID>S0001</SignatureObjectID>
-;;<ExactDateTime>2008-03-18T23:10:58Z</ExactDateTime>
-;;<Source>
-;;<ActorID>AA0001</ActorID>
-;;</Source>
-;;<Signature>
-;;<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
-;;<SignedInfo>
-;;<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
-;;<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
-;;<Reference URI="">
-;;<Transforms>
-;;<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
-;;</Transforms>
-;;<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
-;;<DigestValue>YFveLLyo+75P7rSciv0/m1O6Ot4=</DigestValue>
-;;</Reference>
-;;</SignedInfo>
-;;<SignatureValue>Bj6sACXl74hrlbUYnu8HqnRab5VGy69BOYjOH7dETxgppXMEd7AoVYaePZvgJft78JR4oQY76hbFyGcIslYauPpJxx2hCd5d56xFeaQg01R6AQOvGnhjlq63TbpFdUq0B4tYsmiibJPbQJhTQe+TcWTBvWaQt8Fkk5blO571YvI=</SignatureValue>
-;;<KeyInfo>
-;;<KeyValue>
-;;<RSAKeyValue>
-;;<Modulus>meH817QYol+/uUEg6j8Mg89s7GTlaN9B+/CGlzrtnQH+swMigZRnEPxHVO8PhEymP/W9nlhAjTScV/CUzA9yJ9WiaOn17c+KReKhfBqL24DX9BpbJ+kLYVz7mBO5Qydk5AzUT2hFwW93irD8iRKP+/t+2Mi2CjNfj8VTjJpHpm0=</Modulus>
-;;<Exponent>AQAB</Exponent>
-;;</RSAKeyValue>
-;;</KeyValue>
-;;</KeyInfo>
-;;</Signature>
-;;</Signature>
-;;</CCRSignature>
-;;</Signatures>
-;;</ContinuityOfCareRecord>
-;</TEMPLATE>
+GPLCCR0	; CCDCCR/GPL - CCR TEMPLATE AND ACCESS ROUTINES; 5/31/08
+	       ;;0.1;CCDCCR;nopatch;noreleasedate
+	       W "This is a CCR TEMPLATE with processing routines",!
+	       W !
+	       Q
+	       ;
+ZT(ZARY,BAT,LINE)	; private routine to add a line to the ZARY array
+	       ; ZARY IS PASSED BY NAME
+	       ; BAT is a string identifying the section
+	       ; LINE is a test which will evaluate to true or false
+	       ; I '$G(@ZARY) D
+	       . S @ZARY@(0)=0 ; initially there are no elements
+	       . W "GOT HERE LOADING "_LINE,!
+	       N CNT ; count of array elements
+	       S CNT=@ZARY@(0) ; contains array count
+	       S CNT=CNT+1 ; increment count
+	       S @ZARY@(CNT)=LINE ; put the line in the array
+	       ; S @ZARY@(BAT,CNT)="" ; index the test by battery
+	       S @ZARY@(0)=CNT ; update the array counter
+	       Q
+	       ;
+ZLOAD(ZARY,ROUTINE)	 ; load tests into ZARY which is passed by reference
+	      ; ZARY IS PASSED BY NAME
+	      ; ZARY = name of the root, closed array format (e.g., "^TMP($J)")
+	      ; ROUTINE = NAME OF THE ROUTINE - PASSED BY VALUE
+	      K @ZARY S @ZARY=""
+	      S @ZARY@(0)=0 ; initialize array count
+	      N LINE,LABEL,BODY
+	      N INTEST S INTEST=0 ; switch for in the TEMPLATE section
+	      N SECTION S SECTION="[anonymous]" ; NO section LABEL
+	      ;
+	      N NUM F NUM=1:1 S LINE=$T(+NUM^@ROUTINE) Q:LINE=""  D
+	      . I LINE?." "1";<TEMPLATE>".E S INTEST=1 ; entering section
+	      . I LINE?." "1";</TEMPLATE>".E S INTEST=0 ; leaving section
+	      . I INTEST  D  ; within the section
+	      . . I LINE?." "1";><".E  D  ; sub-section name found
+	      . . . S SECTION=$P($P(LINE,";><",2),">",1) ; pull out name
+	      . . I LINE?." "1";;".E  D  ; line found
+	      . . . D ZT(ZARY,SECTION,$P(LINE,";;",2)) ; put the line in the array
+	      Q
+	      ;
+LOAD(ARY)	; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
+	       D ZLOAD(ARY,"GPLCCR0")
+	       ; ZWR @ARY
+	       Q
+	       ;
+;<TEMPLATE>	
+;;<?xml	version="1.0" encoding="UTF-8"?>
+;;<?xml-stylesheet	type="text/xsl" href="ccr_20060420.xsl"?>
+;;<ContinuityOfCareRecord	xmlns="urn:astm-org:CCR">
+;;<CCRDocumentObjectID>871bd605-e8f8-4b80-9918-4b03f781129e</CCRDocumentObjectID>	
+;;<Language>	
+;;<Text>English</Text>	
+;;</Language>	
+;;<Version>V1.0</Version>	
+;;<DateTime>	
+;;<ExactDateTime>@@DATETIME@@2008-03-18T23:10:58Z</ExactDateTime>	
+;;</DateTime>	
+;;<Patient>	
+;;<ActorID>@@ACTORPATIENT@@</ActorID>	
+;;</Patient>	
+;;<From>	
+;;<ActorLink>	
+;;<ActorID>@@ACTORFROM@@</ActorID>	
+;;</ActorLink>	
+;;<ActorLink>	
+;;<ActorID>@@ACTORFROM2@@</ActorID>	
+;;</ActorLink>	
+;;</From>	
+;;<To>	
+;;<ActorLink>	
+;;<ActorID>@@ACTORTO@@</ActorID>	
+;;<ActorRole>	
+;;<Text>Primary	Provider</Text>
+;;</ActorRole>	
+;;</ActorLink>	
+;;</To>	
+;;<Purpose>	
+;;<Description>	
+;;<Text>@@PURPOSEDESCRIPTION@@CEND	PHR</Text>
+;;</Description>	
+;;</Purpose>	
+;;<Body>	
+;;<Problems>	
+;;<Problem>	
+;;<CCRDataObjectID>@@PROBLEMOBJECTID@@</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Problem</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>@@PROBLEMDESCRIPTION@@</Text>	
+;;<Code>	
+;;<Value>@@PROBLEMCODEVALUE@@</Value>	
+;;<CodingSystem>ICD9CM</CodingSystem>	
+;;<Version>@@PROBLEMCODINGVERSION@@</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@PROBLEMSOURCEACTORID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Problem>	
+;;</Problems>	
+;;<FamilyHistory>	
+;;<FamilyProblemHistory>	
+;;<CCRDataObjectID></CCRDataObjectID>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<FamilyMember>	
+;;<ActorID>AA0003</ActorID>	
+;;<ActorRole>	
+;;<Text>Father</Text>	
+;;</ActorRole>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</FamilyMember>	
+;;<Problem>	
+;;<Type>	
+;;<Text>Problem</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Heart	Disease</Text>
+;;<Code>	
+;;<Value>C0018799</Value>	
+;;<CodingSystem>UMLS	Concept</CodingSystem>
+;;<Version>2006</Version>	
+;;</Code>	
+;;<Code>	
+;;<Value>429.9</Value>	
+;;<CodingSystem>ICD9CM</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;<Code>	
+;;<Value>56265001</Value>	
+;;<CodingSystem>SNOMEDCT</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Problem>	
+;;</FamilyProblemHistory>	
+;;<FamilyProblemHistory>	
+;;<CCRDataObjectID>BB0003</CCRDataObjectID>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<FamilyMember>	
+;;<ActorID>AA0004</ActorID>	
+;;<ActorRole>	
+;;<Text>Grandparents</Text>	
+;;</ActorRole>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</FamilyMember>	
+;;<Problem>	
+;;<Type>	
+;;<Text>Problem</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Arthritis</Text>	
+;;<Code>	
+;;<Value>C0003873</Value>	
+;;<CodingSystem>UMLS	Concept</CodingSystem>
+;;<Version>2006</Version>	
+;;</Code>	
+;;<Code>	
+;;<Value>714.0</Value>	
+;;<CodingSystem>ICD9CM</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;<Code>	
+;;<Value>69896004</Value>	
+;;<CodingSystem>SNOMEDCT</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Problem>	
+;;<Problem>	
+;;<Type>	
+;;<Text>Problem</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Diabetes	Mellitus</Text>
+;;<Code>	
+;;<Value>C0375113</Value>	
+;;<CodingSystem>UMLS	Concept</CodingSystem>
+;;<Version>2006</Version>	
+;;</Code>	
+;;<Code>	
+;;<Value>250.00</Value>	
+;;<CodingSystem>ICD9CM</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Problem>	
+;;<Problem>	
+;;<Type>	
+;;<Text>Problem</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Parkinson's	disease NOS</Text>
+;;<Code>	
+;;<Value>332.0</Value>	
+;;<CodingSystem>ICD9CM</CodingSystem>	
+;;<Version>2007</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Problem>	
+;;</FamilyProblemHistory>	
+;;</FamilyHistory>	
+;;<SocialHistory>	
+;;<SocialHistoryElement>	
+;;<CCRDataObjectID>BB0004</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Marital	Status</Text>
+;;</Type>	
+;;<Description>	
+;;<Text>Married</Text>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</SocialHistoryElement>	
+;;<SocialHistoryElement>	
+;;<CCRDataObjectID>BB0005</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Ethnic	Origin</Text>
+;;</Type>	
+;;<Description>	
+;;<Text>Not	Hispanic or Latino</Text>
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</SocialHistoryElement>	
+;;<SocialHistoryElement>	
+;;<CCRDataObjectID>BB0006</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Race</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>White</Text>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</SocialHistoryElement>	
+;;<SocialHistoryElement>	
+;;<CCRDataObjectID>BB0007</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Occupation</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Physician</Text>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</SocialHistoryElement>	
+;;</SocialHistory>	
+;;<Medications>	
+;;<Medication>	
+;;<CCRDataObjectID>BB0008</CCRDataObjectID>	
+;;<DateTime>	
+;;<Type>	
+;;<Text>Begin	Date</Text>
+;;</Type>	
+;;<Age>	
+;;<Value>42</Value>	
+;;<Units>	
+;;<Unit>Years</Unit>	
+;;</Units>	
+;;</Age>	
+;;</DateTime>	
+;;<Type>	
+;;<Text>Medication</Text>	
+;;</Type>	
+;;<Status>	
+;;<Text>Active</Text>	
+;;</Status>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>AA0001</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<Product>	
+;;<ProductName>	
+;;<Text>simvastatin</Text>	
+;;<Code>	
+;;<Value>36567</Value>	
+;;<CodingSystem>RXNORM</CodingSystem>	
+;;<Version>2005</Version>	
+;;</Code>	
+;;</ProductName>	
+;;<BrandName>	
+;;<Text>Simvastatin</Text>	
+;;<Code>	
+;;<Value>00093715510</Value>	
+;;<CodingSystem>NDC</CodingSystem>	
+;;<Version>2005</Version>	
+;;</Code>	
+;;</BrandName>	
+;;<Strength>	
+;;<Value>40</Value>	
+;;<Units>	
+;;<Unit>mg</Unit>	
+;;</Units>	
+;;</Strength>	
+;;<Form>	
+;;<Text>tablet</Text>	
+;;</Form>	
+;;</Product>	
+;;<Directions>	
+;;<Direction>	
+;;<Description>	
+;;<Text>1	 PO 1 time per day</Text>
+;;</Description>	
+;;<Dose>	
+;;<Value>1</Value>	
+;;</Dose>	
+;;<Route>	
+;;<Text>PO</Text>	
+;;</Route>	
+;;<Frequency>	
+;;<Value>1	time per day</Value>
+;;</Frequency>	
+;;</Direction>	
+;;</Directions>	
+;;</Medication>	
+;;</Medications>	
+;;<VitalSigns>	
+;;<Result>	
+;;<CCRDataObjectID>@@DATAOBJECTID@@</CCRDataObjectID>	
+;;<DateTime>	
+;;<Type>	
+;;<Text>Assessment	Time</Text>
+;;</Type>	
+;;<ExactDateTime>@@HEIGHTWEIGHTDATATIME@@</ExactDateTime>	
+;;</DateTime>	
+;;<Description>	
+;;<Text>Height	&amp; Weight</Text>
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@HEIGHTWEIGHTSOURCE@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<Test>	
+;;<CCRDataObjectID>@@DATAOBJECTID@@</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Observation</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Height</Text>	
+;;<Code>	
+;;<Value>50373000</Value>	
+;;<CodingSystem>SNOMED</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@HEIGHTSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<TestResult>	
+;;<Value>@@HEIGHTINCHES@@</Value>	
+;;<Units>	
+;;<Unit>in</Unit>	
+;;</Units>	
+;;</TestResult>	
+;;</Test>	
+;;<Test>	
+;;<CCRDataObjectID>@@DATAOBJECTID@@</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Observation</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Weight</Text>	
+;;<Code>	
+;;<Value>363808001</Value>	
+;;<CodingSystem>SNOMED</CodingSystem>	
+;;<Version>2006</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@WEIGHTSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<TestResult>	
+;;<Value>@@WEIGHTLBS@@</Value>	
+;;<Units>	
+;;<Unit>lb</Unit>	
+;;</Units>	
+;;</TestResult>	
+;;</Test>	
+;;</Result>	
+;;<Result>	
+;;<CCRDataObjectID>@@DATAOBJECTID@@</CCRDataObjectID>	
+;;<Description>	
+;;<Text>Blood	Type</Text>
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@BLOODTYPESOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<Test>	
+;;<CCRDataObjectID>@@DATAOBJECTID@@</CCRDataObjectID>	
+;;<Type>	
+;;<Text>Result</Text>	
+;;</Type>	
+;;<Description>	
+;;<Text>Blood	Type</Text>
+;;<Code>	
+;;<Value>278149003</Value>	
+;;<CodingSystem>SNOMED</CodingSystem>	
+;;<Version>2005</Version>	
+;;</Code>	
+;;</Description>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@BLOODTYPESOURCEID2@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;<TestResult>	
+;;<Value>@@BLOODTYPERESULT@@</Value>	
+;;</TestResult>	
+;;</Test>	
+;;</Result>	
+;;</VitalSigns>	
+;;<HealthCareProviders>	
+;;<Provider>	
+;;<ActorID>AA0005</ActorID>	
+;;<ActorRole>	
+;;<Text>Primary	Provider</Text>
+;;</ActorRole>	
+;;</Provider>	
+;;</HealthCareProviders>	
+;;</Body>	
+;;<Actors>	
+;;<Actor>	
+;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>	
+;;<Person>	
+;;<Name>	
+;;<CurrentName>	
+;;<Given>@@ACTORGIVENNAME@@</Given>	
+;;<Middle>@@ACTORMIDDLENAME@@</Middle>	
+;;<Family>@@ACTORFAMILYNAME@@</Family>	
+;;</CurrentName>	
+;;</Name>	
+;;<DateOfBirth>	
+;;<ExactDateTime>@@ACTORDATEOFBIRTH@@</ExactDateTime>	
+;;</DateOfBirth>	
+;;<Gender>	
+;;<Text>@@ACTORGENDER@@</Text>	
+;;</Gender>	
+;;</Person>	
+;;<IDs>	
+;;<Type>	
+;;<Text>SSN</Text>	
+;;</Type>	
+;;<ID>@@ACTORSSN@@</ID>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@ACTORSSNSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</IDs>	
+;;<Address>	
+;;<Type>	
+;;<Text>@@ACTORADDRESSTYPE@@</Text>	
+;;</Type>	
+;;<Line1>@@ACTORADDRESSLINE1@@</Line1>	
+;;<Line2>@@ACTORADDRESSLINE2@@</Line2>	
+;;<City>@@ACTORADDRESSCITY@@</City>	
+;;<State>@@ACTORADDRESSSTATE@@</State>	
+;;<PostalCode>@@ACTORADDRESSZIPCODE@@</PostalCode>	
+;;</Address>	
+;;<Telephone>	
+;;<Value>@@ACTORTELEPHONE@@</Value>	
+;;<Type>	
+;;<Text>@@ACTORTELEPHONETYPE@@</Text>	
+;;</Type>	
+;;</Telephone>	
+;;<EMail>	
+;;<Value>@@ACTOREMAIL@@</Value>	
+;;</EMail>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@ACTORADDRESSSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Actor>	
+;;<Actor>	
+;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>	
+;;<InformationSystem>	
+;;<Name>@@ACTORINFOSYSNAME@@</Name>	
+;;<Version>@@ACTORINFOSYSVER@@</Version>	
+;;</InformationSystem>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@ACTORINFOSYSSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Actor>	
+;;<Actor>	
+;;<ActorObjectID>AA0003</ActorObjectID>	
+;;<Person>	
+;;<Name>	
+;;<DisplayName>@@ACTORDISPLAYNAME@@</DisplayName>	
+;;</Name>	
+;;</Person>	
+;;<Relation>	
+;;<Text>@@ACTORRELATION@@</Text>	
+;;</Relation>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@ACTORRELATIONSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Actor>	
+;;<Actor>	
+;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>	
+;;<Person>	
+;;<Name>	
+;;<CurrentName>	
+;;<Given>@@ACTORGIVENNAME@@</Given>	
+;;<Family>@@ACTORFAMILYNAME@@</Family>	
+;;</CurrentName>	
+;;</Name>	
+;;</Person>	
+;;<Specialty>	
+;;<Text>@@ACTORSPECIALITY@@</Text>	
+;;</Specialty>	
+;;<Address>	
+;;<Type>	
+;;<Text>@@ACTORADDRESSTYPE@@</Text>	
+;;</Type>	
+;;<Line1>@@ACTORADDRESSLINE1@@</Line1>	
+;;<City>@@ACTORADDRESSLINE2@@</City>	
+;;<State>@@ACTORADDRESSSTATE@@</State>	
+;;</Address>	
+;;<Source>	
+;;<Actor>	
+;;<ActorID>@@ACTORSOURCEID@@</ActorID>	
+;;</Actor>	
+;;</Source>	
+;;</Actor>	
+;;</Actors>	
+;;<Signatures>	
+;;<CCRSignature>	
+;;<SignatureObjectID>S0001</SignatureObjectID>	
+;;<ExactDateTime>2008-03-18T23:10:58Z</ExactDateTime>	
+;;<Source>	
+;;<ActorID>AA0001</ActorID>	
+;;</Source>	
+;;<Signature>	
+;;<Signature	xmlns="http://www.w3.org/2000/09/xmldsig#">
+;;<SignedInfo>	
+;;<CanonicalizationMethod	Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
+;;<SignatureMethod	Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+;;<Reference	URI="">
+;;<Transforms>	
+;;<Transform	Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+;;</Transforms>	
+;;<DigestMethod	Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+;;<DigestValue>YFveLLyo+75P7rSciv0/m1O6Ot4=</DigestValue>	
+;;</Reference>	
+;;</SignedInfo>	
+;;<SignatureValue>Bj6sACXl74hrlbUYnu8HqnRab5VGy69BOYjOH7dETxgppXMEd7AoVYaePZvgJft78JR4oQY76hbFyGcIslYauPpJxx2hCd5d56xFeaQg01R6AQOvGnhjlq63TbpFdUq0B4tYsmiibJPbQJhTQe+TcWTBvWaQt8Fkk5blO571YvI=</SignatureValue>	
+;;<KeyInfo>	
+;;<KeyValue>	
+;;<RSAKeyValue>	
+;;<Modulus>meH817QYol+/uUEg6j8Mg89s7GTlaN9B+/CGlzrtnQH+swMigZRnEPxHVO8PhEymP/W9nlhAjTScV/CUzA9yJ9WiaOn17c+KReKhfBqL24DX9BpbJ+kLYVz7mBO5Qydk5AzUT2hFwW93irD8iRKP+/t+2Mi2CjNfj8VTjJpHpm0=</Modulus>	
+;;<Exponent>AQAB</Exponent>	
+;;</RSAKeyValue>	
+;;</KeyValue>	
+;;</KeyInfo>	
+;;</Signature>	
+;;</Signature>	
+;;</CCRSignature>	
+;;</Signatures>	
+;;</ContinuityOfCareRecord>	
+;</TEMPLATE>	
