Index: ccr/trunk/p/C0CCCD.m
===================================================================
--- ccr/trunk/p/C0CCCD.m	(revision 392)
+++ ccr/trunk/p/C0CCCD.m	(revision 392)
@@ -0,0 +1,272 @@
+C0CCCD   ; CCDCCR/GPL - CCD MAIN PROCESSING; 6/6/08
+ ;;0.1;CCDCCR;nopatch;noreleasedate
+ ;Copyright 2008,2009 George Lilly, University of Minnesota.
+ ;Licensed under the terms of the GNU General Public License.
+ ;See attached copy of the License.
+ ;
+ ;This program is free software; you can redistribute it and/or modify
+ ;it under the terms of the GNU General Public License as published by
+ ;the Free Software Foundation; either version 2 of the License, or
+ ;(at your option) any later version.
+ ;
+ ;This program is distributed in the hope that it will be useful,
+ ;but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ ;GNU General Public License for more details.
+ ;
+ ;You should have received a copy of the GNU General Public License along
+ ;with this program; if not, write to the Free Software Foundation, Inc.,
+ ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ ;
+ ; EXPORT A CCR
+ ;
+EXPORT   ; EXPORT ENTRY POINT FOR CCR
+       ; Select a patient.
+       S DIC=2,DIC(0)="AEMQ" D ^DIC
+       I Y<1 Q  ; EXIT
+       S DFN=$P(Y,U,1) ; SET THE PATIENT
+       D XPAT(DFN,"","") ; EXPORT TO A FILE
+       Q
+       ;
+XPAT(DFN,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
+       ; DIR IS THE DIRECTORY, DEFAULTS IF NULL TO ^TMP("C0CCCR","ODIR")
+       ; FN IS FILE NAME, DEFAULTS IF NULL
+       ; N CCDGLO
+       D CCDRPC(.CCDGLO,DFN,"CCD","","","")
+       S OARY=$NA(^TMP("C0CCCR",$J,DFN,"CCD",1))
+       S ONAM=FN
+       I FN="" S ONAM="PAT_"_DFN_"_CCD_V1.xml"
+       S ODIRGLB=$NA(^TMP("C0CCCR","ODIR"))
+       I '$D(@ODIRGLB) D  ; IF NOT ODIR HAS BEEN SET
+       . S @ODIRGLB="/home/glilly/CCROUT"
+       . ;S @ODIRGLB="/home/cedwards/"
+       . ;S @ODIRGLB="/opt/wv/p/"
+       S ODIR=DIR
+       I DIR="" S ODIR=@ODIRGLB
+       N ZY
+       S ZY=$$OUTPUT^C0CXPATH(OARY,ONAM,ODIR)
+       W $P(ZY,U,2)
+       Q
+       ;
+CCDRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY)  ;RPC ENTRY POINT FOR CCR OUTPUT
+    ; CCRGRTN IS RETURN ARRAY PASSED BY NAME
+    ; DFN IS PATIENT IEN
+    ; CCRPART IS "CCR" FOR ENTIRE CCR, OR SECTION NAME FOR A PART
+    ;   OF THE CCR BODY.. PARTS INCLUDE "PROBLEMS" "VITALS" ETC
+    ; TIME1 IS STARTING TIME TO INCLUDE - NULL MEANS ALL
+    ; TIME2 IS ENDING TIME TO INCLUDE TIME IS FILEMAN TIME
+    ; - NULL MEANS NOW
+    ; HDRARY IS THE HEADER ARRAY DEFINING THE "FROM" AND
+    ;    "TO" VARIABLES
+    ;    IF NULL WILL DEFAULT TO "FROM" ORGANIZATION AND "TO" DFN
+    I '$D(DEBUG) S DEBUG=0
+    N CCD S CCD=0 ; FLAG FOR PROCESSING A CCD
+    I CCRPART="CCD" S CCD=1 ; WE ARE PROCESSING A CCD
+    S TGLOBAL=$NA(^TMP("C0CCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
+    I CCD S CCDGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCD")) ; GLOBAL FOR THE CCD
+    E  S CCDGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
+    S ACTGLO=$NA(^TMP("C0CCCR",$J,DFN,"ACTORS")) ; GLOBAL FOR ALL ACTORS
+    ; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
+    S CCRGRTN=$NA(^TMP("C0CCCR",$J,DFN,CCRPART)) ; RTN GLO NM OF PART OR ALL
+    I CCD D LOAD^C0CCCD1(TGLOBAL)  ; LOAD THE CCR TEMPLATE
+    E  D LOAD^C0CCCR0(TGLOBAL)  ; LOAD THE CCR TEMPLATE
+    D CP^C0CXPATH(TGLOBAL,CCDGLO) ; COPY THE TEMPLATE TO CCR GLOBAL
+    N CAPSAVE,CAPSAVE2 ; FOR HOLDING THE CCD ROOT LINES
+    S CAPSAVE=@TGLOBAL@(3) ; SAVE THE CCD ROOT
+    S CAPSAVE2=@TGLOBAL@(@TGLOBAL@(0)) ; SAVE LAST LINE OF CCD
+    S @CCDGLO@(3)="<ContinuityOfCareRecord>" ; CAP WITH CCR ROOT
+    S @TGLOBAL@(3)=@CCDGLO@(3) ; CAP THE TEMPLATE TOO
+    S @CCDGLO@(@CCDGLO@(0))="</ContinuityOfCareRecord>" ; FINISH CAP
+    S @TGLOBAL@(@TGLOBAL@(0))="</ContinuityOfCareRecord>" ; FINISH CAP TEMP
+    ;
+    ; DELETE THE BODY, ACTORS AND SIGNATURES SECTIONS FROM GLOBAL
+    ; THESE WILL BE POPULATED AFTER CALLS TO THE XPATH ROUTINES
+    D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Body")
+    D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Actors")
+    I 'CCD D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Signatures")
+    I DEBUG F I=1:1:@CCDGLO@(0) W @CCDGLO@(I),!
+    ;
+    I 'CCD D HDRMAP(CCDGLO,DFN,HDRARY) ; MAP HEADER VARIABLES
+    ; MAPPING THE PATIENT PORTION OF THE CDA HEADER
+    S ZZX="//ContinuityOfCareRecord/recordTarget/patientRole/patient"
+    D QUERY^C0CXPATH(CCDGLO,ZZX,"ACTT1")
+    D PATIENT^C0CACTOR("ACTT1",DFN,"ACTORPATIENT_"_DFN,"ACTT2") ; MAP PATIENT
+    I DEBUG D PARY^C0CXPATH("ACTT2")
+    D REPLACE^C0CXPATH(CCDGLO,"ACTT2",ZZX)
+    I DEBUG D PARY^C0CXPATH(CCDGLO)
+    K ACTT1 K ACCT2
+    ; MAPPING THE PROVIDER ORGANIZATION,AUTHOR,INFORMANT,CUSTODIAN CDA HEADER
+    ; FOR NOW, THEY ARE ALL THE SAME AND RESOLVE TO ORGANIZATION
+    D ORG^C0CACTOR(CCDGLO,DFN,"ACTORPATIENTORGANIZATION","ACTT2") ; MAP ORG
+    D CP^C0CXPATH("ACTT2",CCDGLO)
+    ;
+    K ^TMP("C0CCCR",$J,"CCRSTEP") ; KILL GLOBAL PRIOR TO ADDING TO IT
+    S CCRXTAB=$NA(^TMP("C0CCCR",$J,"CCRSTEP")) ; GLOBAL TO STORE CCR STEPS
+    D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
+    N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
+    F I=1:1:@CCRXTAB@(0)  D  ; PROCESS THE CCR BODY SECTIONS
+    . S XI=@CCRXTAB@(I) ; CALL COPONENTS TO PARSE
+    . S RTN=$P(XI,";",2) ; NAME OF ROUTINE TO CALL
+    . S TAG=$P(XI,";",1) ; LABEL INSIDE ROUTINE TO CALL
+    . S XPATH=$P(XI,";",3) ; XPATH TO XML TO PASS TO ROUTINE
+    . D QUERY^C0CXPATH(TGLOBAL,XPATH,"INXML") ; EXTRACT XML TO PASS
+    . S IXML="INXML"
+    . I CCD D SHAVE(IXML) ; REMOVE ALL BUT REPEATING PARTS OF TEMPLATE SECTION
+    . S OXML=$P(XI,";",4) ; ARRAY FOR SECTION VALUES
+    . ; W OXML,!
+    . S CALL="D "_TAG_"^"_RTN_"(IXML,DFN,OXML)" ; SETUP THE CALL
+    . W "RUNNING ",CALL,!
+    . X CALL
+    . I @OXML@(0)'=0 D  ; THERE IS A RESULT
+    . . I CCD D QUERY^C0CXPATH(TGLOBAL,XPATH,"ITMP") ; XML TO UNSHAVE WITH
+    . . I CCD D UNSHAVE("ITMP",OXML)
+    . . I CCD D UNMARK^C0CXPATH(OXML) ; REMOVE THE CCR MARKUP FROM SECTION
+    . ; NOW INSERT THE RESULTS IN THE CCR BUFFER
+    . D INSERT^C0CXPATH(CCDGLO,OXML,"//ContinuityOfCareRecord/Body")
+    . I DEBUG F C0CI=1:1:@OXML@(0) W @OXML@(C0CI),!
+    ; NEED TO ADD BACK IN ACTOR PROCESSING AFTER WE FIGURE OUT LINKAGE
+    ; D ACTLST^C0CCCR(CCDGLO,ACTGLO) ; GEN THE ACTOR LIST
+    ; D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Actors","ACTT")
+    ; D EXTRACT^C0CACTOR("ACTT",ACTGLO,"ACTT2")
+    ; D INSINNER^C0CXPATH(CCDGLO,"ACTT2","//ContinuityOfCareRecord/Actors")
+    N I,J,DONE S DONE=0
+    F I=0:0 D  Q:DONE  ; DELETE UNTIL ALL EMPTY ELEMENTS ARE GONE
+    . S J=$$TRIM^C0CXPATH(CCDGLO) ; DELETE EMPTY ELEMENTS
+    . W "TRIMMED",J,!
+    . I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE
+    I CCD D  ; TURN THE BODY INTO A CCD COMPONENT
+    . N I
+    . F I=1:1:@CCDGLO@(0) D  ; SEARCH THROUGH THE ENTIRE ARRAY
+    . . I @CCDGLO@(I)["<Body>" D  ; REPLACE BODY MARKUP
+    . . . S @CCDGLO@(I)="<component><structuredBody>" ; WITH CCD EQ
+    . . I @CCDGLO@(I)["</Body>" D  ; REPLACE BODY MARKUP
+    . . . S @CCDGLO@(I)="</structuredBody></component>"
+    S @CCDGLO@(3)=CAPSAVE ; UNCAP - TURN IT BACK INTO A CCD
+    S @CCDGLO@(@CCDGLO@(0))=CAPSAVE2 ; UNCAP LAST LINE
+    Q
+    ;
+INITSTPS(TAB)  ; INITIALIZE CCR PROCESSING STEPS
+    ; TAB IS PASSED BY NAME
+    W "TAB= ",TAB,!
+    ; ORDER FOR CCR IS PROBLEMS,FAMILYHISTORY,SOCIALHISTORY,MEDICATIONS,VITALSIGNS,RESULTS,HEALTHCAREPROVIDERS
+    D PUSH^C0CXPATH(TAB,"EXTRACT;C0CPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP(""C0CCCR"",$J,DFN,""PROBLEMS"")")
+    ;D PUSH^C0CXPATH(TAB,"EXTRACT;C0CMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""C0CCCR"",$J,DFN,""MEDICATIONS"")")
+    I 'CCD D PUSH^C0CXPATH(TAB,"EXTRACT;C0CVITAL;//ContinuityOfCareRecord/Body/VitalSigns;^TMP(""C0CCCR"",$J,DFN,""VITALS"")")
+    Q
+    ;
+SHAVE(SHXML) ; REMOVES THE 2-6 AND N-1 AND N-2 LINES FROM A COMPONENT
+    ; NEEDED TO EXPOSE THE REPEATING PARTS FOR GENERATION
+    N SHTMP,SHBLD ; TEMP ARRAY AND BUILD LIST
+    W SHXML,!
+    W @SHXML@(1),!
+    D QUEUE^C0CXPATH("SHBLD",SHXML,1,1) ; THE FIRST LINE IS NEEDED
+    D QUEUE^C0CXPATH("SHBLD",SHXML,7,@SHXML@(0)-3) ; REPEATING PART
+    D QUEUE^C0CXPATH("SHBLD",SHXML,@SHXML@(0),@SHXML@(0)) ; LAST LINE
+    D PARY^C0CXPATH("SHBLD") ; PRINT BUILD LIST
+    D BUILD^C0CXPATH("SHBLD","SHTMP") ; BUILD EDITED SECTION
+    D CP^C0CXPATH("SHTMP",SHXML) ; COPY RESULT TO PASSED ARRAY
+    Q
+    ;
+UNSHAVE(ORIGXML,SHXML) ; REPLACES THE 2-6 AND N-1 AND N-2 LINES FROM TEMPLATE
+    ; NEEDED TO RESTORM FIXED TOP AND BOTTOM OF THE COMPONENT XML
+    N SHTMP,SHBLD ; TEMP ARRAY AND BUILD LIST
+    W SHXML,!
+    W @SHXML@(1),!
+    D QUEUE^C0CXPATH("SHBLD",ORIGXML,1,6) ; FIRST 6 LINES OF TEMPLATE
+    D QUEUE^C0CXPATH("SHBLD",SHXML,2,@SHXML@(0)-1) ; INS ALL BUT FIRST/LAST
+    D QUEUE^C0CXPATH("SHBLD",ORIGXML,@ORIGXML@(0)-2,@ORIGXML@(0)) ; FROM TEMP
+    D PARY^C0CXPATH("SHBLD") ; PRINT BUILD LIST
+    D BUILD^C0CXPATH("SHBLD","SHTMP") ; BUILD EDITED SECTION
+    D CP^C0CXPATH("SHTMP",SHXML) ; COPY RESULT TO PASSED ARRAY
+    Q
+    ;
+HDRMAP(CXML,DFN,IHDR)   ; MAP HEADER VARIABLES: FROM, TO ECT
+    N VMAP S VMAP=$NA(^TMP("C0CCCR",$J,DFN,"HEADER"))
+    ; K @VMAP
+    S @VMAP@("DATETIME")=$$FMDTOUTC^CCRUTIL($$NOW^XLFDT,"DT")
+    I IHDR="" D  ; HEADER ARRAY IS NOT PROVIDED, USE DEFAULTS
+    . S @VMAP@("ACTORPATIENT")="ACTORPATIENT_"_DFN
+    . S @VMAP@("ACTORFROM")="ACTORORGANIZATION_"_DUZ ; FROM DUZ - ???
+    . S @VMAP@("ACTORFROM2")="ACTORSYSTEM_1" ; SECOND FROM IS THE SYSTEM
+    . S @VMAP@("ACTORTO")="ACTORPATIENT_"_DFN  ; FOR TEST PURPOSES
+    . S @VMAP@("PURPOSEDESCRIPTION")="CEND PHR"  ; FOR TEST PURPOSES
+    . S @VMAP@("ACTORTOTEXT")="Patient"  ; FOR TEST PURPOSES
+    . ; THIS IS THE USE CASE FOR THE PHR WHERE "TO" IS THE PATIENT
+    I IHDR'="" D  ; HEADER VALUES ARE PROVIDED
+    . D CP^C0CXPATH(IHDR,VMAP) ; COPY HEADER VARIABLES TO MAP ARRAY
+    N CTMP
+    D MAP^C0CXPATH(CXML,VMAP,"CTMP")
+    D CP^C0CXPATH("CTMP",CXML)
+    Q
+    ;
+ACTLST(AXML,ACTRTN) ; RETURN THE ACTOR LIST FOR THE XML IN AXML
+    ; AXML AND ACTRTN ARE PASSED BY NAME
+    ; EACH ACTOR RECORD HAS 3 PARTS - IE IF OBJECTID=ACTORPATIENT_2
+    ; P1= OBJECTID - ACTORPATIENT_2
+    ; P2= OBJECT TYPE - PATIENT OR PROVIDER OR SOFTWARE
+    ;OR INSTITUTION
+    ;  OR PERSON(IN PATIENT FILE IE NOK)
+    ; P3= IEN RECORD NUMBER FOR ACTOR - 2
+    N I,J,K,L
+    K @ACTRTN ; CLEAR RETURN ARRAY
+    F I=1:1:@AXML@(0) D  ; SCAN ALL LINES
+    . I @AXML@(I)?.E1"<ActorID>".E D  ; THERE IS AN ACTOR THIS LINE
+    . . S J=$P($P(@AXML@(I),"<ActorID>",2),"</ActorID>",1)
+    . . W "<ActorID>=>",J,!
+    . . I J'="" S K(J)="" ; HASHING ACTOR
+    . . ;  TO GET RID OF DUPLICATES
+    S I="" ; GOING TO $O THROUGH THE HASH
+    F J=0:0 D  Q:$O(K(I))=""  ;
+    . S I=$O(K(I)) ; WALK THROUGH THE HASH OF ACTORS
+    . S $P(L,U,1)=I ; FIRST PIECE IS THE OBJECT ID
+    . S $P(L,U,2)=$P($P(I,"ACTOR",2),"_",1) ; ACTOR TYPE
+    . S $P(L,U,3)=$P(I,"_",2) ; IEN RECORD NUMBER FOR ACTOR
+    . D PUSH^C0CXPATH(ACTRTN,L) ; ADD THE ACTOR TO THE RETURN ARRAY
+    Q
+    ;
+TEST ; RUN ALL THE TEST CASES
+  D TESTALL^C0CUNIT("C0CCCR")
+  Q
+  ;
+ZTEST(WHICH)  ; RUN ONE SET OF TESTS
+  N ZTMP
+  D ZLOAD^C0CUNIT("ZTMP","C0CCCR")
+  D ZTEST^C0CUNIT(.ZTMP,WHICH)
+  Q
+  ;
+TLIST  ; LIST THE TESTS
+  N ZTMP
+  D ZLOAD^C0CUNIT("ZTMP","C0CCCR")
+  D TLIST^C0CUNIT(.ZTMP)
+  Q
+  ;
+ ;;><TEST>
+ ;;><PROBLEMS>
+ ;;>>>K C0C S C0C=""
+ ;;>>>D CCRRPC^C0CCCR(.C0C,"2","PROBLEMS","","","")
+ ;;>>?@C0C@(@C0C@(0))["</Problems>"
+ ;;><VITALS>
+ ;;>>>K C0C S C0C=""
+ ;;>>>D CCRRPC^C0CCCR(.C0C,"2","VITALS","","","")
+ ;;>>?@C0C@(@C0C@(0))["</VitalSigns>"
+ ;;><CCR>
+ ;;>>>K C0C S C0C=""
+ ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCR","","","")
+ ;;>>?@C0C@(@C0C@(0))["</ContinuityOfCareRecord>"
+ ;;><ACTLST>
+ ;;>>>K C0C S C0C=""
+ ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCR","","","")
+ ;;>>>D ACTLST^C0CCCR(C0C,"ACTTEST")
+ ;;><ACTORS>
+ ;;>>>D ZTEST^C0CCCR("ACTLST")
+ ;;>>>D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Actors","G2")
+ ;;>>>D EXTRACT^C0CACTOR("G2","ACTTEST","G3")
+ ;;>>?G3(G3(0))["</Actors>"
+ ;;><TRIM>
+ ;;>>>D ZTEST^C0CCCR("CCR")
+ ;;>>>W $$TRIM^C0CXPATH(CCDGLO)
+ ;;><CCD>
+ ;;>>>K C0C S C0C=""
+ ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCD","","","")
+ ;;>>?@C0C@(@C0C@(0))["</ContinuityOfCareRecord>"
+ ;;></TEST>
Index: ccr/trunk/p/C0CCCR0.m
===================================================================
--- ccr/trunk/p/C0CCCR0.m	(revision 392)
+++ ccr/trunk/p/C0CCCR0.m	(revision 392)
@@ -0,0 +1,786 @@
+C0CCCR0 ; CCDCCR/GPL - CCR TEMPLATE AND ACCESS ROUTINES; 5/31/08
+ ;;0.1;CCDCCR;nopatch;noreleasedate
+ ;Copyright 2008,2009 George Lilly, University of Minnesota.
+ ;Licensed under the terms of the GNU General Public License.
+ ;See attached copy of the License.
+ ;
+ ;This program is free software; you can redistribute it and/or modify
+ ;it under the terms of the GNU General Public License as published by
+ ;the Free Software Foundation; either version 2 of the License, or
+ ;(at your option) any later version.
+ ;
+ ;This program is distributed in the hope that it will be useful,
+ ;but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ ;GNU General Public License for more details.
+ ;
+ ;You should have received a copy of the GNU General Public License along
+ ;with this program; if not, write to the Free Software Foundation, Inc.,
+ ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ ;
+ 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,"C0CCCR0")
+ ; ZWR @ARY
+ Q
+ ;
+ ;<TEMPLATE>
+ ;;<?xml version="1.0" encoding="UTF-8"?>
+ ;;<?xml-stylesheet type="text/xsl" href="ccr.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@@</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>@@ACTORTOTEXT@@</Text>
+ ;;</ActorRole>
+ ;;</ActorLink>
+ ;;</To>
+ ;;<Purpose>
+ ;;<Description>
+ ;;<Text>@@PURPOSEDESCRIPTION@@</Text>
+ ;;</Description>
+ ;;</Purpose>
+ ;;<Body>
+ ;;<Problems>
+ ;;<Problem>
+ ;;<CCRDataObjectID>@@PROBLEMOBJECTID@@</CCRDataObjectID>
+ ;;<Type>
+ ;;<Text>Problem</Text>
+ ;;</Type>
+ ;;<Status>
+ ;;<Text>@@PROBLEMSTATUS@@</Text>
+ ;;</Status>
+ ;;<Description>
+ ;;<Text>@@PROBLEMDESCRIPTION@@</Text>
+ ;;<Code>
+ ;;<Value>@@PROBLEMCODEVALUE@@</Value>
+ ;;<CodingSystem>ICD9CM</CodingSystem>
+ ;;<Version>@@PROBLEMCODINGVERSION@@</Version>
+ ;;</Code>
+ ;;</Description>
+ ;;<DateTime>
+ ;;<ExactDateTime>@@PROBLEMDATEMOD@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@PROBLEMSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Problem>
+ ;;</Problems>
+ ;;<Immunizations>
+ ;;<Immunization>
+ ;;<CCRDataObjectID>@@IMMUNEOBJECTID@@</CCRDataObjectID>
+ ;;<DateTime>
+ ;;<Type>
+ ;;<Text>@@IMMUNEDATETIMETYPETEXT@@</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@IMMUNEDATETIME@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Source><Actor><ActorID>@@IMMUNESOURCEACTORID@@</ActorID></Actor></Source>
+ ;;<Product>
+ ;;<ProductName>
+ ;;<Text>@@IMMUNEPRODUCTNAMETEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@IMMUNEPRODUCTCODE@@</Value>
+ ;;<CodingSystem>@@IMMUNEPRODUCTCODESYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</ProductName>
+ ;;</Product>
+ ;;</Immunization>
+ ;;</Immunizations>
+ ;;<FamilyHistory>
+ ;;<FamilyProblemHistory>
+ ;;<CCRDataObjectID>@@FAMILYHISTORYOBJECTID@@</CCRDataObjectID>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@FAMILYHISTORYACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<FamilyMember>
+ ;;<ActorID>@@FAMILYMEMBERACTORID@@</ActorID>
+ ;;<ActorRole>
+ ;;<Text>@@FAMILYMEMBERACTORROLETEXT@@</Text>
+ ;;</ActorRole>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@FAMILYMEMBERSOURCACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</FamilyMember>
+ ;;<Problem>
+ ;;<Type>
+ ;;<Text>Problem</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@FAMILYMEMBERPROBLEMDESCRIPTION@@</Text>
+ ;;<Code>
+ ;;<Value>@@FAMILYMEMBERPROBLEMCODE@@</Value>
+ ;;<CodingSystem>@@FAMILYMEMBERCODESYSTEM@@</CodingSystem>
+ ;;<Version>@@FAMILYMEMBERCODEVERSION@@</Version>
+ ;;</Code>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@FAMILYMEMBERPROBLEMSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Problem>
+ ;;</FamilyProblemHistory>
+ ;;</FamilyHistory>
+ ;;<SocialHistory>
+ ;;<SocialHistoryElement>
+ ;;<CCRDataObjectID>@@SOCIALHISTORYOBJECTID@@</CCRDataObjectID>
+ ;;<Type>
+ ;;<Text>@@SOCIALHISTORYTYPETEXT@@</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@SOCIALHISTORYDESCRIPTIONTEXT@@</Text>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@SOCIALHISTORYSOURCACTORID@@</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>
+ ;;<Alerts>
+ ;;<Alert>
+ ;;<CCRDataObjectID>@@ALERTOBJECTID@@</CCRDataObjectID>
+ ;;<Type>
+ ;;<Text>@@ALERTTYPE@@</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@ALERTDESCRIPTIONTEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@ALERTCODEVALUE@@</Value>
+ ;;<CodingSystem>@@ALERTCODESYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</Description>
+ ;;<Status>
+ ;;<Text>@@ALERTSTATUSTEXT@@</Text>
+ ;;</Status>
+ ;;<DateTime>
+ ;;<ExactDateTime>@@ALERTDATETIME@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ALERTSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<Agent>
+ ;;<Products>
+ ;;<Product>
+ ;;<CCRDataObjectID>@@ALERTAGENTPRODUCTOBJECTID@@</CCRDataObjectID>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ALERTAGENTPRODUCTSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<ProductName>
+ ;;<Text>@@ALERTAGENTPRODUCTNAMETEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@ALERTAGENTPRODUCTCODEVALUE@@</Value>
+ ;;<CodingSystem>@@ALERTAGENTPRODUCTCODESYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</ProductName>
+ ;;</Product>
+ ;;</Products>
+ ;;</Agent>
+ ;;<Reaction>
+ ;;<Description>
+ ;;<Text>@@ALERTREACTIOINDESCRIPTIONTEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@ALERTREACTIONCODEVALUE@@</Value>
+ ;;<CodingSystem>@@ALERTREACTIONCODESYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</Description>
+ ;;</Reaction>
+ ;;</Alert>
+ ;;</Alerts>
+ ;;<Medications>
+ ;;<Medication>
+ ;;<CCRDataObjectID>@@MEDOBJECTID@@</CCRDataObjectID>
+ ;;<DateTime>
+ ;;<Type>
+ ;;<Text>@@MEDISSUEDATETXT@@</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@MEDISSUEDATE@@</ExactDateTime>
+ ;;<Type>
+ ;;<Text>@@MEDLASTFILLDATETXT@@</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@MEDLASTFILLDATE@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<IDs>
+ ;;<Type>
+ ;;<Text>@@MEDRXNOTXT@@</Text>
+ ;;</Type>
+ ;;<ID>@@MEDRXNO@@</ID>
+ ;;</IDs>
+ ;;<Type>
+ ;;<Text>@@MEDTYPETEXT@@</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@MEDDETAILUNADORNED@@</Text>
+ ;;</Description>
+ ;;<Status>
+ ;;<Text>@@MEDSTATUSTEXT@@</Text>
+ ;;</Status>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@MEDSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<Product>
+ ;;<ProductName>
+ ;;<Text>@@MEDPRODUCTNAMETEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@MEDPRODUCTNAMECODEVALUE@@</Value>
+ ;;<CodingSystem>@@MEDPRODUCTNAMECODINGINGSYSTEM@@</CodingSystem>
+ ;;<Version>@@MEDPRODUCTNAMECODEVERSION@@</Version>
+ ;;</Code>
+ ;;</ProductName>
+ ;;<BrandName>
+ ;;<Text>@@MEDBRANDNAMETEXT@@</Text>
+ ;;</BrandName>
+ ;;<Strength>
+ ;;<Value>@@MEDSTRENGTHVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDSTRENGTHUNIT@@</Unit>
+ ;;</Units>
+ ;;</Strength>
+ ;;<Form>
+ ;;<Text>@@MEDFORMTEXT@@</Text>
+ ;;</Form>
+ ;;<Concentration>
+ ;;<Value>@@MEDCONCVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDCONCUNIT@@</Unit>
+ ;;</Units>
+ ;;</Concentration>
+ ;;</Product>
+ ;;<Quantity>
+ ;;<Value>@@MEDQUANTITYVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDQUANTITYUNIT@@</Unit>
+ ;;</Units>
+ ;;</Quantity>
+ ;;<Directions>
+ ;;<Direction>
+ ;;<Description>
+ ;;<Text>@@MEDDIRECTIONDESCRIPTIONTEXT@@</Text>
+ ;;</Description>
+ ;;<DoseIndicator>
+ ;;<Text>@@MEDDOSEINDICATOR@@</Text>
+ ;;</DoseIndicator>
+ ;;<DeliveryMethod>
+ ;;<Text>@@MEDDELIVERYMETHOD@@</Text>
+ ;;</DeliveryMethod>
+ ;;<Dose>
+ ;;<Value>@@MEDDOSEVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDDOSEUNIT@@</Unit>
+ ;;</Units>
+ ;;<Rate>
+ ;;<Value>@@MEDRATEVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDRATEUNIT@@</Unit>
+ ;;</Units>
+ ;;</Rate>
+ ;;</Dose>
+ ;;<Vehicle>
+ ;;<Text>@@MEDVEHICLETEXT@@</Text>
+ ;;</Vehicle>
+ ;;<Route>
+ ;;<Text>@@MEDDIRECTIONROUTETEXT@@</Text>
+ ;;</Route>
+ ;;<Frequency>
+ ;;<Value>@@MEDFREQUENCYVALUE@@</Value>
+ ;;</Frequency>
+ ;;<Interval>
+ ;;<Value>@@MEDINTERVALVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDINTERVALUNIT@@</Unit>
+ ;;</Units>
+ ;;</Interval>
+ ;;<Duration>
+ ;;<Value>@@MEDDURATIONVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@MEDDURATIONUNIT@@</Unit>
+ ;;</Units>
+ ;;</Duration>
+ ;;<Indication>
+ ;;<PRNFlag>
+ ;;<Text>@@MEDPRNFLAG@@</Text>
+ ;;</PRNFlag>
+ ;;<Problem>
+ ;;<CCRDataObjectID>@@MEDPROBLEMOBJECTID@@</CCRDataObjectID>
+ ;;<Type>
+ ;;<Text>@@MEDPROBLEMTYPETXT@@</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@MEDPROBLEMDESCRIPTION@@</Text>
+ ;;<Code>
+ ;;<Value>@@MEDPROBLEMCODEVALUE@@</Value>
+ ;;<CodingSystem>@@MEDPROBLEMCODINGSYSTEM@@</CodingSystem>
+ ;;<Version>@@MEDPROBLEMCODINGVERSION@@</Version>
+ ;;</Code>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@MEDPROBLEMSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Problem>
+ ;;</Indication>
+ ;;<StopIndicator>
+ ;;<Text>@@MEDSTOPINDICATOR@@</Text>
+ ;;</StopIndicator>
+ ;;<DirectionSequenceModifier>@@MEDDIRSEQ@@</DirectionSequenceModifier>
+ ;;<MultipleDirectionModifier>
+ ;;<Text>@@MEDMULDIRMOD@@</Text>
+ ;;</MultipleDirectionModifier>
+ ;;</Direction>
+ ;;</Directions>
+ ;;<PatientInstructions>
+ ;;<Instruction>@@MEDPTINSTRUCTIONS@@</Instruction>
+ ;;</PatientInstructions>
+ ;;<FullfillmentInstructions>
+ ;;<Text>@@MEDFULLFILLMENTINSTRUCTIONS@@</Text>
+ ;;</FullfillmentInstructions>
+ ;;<Refills>
+ ;;<Refill>
+ ;;<Number>@@MEDRFNO@@</Number>
+ ;;</Refill>
+ ;;</Refills>
+ ;;</Medication>
+ ;;</Medications>
+ ;;<VitalSigns>
+ ;;<Result>
+ ;;<CCRDataObjectID>@@VITALSIGNSDATAOBJECTID@@</CCRDataObjectID>
+ ;;<DateTime>
+ ;;<Type>
+ ;;<Text>@@VITALSIGNSDATETIMETYPETEXT@@</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@VITALSIGNSEXACTDATETIME@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Description>
+ ;;<Text>@@VITALSIGNSDESCRIPTIONTEXT@@</Text>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@VITALSIGNSSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<Test>
+ ;;<CCRDataObjectID>@@VITALSIGNSTESTOBJECTID@@</CCRDataObjectID>
+ ;;<Type>
+ ;;<Text>@@VITALSIGNSTESTTYPETEXT@@</Text>
+ ;;</Type>
+ ;;<Description>
+ ;;<Text>@@VITALSIGNSDESCRIPTIONTEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@VITALSIGNSDESCCODEVALUE@@</Value>
+ ;;<CodingSystem>@@VITALSIGNSDESCCODINGSYSTEM@@</CodingSystem>
+ ;;<Version>@@VITALSIGNSCODEVERSION@@</Version>
+ ;;</Code>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@VITALSIGNSTESTSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<TestResult>
+ ;;<Value>@@VITALSIGNSTESTRESULTVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@VITALSIGNSTESTRESULTUNIT@@</Unit>
+ ;;</Units>
+ ;;</TestResult>
+ ;;</Test>
+ ;;</Result>
+ ;;</VitalSigns>
+ ;;<Results>
+ ;;<Result>
+ ;;<CCRDataObjectID>@@RESULTOBJECTID@@</CCRDataObjectID>
+ ;;<DateTime>
+ ;;<Type>
+ ;;<Text>Assessment Time</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@RESULTASSESSMENTDATETIME@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Description>
+ ;;<Text>@@RESULTDESCRIPTIONTEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@RESULTCODE@@</Value>
+ ;;<CodingSystem>@@RESULTCODINGSYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</Description>
+ ;;<Status>
+ ;;<Text>@@RESULTSTATUS@@</Text>
+ ;;</Status>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@RESULTSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<Test>
+ ;;<CCRDataObjectID>@@RESULTTESTOBJECTID@@</CCRDataObjectID>
+ ;;<DateTime>
+ ;;<Type>
+ ;;<Text>Assessment Time</Text>
+ ;;</Type>
+ ;;<ExactDateTime>@@RESULTTESTDATETIME@@</ExactDateTime>
+ ;;</DateTime>
+ ;;<Description>
+ ;;<Text>@@RESULTTESTDESCRIPTIONTEXT@@</Text>
+ ;;<Code>
+ ;;<Value>@@RESULTTESTCODEVALUE@@</Value>
+ ;;<CodingSystem>@@RESULTTESTCODINGSYSTEM@@</CodingSystem>
+ ;;</Code>
+ ;;</Description>
+ ;;<Status>
+ ;;<Text>@@RESULTTESTSTATUSTEXT@@</Text>
+ ;;</Status>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@RESULTTESTSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;<TestResult>
+ ;;<Value>@@RESULTTESTVALUE@@</Value>
+ ;;<Units>
+ ;;<Unit>@@RESULTTESTUNITS@@</Unit>
+ ;;</Units>
+ ;;</TestResult>
+ ;;<NormalResult>
+ ;;<Normal>
+ ;;<Description>
+ ;;<Text>@@RESULTTESTNORMALDESCTEXT@@</Text>
+ ;;</Description>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@RESULTTESTNORMALSOURCEACTORID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Normal>
+ ;;</NormalResult>
+ ;;<Flag>
+ ;;<Text>@@RESULTTESTFLAG@@</Text>
+ ;;</Flag>
+ ;;</Test>
+ ;;</Result>
+ ;;</Results>
+ ;;<HealthCareProviders>
+ ;;<Provider>
+ ;;<ActorID>AA0005</ActorID>
+ ;;<ActorRole>
+ ;;<Text>Primary Provider</Text>
+ ;;</ActorRole>
+ ;;</Provider>
+ ;;</HealthCareProviders>
+ ;;</Body>
+ ;;<Actors>
+ ;;<ACTOR-PATIENT>
+ ;;<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>
+ ;;<Code>
+ ;;<Value>@@ACTORGENDER@@</Value>
+ ;;<CodingSystem>2.16.840.1.113883.5.1</CodingSystem>
+ ;;</Code>
+ ;;</Gender>
+ ;;</Person>
+ ;;<IDs>
+ ;;<Type>
+ ;;<Text>@@ACTORSSNTEXT@@</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>@@ACTORRESTEL@@</Value>
+ ;;<Type>
+ ;;<Text>@@ACTORRESTELTEXT@@</Text>
+ ;;</Type>
+ ;;</Telephone>
+ ;;<Telephone>
+ ;;<Value>@@ACTORWORKTEL@@</Value>
+ ;;<Type>
+ ;;<Text>@@ACTORWORKTELTEXT@@</Text>
+ ;;</Type>
+ ;;</Telephone>
+ ;;<Telephone>
+ ;;<Value>@@ACTORCELLTEL@@</Value>
+ ;;<Type>
+ ;;<Text>@@ACTORCELLTELTEXT@@</Text>
+ ;;</Type>
+ ;;</Telephone>
+ ;;<EMail>
+ ;;<Value>@@ACTOREMAIL@@</Value>
+ ;;</EMail>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ACTORADDRESSSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Actor>
+ ;;</ACTOR-PATIENT>
+ ;;<ACTOR-SYSTEM>
+ ;;<Actor>
+ ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
+ ;;<InformationSystem>
+ ;;<Name>@@ACTORINFOSYSNAME@@</Name>
+ ;;<Version>@@ACTORINFOSYSVER@@</Version>
+ ;;</InformationSystem>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ACTORINFOSYSSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Actor>
+ ;;</ACTOR-SYSTEM>
+ ;;<ACTOR-NOK>
+ ;;<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-NOK>
+ ;;<ACTOR-PROVIDER>
+ ;;<Actor>
+ ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
+ ;;<Person>
+ ;;<Name>
+ ;;<CurrentName>
+ ;;<Given>@@ACTORGIVENNAME@@</Given>
+ ;;<Middle>@@ACTORMIDDLENAME@@</Middle>
+ ;;<Family>@@ACTORFAMILYNAME@@</Family>
+ ;;<Title>@@ACTORTITLE@@</Title>
+ ;;</CurrentName>
+ ;;</Name>
+ ;;</Person>
+ ;;<IDs>
+ ;;<Type>
+ ;;<Text>@@IDTYPE@@</Text>
+ ;;</Type>
+ ;;<ID>@@ID@@</ID>
+ ;;<IssuedBy>
+ ;;<Description>
+ ;;<Text>@@IDDESC@@</Text>
+ ;;</Description>
+ ;;</IssuedBy>
+ ;;</IDs>
+ ;;<Specialty>
+ ;;<Text>@@ACTORSPECIALITY@@</Text>
+ ;;</Specialty>
+ ;;<Address>
+ ;;<Type>
+ ;;<Text>@@ACTORADDRESSTYPE@@</Text>
+ ;;</Type>
+ ;;<Line1>@@ACTORADDRESSLINE1@@</Line1>
+ ;;<City>@@ACTORADDRESSCITY@@</City>
+ ;;<State>@@ACTORADDRESSSTATE@@</State>
+ ;;<PostalCode>@@ACTORPOSTALCODE@@</PostalCode>
+ ;;</Address>
+ ;;<Telephone>
+ ;;<Value>@@ACTORTELEPHONE@@</Value>
+ ;;<Type>
+ ;;<Text>@@ACTORTELEPHONETYPE@@</Text>
+ ;;</Type>
+ ;;</Telephone>
+ ;;<Email>
+ ;;<Value>@@ACTOREMAIL@@</Value>
+ ;;</Email>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ACTORSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Actor>
+ ;;</ACTOR-PROVIDER>
+ ;;<ACTOR-ORG>
+ ;;<Actor>
+ ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
+ ;;<Organization>
+ ;;<Name>@@ORGANIZATIONNAME@@</Name>
+ ;;</Organization>
+ ;;<Source>
+ ;;<Actor>
+ ;;<ActorID>@@ACTORSOURCEID@@</ActorID>
+ ;;</Actor>
+ ;;</Source>
+ ;;</Actor>
+ ;;</ACTOR-ORG>
+ ;;</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>
Index: ccr/trunk/p/GPLCCD.m
===================================================================
--- ccr/trunk/p/GPLCCD.m	(revision 391)
+++ 	(revision )
@@ -1,272 +1,0 @@
-C0CCCD   ; CCDCCR/GPL - CCD MAIN PROCESSING; 6/6/08
- ;;0.1;CCDCCR;nopatch;noreleasedate
- ;Copyright 2008,2009 George Lilly, University of Minnesota.
- ;Licensed under the terms of the GNU General Public License.
- ;See attached copy of the License.
- ;
- ;This program is free software; you can redistribute it and/or modify
- ;it under the terms of the GNU General Public License as published by
- ;the Free Software Foundation; either version 2 of the License, or
- ;(at your option) any later version.
- ;
- ;This program is distributed in the hope that it will be useful,
- ;but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- ;GNU General Public License for more details.
- ;
- ;You should have received a copy of the GNU General Public License along
- ;with this program; if not, write to the Free Software Foundation, Inc.,
- ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- ;
- ; EXPORT A CCR
- ;
-EXPORT   ; EXPORT ENTRY POINT FOR CCR
-       ; Select a patient.
-       S DIC=2,DIC(0)="AEMQ" D ^DIC
-       I Y<1 Q  ; EXIT
-       S DFN=$P(Y,U,1) ; SET THE PATIENT
-       D XPAT(DFN,"","") ; EXPORT TO A FILE
-       Q
-       ;
-XPAT(DFN,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
-       ; DIR IS THE DIRECTORY, DEFAULTS IF NULL TO ^TMP("C0CCCR","ODIR")
-       ; FN IS FILE NAME, DEFAULTS IF NULL
-       ; N CCDGLO
-       D CCDRPC(.CCDGLO,DFN,"CCD","","","")
-       S OARY=$NA(^TMP("C0CCCR",$J,DFN,"CCD",1))
-       S ONAM=FN
-       I FN="" S ONAM="PAT_"_DFN_"_CCD_V1.xml"
-       S ODIRGLB=$NA(^TMP("C0CCCR","ODIR"))
-       I '$D(@ODIRGLB) D  ; IF NOT ODIR HAS BEEN SET
-       . S @ODIRGLB="/home/glilly/CCROUT"
-       . ;S @ODIRGLB="/home/cedwards/"
-       . ;S @ODIRGLB="/opt/wv/p/"
-       S ODIR=DIR
-       I DIR="" S ODIR=@ODIRGLB
-       N ZY
-       S ZY=$$OUTPUT^C0CXPATH(OARY,ONAM,ODIR)
-       W $P(ZY,U,2)
-       Q
-       ;
-CCDRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY)  ;RPC ENTRY POINT FOR CCR OUTPUT
-    ; CCRGRTN IS RETURN ARRAY PASSED BY NAME
-    ; DFN IS PATIENT IEN
-    ; CCRPART IS "CCR" FOR ENTIRE CCR, OR SECTION NAME FOR A PART
-    ;   OF THE CCR BODY.. PARTS INCLUDE "PROBLEMS" "VITALS" ETC
-    ; TIME1 IS STARTING TIME TO INCLUDE - NULL MEANS ALL
-    ; TIME2 IS ENDING TIME TO INCLUDE TIME IS FILEMAN TIME
-    ; - NULL MEANS NOW
-    ; HDRARY IS THE HEADER ARRAY DEFINING THE "FROM" AND
-    ;    "TO" VARIABLES
-    ;    IF NULL WILL DEFAULT TO "FROM" ORGANIZATION AND "TO" DFN
-    I '$D(DEBUG) S DEBUG=0
-    N CCD S CCD=0 ; FLAG FOR PROCESSING A CCD
-    I CCRPART="CCD" S CCD=1 ; WE ARE PROCESSING A CCD
-    S TGLOBAL=$NA(^TMP("C0CCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
-    I CCD S CCDGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCD")) ; GLOBAL FOR THE CCD
-    E  S CCDGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
-    S ACTGLO=$NA(^TMP("C0CCCR",$J,DFN,"ACTORS")) ; GLOBAL FOR ALL ACTORS
-    ; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
-    S CCRGRTN=$NA(^TMP("C0CCCR",$J,DFN,CCRPART)) ; RTN GLO NM OF PART OR ALL
-    I CCD D LOAD^C0CCCD1(TGLOBAL)  ; LOAD THE CCR TEMPLATE
-    E  D LOAD^C0CCCR0(TGLOBAL)  ; LOAD THE CCR TEMPLATE
-    D CP^C0CXPATH(TGLOBAL,CCDGLO) ; COPY THE TEMPLATE TO CCR GLOBAL
-    N CAPSAVE,CAPSAVE2 ; FOR HOLDING THE CCD ROOT LINES
-    S CAPSAVE=@TGLOBAL@(3) ; SAVE THE CCD ROOT
-    S CAPSAVE2=@TGLOBAL@(@TGLOBAL@(0)) ; SAVE LAST LINE OF CCD
-    S @CCDGLO@(3)="<ContinuityOfCareRecord>" ; CAP WITH CCR ROOT
-    S @TGLOBAL@(3)=@CCDGLO@(3) ; CAP THE TEMPLATE TOO
-    S @CCDGLO@(@CCDGLO@(0))="</ContinuityOfCareRecord>" ; FINISH CAP
-    S @TGLOBAL@(@TGLOBAL@(0))="</ContinuityOfCareRecord>" ; FINISH CAP TEMP
-    ;
-    ; DELETE THE BODY, ACTORS AND SIGNATURES SECTIONS FROM GLOBAL
-    ; THESE WILL BE POPULATED AFTER CALLS TO THE XPATH ROUTINES
-    D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Body")
-    D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Actors")
-    I 'CCD D REPLACE^C0CXPATH(CCDGLO,"","//ContinuityOfCareRecord/Signatures")
-    I DEBUG F I=1:1:@CCDGLO@(0) W @CCDGLO@(I),!
-    ;
-    I 'CCD D HDRMAP(CCDGLO,DFN,HDRARY) ; MAP HEADER VARIABLES
-    ; MAPPING THE PATIENT PORTION OF THE CDA HEADER
-    S ZZX="//ContinuityOfCareRecord/recordTarget/patientRole/patient"
-    D QUERY^C0CXPATH(CCDGLO,ZZX,"ACTT1")
-    D PATIENT^C0CACTOR("ACTT1",DFN,"ACTORPATIENT_"_DFN,"ACTT2") ; MAP PATIENT
-    I DEBUG D PARY^C0CXPATH("ACTT2")
-    D REPLACE^C0CXPATH(CCDGLO,"ACTT2",ZZX)
-    I DEBUG D PARY^C0CXPATH(CCDGLO)
-    K ACTT1 K ACCT2
-    ; MAPPING THE PROVIDER ORGANIZATION,AUTHOR,INFORMANT,CUSTODIAN CDA HEADER
-    ; FOR NOW, THEY ARE ALL THE SAME AND RESOLVE TO ORGANIZATION
-    D ORG^C0CACTOR(CCDGLO,DFN,"ACTORPATIENTORGANIZATION","ACTT2") ; MAP ORG
-    D CP^C0CXPATH("ACTT2",CCDGLO)
-    ;
-    K ^TMP("C0CCCR",$J,"CCRSTEP") ; KILL GLOBAL PRIOR TO ADDING TO IT
-    S CCRXTAB=$NA(^TMP("C0CCCR",$J,"CCRSTEP")) ; GLOBAL TO STORE CCR STEPS
-    D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
-    N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
-    F I=1:1:@CCRXTAB@(0)  D  ; PROCESS THE CCR BODY SECTIONS
-    . S XI=@CCRXTAB@(I) ; CALL COPONENTS TO PARSE
-    . S RTN=$P(XI,";",2) ; NAME OF ROUTINE TO CALL
-    . S TAG=$P(XI,";",1) ; LABEL INSIDE ROUTINE TO CALL
-    . S XPATH=$P(XI,";",3) ; XPATH TO XML TO PASS TO ROUTINE
-    . D QUERY^C0CXPATH(TGLOBAL,XPATH,"INXML") ; EXTRACT XML TO PASS
-    . S IXML="INXML"
-    . I CCD D SHAVE(IXML) ; REMOVE ALL BUT REPEATING PARTS OF TEMPLATE SECTION
-    . S OXML=$P(XI,";",4) ; ARRAY FOR SECTION VALUES
-    . ; W OXML,!
-    . S CALL="D "_TAG_"^"_RTN_"(IXML,DFN,OXML)" ; SETUP THE CALL
-    . W "RUNNING ",CALL,!
-    . X CALL
-    . I @OXML@(0)'=0 D  ; THERE IS A RESULT
-    . . I CCD D QUERY^C0CXPATH(TGLOBAL,XPATH,"ITMP") ; XML TO UNSHAVE WITH
-    . . I CCD D UNSHAVE("ITMP",OXML)
-    . . I CCD D UNMARK^C0CXPATH(OXML) ; REMOVE THE CCR MARKUP FROM SECTION
-    . ; NOW INSERT THE RESULTS IN THE CCR BUFFER
-    . D INSERT^C0CXPATH(CCDGLO,OXML,"//ContinuityOfCareRecord/Body")
-    . I DEBUG F C0CI=1:1:@OXML@(0) W @OXML@(C0CI),!
-    ; NEED TO ADD BACK IN ACTOR PROCESSING AFTER WE FIGURE OUT LINKAGE
-    ; D ACTLST^C0CCCR(CCDGLO,ACTGLO) ; GEN THE ACTOR LIST
-    ; D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Actors","ACTT")
-    ; D EXTRACT^C0CACTOR("ACTT",ACTGLO,"ACTT2")
-    ; D INSINNER^C0CXPATH(CCDGLO,"ACTT2","//ContinuityOfCareRecord/Actors")
-    N I,J,DONE S DONE=0
-    F I=0:0 D  Q:DONE  ; DELETE UNTIL ALL EMPTY ELEMENTS ARE GONE
-    . S J=$$TRIM^C0CXPATH(CCDGLO) ; DELETE EMPTY ELEMENTS
-    . W "TRIMMED",J,!
-    . I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE
-    I CCD D  ; TURN THE BODY INTO A CCD COMPONENT
-    . N I
-    . F I=1:1:@CCDGLO@(0) D  ; SEARCH THROUGH THE ENTIRE ARRAY
-    . . I @CCDGLO@(I)["<Body>" D  ; REPLACE BODY MARKUP
-    . . . S @CCDGLO@(I)="<component><structuredBody>" ; WITH CCD EQ
-    . . I @CCDGLO@(I)["</Body>" D  ; REPLACE BODY MARKUP
-    . . . S @CCDGLO@(I)="</structuredBody></component>"
-    S @CCDGLO@(3)=CAPSAVE ; UNCAP - TURN IT BACK INTO A CCD
-    S @CCDGLO@(@CCDGLO@(0))=CAPSAVE2 ; UNCAP LAST LINE
-    Q
-    ;
-INITSTPS(TAB)  ; INITIALIZE CCR PROCESSING STEPS
-    ; TAB IS PASSED BY NAME
-    W "TAB= ",TAB,!
-    ; ORDER FOR CCR IS PROBLEMS,FAMILYHISTORY,SOCIALHISTORY,MEDICATIONS,VITALSIGNS,RESULTS,HEALTHCAREPROVIDERS
-    D PUSH^C0CXPATH(TAB,"EXTRACT;C0CPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP(""C0CCCR"",$J,DFN,""PROBLEMS"")")
-    ;D PUSH^C0CXPATH(TAB,"EXTRACT;C0CMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""C0CCCR"",$J,DFN,""MEDICATIONS"")")
-    I 'CCD D PUSH^C0CXPATH(TAB,"EXTRACT;C0CVITAL;//ContinuityOfCareRecord/Body/VitalSigns;^TMP(""C0CCCR"",$J,DFN,""VITALS"")")
-    Q
-    ;
-SHAVE(SHXML) ; REMOVES THE 2-6 AND N-1 AND N-2 LINES FROM A COMPONENT
-    ; NEEDED TO EXPOSE THE REPEATING PARTS FOR GENERATION
-    N SHTMP,SHBLD ; TEMP ARRAY AND BUILD LIST
-    W SHXML,!
-    W @SHXML@(1),!
-    D QUEUE^C0CXPATH("SHBLD",SHXML,1,1) ; THE FIRST LINE IS NEEDED
-    D QUEUE^C0CXPATH("SHBLD",SHXML,7,@SHXML@(0)-3) ; REPEATING PART
-    D QUEUE^C0CXPATH("SHBLD",SHXML,@SHXML@(0),@SHXML@(0)) ; LAST LINE
-    D PARY^C0CXPATH("SHBLD") ; PRINT BUILD LIST
-    D BUILD^C0CXPATH("SHBLD","SHTMP") ; BUILD EDITED SECTION
-    D CP^C0CXPATH("SHTMP",SHXML) ; COPY RESULT TO PASSED ARRAY
-    Q
-    ;
-UNSHAVE(ORIGXML,SHXML) ; REPLACES THE 2-6 AND N-1 AND N-2 LINES FROM TEMPLATE
-    ; NEEDED TO RESTORM FIXED TOP AND BOTTOM OF THE COMPONENT XML
-    N SHTMP,SHBLD ; TEMP ARRAY AND BUILD LIST
-    W SHXML,!
-    W @SHXML@(1),!
-    D QUEUE^C0CXPATH("SHBLD",ORIGXML,1,6) ; FIRST 6 LINES OF TEMPLATE
-    D QUEUE^C0CXPATH("SHBLD",SHXML,2,@SHXML@(0)-1) ; INS ALL BUT FIRST/LAST
-    D QUEUE^C0CXPATH("SHBLD",ORIGXML,@ORIGXML@(0)-2,@ORIGXML@(0)) ; FROM TEMP
-    D PARY^C0CXPATH("SHBLD") ; PRINT BUILD LIST
-    D BUILD^C0CXPATH("SHBLD","SHTMP") ; BUILD EDITED SECTION
-    D CP^C0CXPATH("SHTMP",SHXML) ; COPY RESULT TO PASSED ARRAY
-    Q
-    ;
-HDRMAP(CXML,DFN,IHDR)   ; MAP HEADER VARIABLES: FROM, TO ECT
-    N VMAP S VMAP=$NA(^TMP("C0CCCR",$J,DFN,"HEADER"))
-    ; K @VMAP
-    S @VMAP@("DATETIME")=$$FMDTOUTC^CCRUTIL($$NOW^XLFDT,"DT")
-    I IHDR="" D  ; HEADER ARRAY IS NOT PROVIDED, USE DEFAULTS
-    . S @VMAP@("ACTORPATIENT")="ACTORPATIENT_"_DFN
-    . S @VMAP@("ACTORFROM")="ACTORORGANIZATION_"_DUZ ; FROM DUZ - ???
-    . S @VMAP@("ACTORFROM2")="ACTORSYSTEM_1" ; SECOND FROM IS THE SYSTEM
-    . S @VMAP@("ACTORTO")="ACTORPATIENT_"_DFN  ; FOR TEST PURPOSES
-    . S @VMAP@("PURPOSEDESCRIPTION")="CEND PHR"  ; FOR TEST PURPOSES
-    . S @VMAP@("ACTORTOTEXT")="Patient"  ; FOR TEST PURPOSES
-    . ; THIS IS THE USE CASE FOR THE PHR WHERE "TO" IS THE PATIENT
-    I IHDR'="" D  ; HEADER VALUES ARE PROVIDED
-    . D CP^C0CXPATH(IHDR,VMAP) ; COPY HEADER VARIABLES TO MAP ARRAY
-    N CTMP
-    D MAP^C0CXPATH(CXML,VMAP,"CTMP")
-    D CP^C0CXPATH("CTMP",CXML)
-    Q
-    ;
-ACTLST(AXML,ACTRTN) ; RETURN THE ACTOR LIST FOR THE XML IN AXML
-    ; AXML AND ACTRTN ARE PASSED BY NAME
-    ; EACH ACTOR RECORD HAS 3 PARTS - IE IF OBJECTID=ACTORPATIENT_2
-    ; P1= OBJECTID - ACTORPATIENT_2
-    ; P2= OBJECT TYPE - PATIENT OR PROVIDER OR SOFTWARE
-    ;OR INSTITUTION
-    ;  OR PERSON(IN PATIENT FILE IE NOK)
-    ; P3= IEN RECORD NUMBER FOR ACTOR - 2
-    N I,J,K,L
-    K @ACTRTN ; CLEAR RETURN ARRAY
-    F I=1:1:@AXML@(0) D  ; SCAN ALL LINES
-    . I @AXML@(I)?.E1"<ActorID>".E D  ; THERE IS AN ACTOR THIS LINE
-    . . S J=$P($P(@AXML@(I),"<ActorID>",2),"</ActorID>",1)
-    . . W "<ActorID>=>",J,!
-    . . I J'="" S K(J)="" ; HASHING ACTOR
-    . . ;  TO GET RID OF DUPLICATES
-    S I="" ; GOING TO $O THROUGH THE HASH
-    F J=0:0 D  Q:$O(K(I))=""  ;
-    . S I=$O(K(I)) ; WALK THROUGH THE HASH OF ACTORS
-    . S $P(L,U,1)=I ; FIRST PIECE IS THE OBJECT ID
-    . S $P(L,U,2)=$P($P(I,"ACTOR",2),"_",1) ; ACTOR TYPE
-    . S $P(L,U,3)=$P(I,"_",2) ; IEN RECORD NUMBER FOR ACTOR
-    . D PUSH^C0CXPATH(ACTRTN,L) ; ADD THE ACTOR TO THE RETURN ARRAY
-    Q
-    ;
-TEST ; RUN ALL THE TEST CASES
-  D TESTALL^C0CUNIT("C0CCCR")
-  Q
-  ;
-ZTEST(WHICH)  ; RUN ONE SET OF TESTS
-  N ZTMP
-  D ZLOAD^C0CUNIT("ZTMP","C0CCCR")
-  D ZTEST^C0CUNIT(.ZTMP,WHICH)
-  Q
-  ;
-TLIST  ; LIST THE TESTS
-  N ZTMP
-  D ZLOAD^C0CUNIT("ZTMP","C0CCCR")
-  D TLIST^C0CUNIT(.ZTMP)
-  Q
-  ;
- ;;><TEST>
- ;;><PROBLEMS>
- ;;>>>K C0C S C0C=""
- ;;>>>D CCRRPC^C0CCCR(.C0C,"2","PROBLEMS","","","")
- ;;>>?@C0C@(@C0C@(0))["</Problems>"
- ;;><VITALS>
- ;;>>>K C0C S C0C=""
- ;;>>>D CCRRPC^C0CCCR(.C0C,"2","VITALS","","","")
- ;;>>?@C0C@(@C0C@(0))["</VitalSigns>"
- ;;><CCR>
- ;;>>>K C0C S C0C=""
- ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCR","","","")
- ;;>>?@C0C@(@C0C@(0))["</ContinuityOfCareRecord>"
- ;;><ACTLST>
- ;;>>>K C0C S C0C=""
- ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCR","","","")
- ;;>>>D ACTLST^C0CCCR(C0C,"ACTTEST")
- ;;><ACTORS>
- ;;>>>D ZTEST^C0CCCR("ACTLST")
- ;;>>>D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Actors","G2")
- ;;>>>D EXTRACT^C0CACTOR("G2","ACTTEST","G3")
- ;;>>?G3(G3(0))["</Actors>"
- ;;><TRIM>
- ;;>>>D ZTEST^C0CCCR("CCR")
- ;;>>>W $$TRIM^C0CXPATH(CCDGLO)
- ;;><CCD>
- ;;>>>K C0C S C0C=""
- ;;>>>D CCRRPC^C0CCCR(.C0C,"2","CCD","","","")
- ;;>>?@C0C@(@C0C@(0))["</ContinuityOfCareRecord>"
- ;;></TEST>
Index: ccr/trunk/p/GPLCCR0.m
===================================================================
--- ccr/trunk/p/GPLCCR0.m	(revision 391)
+++ 	(revision )
@@ -1,785 +1,0 @@
-GPLCCR0 ; CCDCCR/GPL - CCR TEMPLATE AND ACCESS ROUTINES; 5/31/08
- ;;0.1;CCDCCR;nopatch;noreleasedate
- ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
- ;General Public License See attached copy of the License.
- ;
- ;This program is free software; you can redistribute it and/or modify
- ;it under the terms of the GNU General Public License as published by
- ;the Free Software Foundation; either version 2 of the License, or
- ;(at your option) any later version.
- ;
- ;This program is distributed in the hope that it will be useful,
- ;but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- ;GNU General Public License for more details.
- ;
- ;You should have received a copy of the GNU General Public License along
- ;with this program; if not, write to the Free Software Foundation, Inc.,
- ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- ;
- 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.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@@</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>@@ACTORTOTEXT@@</Text>
- ;;</ActorRole>
- ;;</ActorLink>
- ;;</To>
- ;;<Purpose>
- ;;<Description>
- ;;<Text>@@PURPOSEDESCRIPTION@@</Text>
- ;;</Description>
- ;;</Purpose>
- ;;<Body>
- ;;<Problems>
- ;;<Problem>
- ;;<CCRDataObjectID>@@PROBLEMOBJECTID@@</CCRDataObjectID>
- ;;<Type>
- ;;<Text>Problem</Text>
- ;;</Type>
- ;;<Status>
- ;;<Text>@@PROBLEMSTATUS@@</Text>
- ;;</Status>
- ;;<Description>
- ;;<Text>@@PROBLEMDESCRIPTION@@</Text>
- ;;<Code>
- ;;<Value>@@PROBLEMCODEVALUE@@</Value>
- ;;<CodingSystem>ICD9CM</CodingSystem>
- ;;<Version>@@PROBLEMCODINGVERSION@@</Version>
- ;;</Code>
- ;;</Description>
- ;;<DateTime>
- ;;<ExactDateTime>@@PROBLEMDATEMOD@@</ExactDateTime>
- ;;</DateTime>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@PROBLEMSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Problem>
- ;;</Problems>
- ;;<Immunizations>
- ;;<Immunization>
- ;;<CCRDataObjectID>@@IMMUNEOBJECTID@@</CCRDataObjectID>
- ;;<DateTime>
- ;;<Type>
- ;;<Text>@@IMMUNEDATETIMETYPETEXT@@</Text>
- ;;</Type>
- ;;<ExactDateTime>@@IMMUNEDATETIME@@</ExactDateTime>
- ;;</DateTime>
- ;;<Source><Actor><ActorID>@@IMMUNESOURCEACTORID@@</ActorID></Actor></Source>
- ;;<Product>
- ;;<ProductName>
- ;;<Text>@@IMMUNEPRODUCTNAMETEXT@@</Text>
- ;;<Code>
- ;;<Value>@@IMMUNEPRODUCTCODE@@</Value>
- ;;<CodingSystem>@@IMMUNEPRODUCTCODESYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</ProductName>
- ;;</Product>
- ;;</Immunization>
- ;;</Immunizations>
- ;;<FamilyHistory>
- ;;<FamilyProblemHistory>
- ;;<CCRDataObjectID>@@FAMILYHISTORYOBJECTID@@</CCRDataObjectID>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@FAMILYHISTORYACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<FamilyMember>
- ;;<ActorID>@@FAMILYMEMBERACTORID@@</ActorID>
- ;;<ActorRole>
- ;;<Text>@@FAMILYMEMBERACTORROLETEXT@@</Text>
- ;;</ActorRole>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@FAMILYMEMBERSOURCACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</FamilyMember>
- ;;<Problem>
- ;;<Type>
- ;;<Text>Problem</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@FAMILYMEMBERPROBLEMDESCRIPTION@@</Text>
- ;;<Code>
- ;;<Value>@@FAMILYMEMBERPROBLEMCODE@@</Value>
- ;;<CodingSystem>@@FAMILYMEMBERCODESYSTEM@@</CodingSystem>
- ;;<Version>@@FAMILYMEMBERCODEVERSION@@</Version>
- ;;</Code>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@FAMILYMEMBERPROBLEMSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Problem>
- ;;</FamilyProblemHistory>
- ;;</FamilyHistory>
- ;;<SocialHistory>
- ;;<SocialHistoryElement>
- ;;<CCRDataObjectID>@@SOCIALHISTORYOBJECTID@@</CCRDataObjectID>
- ;;<Type>
- ;;<Text>@@SOCIALHISTORYTYPETEXT@@</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@SOCIALHISTORYDESCRIPTIONTEXT@@</Text>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@SOCIALHISTORYSOURCACTORID@@</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>
- ;;<Alerts>
- ;;<Alert>
- ;;<CCRDataObjectID>@@ALERTOBJECTID@@</CCRDataObjectID>
- ;;<Type>
- ;;<Text>@@ALERTTYPE@@</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@ALERTDESCRIPTIONTEXT@@</Text>
- ;;<Code>
- ;;<Value>@@ALERTCODEVALUE@@</Value>
- ;;<CodingSystem>@@ALERTCODESYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</Description>
- ;;<Status>
- ;;<Text>@@ALERTSTATUSTEXT@@</Text>
- ;;</Status>
- ;;<DateTime>
- ;;<ExactDateTime>@@ALERTDATETIME@@</ExactDateTime>
- ;;</DateTime>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ALERTSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<Agent>
- ;;<Products>
- ;;<Product>
- ;;<CCRDataObjectID>@@ALERTAGENTPRODUCTOBJECTID@@</CCRDataObjectID>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ALERTAGENTPRODUCTSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<ProductName>
- ;;<Text>@@ALERTAGENTPRODUCTNAMETEXT@@</Text>
- ;;<Code>
- ;;<Value>@@ALERTAGENTPRODUCTCODEVALUE@@</Value>
- ;;<CodingSystem>@@ALERTAGENTPRODUCTCODESYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</ProductName>
- ;;</Product>
- ;;</Products>
- ;;</Agent>
- ;;<Reaction>
- ;;<Description>
- ;;<Text>@@ALERTREACTIOINDESCRIPTIONTEXT@@</Text>
- ;;<Code>
- ;;<Value>@@ALERTREACTIONCODEVALUE@@</Value>
- ;;<CodingSystem>@@ALERTREACTIONCODESYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</Description>
- ;;</Reaction>
- ;;</Alert>
- ;;</Alerts>
- ;;<Medications>
- ;;<Medication>
- ;;<CCRDataObjectID>@@MEDOBJECTID@@</CCRDataObjectID>
- ;;<DateTime>
- ;;<Type>
- ;;<Text>@@MEDISSUEDATETXT@@</Text>
- ;;</Type>
- ;;<ExactDateTime>@@MEDISSUEDATE@@</ExactDateTime>
- ;;<Type>
- ;;<Text>@@MEDLASTFILLDATETXT@@</Text>
- ;;</Type>
- ;;<ExactDateTime>@@MEDLASTFILLDATE@@</ExactDateTime>
- ;;</DateTime>
- ;;<IDs>
- ;;<Type>
- ;;<Text>@@MEDRXNOTXT@@</Text>
- ;;</Type>
- ;;<ID>@@MEDRXNO@@</ID>
- ;;</IDs>
- ;;<Type>
- ;;<Text>@@MEDTYPETEXT@@</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@MEDDETAILUNADORNED@@</Text>
- ;;</Description>
- ;;<Status>
- ;;<Text>@@MEDSTATUSTEXT@@</Text>
- ;;</Status>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@MEDSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<Product>
- ;;<ProductName>
- ;;<Text>@@MEDPRODUCTNAMETEXT@@</Text>
- ;;<Code>
- ;;<Value>@@MEDPRODUCTNAMECODEVALUE@@</Value>
- ;;<CodingSystem>@@MEDPRODUCTNAMECODINGINGSYSTEM@@</CodingSystem>
- ;;<Version>@@MEDPRODUCTNAMECODEVERSION@@</Version>
- ;;</Code>
- ;;</ProductName>
- ;;<BrandName>
- ;;<Text>@@MEDBRANDNAMETEXT@@</Text>
- ;;</BrandName>
- ;;<Strength>
- ;;<Value>@@MEDSTRENGTHVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDSTRENGTHUNIT@@</Unit>
- ;;</Units>
- ;;</Strength>
- ;;<Form>
- ;;<Text>@@MEDFORMTEXT@@</Text>
- ;;</Form>
- ;;<Concentration>
- ;;<Value>@@MEDCONCVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDCONCUNIT@@</Unit>
- ;;</Units>
- ;;</Concentration>
- ;;</Product>
- ;;<Quantity>
- ;;<Value>@@MEDQUANTITYVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDQUANTITYUNIT@@</Unit>
- ;;</Units>
- ;;</Quantity>
- ;;<Directions>
- ;;<Direction>
- ;;<Description>
- ;;<Text>@@MEDDIRECTIONDESCRIPTIONTEXT@@</Text>
- ;;</Description>
- ;;<DoseIndicator>
- ;;<Text>@@MEDDOSEINDICATOR@@</Text>
- ;;</DoseIndicator>
- ;;<DeliveryMethod>
- ;;<Text>@@MEDDELIVERYMETHOD@@</Text>
- ;;</DeliveryMethod>
- ;;<Dose>
- ;;<Value>@@MEDDOSEVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDDOSEUNIT@@</Unit>
- ;;</Units>
- ;;<Rate>
- ;;<Value>@@MEDRATEVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDRATEUNIT@@</Unit>
- ;;</Units>
- ;;</Rate>
- ;;</Dose>
- ;;<Vehicle>
- ;;<Text>@@MEDVEHICLETEXT@@</Text>
- ;;</Vehicle>
- ;;<Route>
- ;;<Text>@@MEDDIRECTIONROUTETEXT@@</Text>
- ;;</Route>
- ;;<Frequency>
- ;;<Value>@@MEDFREQUENCYVALUE@@</Value>
- ;;</Frequency>
- ;;<Interval>
- ;;<Value>@@MEDINTERVALVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDINTERVALUNIT@@</Unit>
- ;;</Units>
- ;;</Interval>
- ;;<Duration>
- ;;<Value>@@MEDDURATIONVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@MEDDURATIONUNIT@@</Unit>
- ;;</Units>
- ;;</Duration>
- ;;<Indication>
- ;;<PRNFlag>
- ;;<Text>@@MEDPRNFLAG@@</Text>
- ;;</PRNFlag>
- ;;<Problem>
- ;;<CCRDataObjectID>@@MEDPROBLEMOBJECTID@@</CCRDataObjectID>
- ;;<Type>
- ;;<Text>@@MEDPROBLEMTYPETXT@@</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@MEDPROBLEMDESCRIPTION@@</Text>
- ;;<Code>
- ;;<Value>@@MEDPROBLEMCODEVALUE@@</Value>
- ;;<CodingSystem>@@MEDPROBLEMCODINGSYSTEM@@</CodingSystem>
- ;;<Version>@@MEDPROBLEMCODINGVERSION@@</Version>
- ;;</Code>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@MEDPROBLEMSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Problem>
- ;;</Indication>
- ;;<StopIndicator>
- ;;<Text>@@MEDSTOPINDICATOR@@</Text>
- ;;</StopIndicator>
- ;;<DirectionSequenceModifier>@@MEDDIRSEQ@@</DirectionSequenceModifier>
- ;;<MultipleDirectionModifier>
- ;;<Text>@@MEDMULDIRMOD@@</Text>
- ;;</MultipleDirectionModifier>
- ;;</Direction>
- ;;</Directions>
- ;;<PatientInstructions>
- ;;<Instruction>@@MEDPTINSTRUCTIONS@@</Instruction>
- ;;</PatientInstructions>
- ;;<FullfillmentInstructions>
- ;;<Text>@@MEDFULLFILLMENTINSTRUCTIONS@@</Text>
- ;;</FullfillmentInstructions>
- ;;<Refills>
- ;;<Refill>
- ;;<Number>@@MEDRFNO@@</Number>
- ;;</Refill>
- ;;</Refills>
- ;;</Medication>
- ;;</Medications>
- ;;<VitalSigns>
- ;;<Result>
- ;;<CCRDataObjectID>@@VITALSIGNSDATAOBJECTID@@</CCRDataObjectID>
- ;;<DateTime>
- ;;<Type>
- ;;<Text>@@VITALSIGNSDATETIMETYPETEXT@@</Text>
- ;;</Type>
- ;;<ExactDateTime>@@VITALSIGNSEXACTDATETIME@@</ExactDateTime>
- ;;</DateTime>
- ;;<Description>
- ;;<Text>@@VITALSIGNSDESCRIPTIONTEXT@@</Text>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@VITALSIGNSSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<Test>
- ;;<CCRDataObjectID>@@VITALSIGNSTESTOBJECTID@@</CCRDataObjectID>
- ;;<Type>
- ;;<Text>@@VITALSIGNSTESTTYPETEXT@@</Text>
- ;;</Type>
- ;;<Description>
- ;;<Text>@@VITALSIGNSDESCRIPTIONTEXT@@</Text>
- ;;<Code>
- ;;<Value>@@VITALSIGNSDESCCODEVALUE@@</Value>
- ;;<CodingSystem>@@VITALSIGNSDESCCODINGSYSTEM@@</CodingSystem>
- ;;<Version>@@VITALSIGNSCODEVERSION@@</Version>
- ;;</Code>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@VITALSIGNSTESTSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<TestResult>
- ;;<Value>@@VITALSIGNSTESTRESULTVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@VITALSIGNSTESTRESULTUNIT@@</Unit>
- ;;</Units>
- ;;</TestResult>
- ;;</Test>
- ;;</Result>
- ;;</VitalSigns>
- ;;<Results>
- ;;<Result>
- ;;<CCRDataObjectID>@@RESULTOBJECTID@@</CCRDataObjectID>
- ;;<DateTime>
- ;;<Type>
- ;;<Text>Assessment Time</Text>
- ;;</Type>
- ;;<ExactDateTime>@@RESULTASSESSMENTDATETIME@@</ExactDateTime>
- ;;</DateTime>
- ;;<Description>
- ;;<Text>@@RESULTDESCRIPTIONTEXT@@</Text>
- ;;<Code>
- ;;<Value>@@RESULTCODE@@</Value>
- ;;<CodingSystem>@@RESULTCODINGSYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</Description>
- ;;<Status>
- ;;<Text>@@RESULTSTATUS@@</Text>
- ;;</Status>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@RESULTSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<Test>
- ;;<CCRDataObjectID>@@RESULTTESTOBJECTID@@</CCRDataObjectID>
- ;;<DateTime>
- ;;<Type>
- ;;<Text>Assessment Time</Text>
- ;;</Type>
- ;;<ExactDateTime>@@RESULTTESTDATETIME@@</ExactDateTime>
- ;;</DateTime>
- ;;<Description>
- ;;<Text>@@RESULTTESTDESCRIPTIONTEXT@@</Text>
- ;;<Code>
- ;;<Value>@@RESULTTESTCODEVALUE@@</Value>
- ;;<CodingSystem>@@RESULTTESTCODINGSYSTEM@@</CodingSystem>
- ;;</Code>
- ;;</Description>
- ;;<Status>
- ;;<Text>@@RESULTTESTSTATUSTEXT@@</Text>
- ;;</Status>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@RESULTTESTSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;<TestResult>
- ;;<Value>@@RESULTTESTVALUE@@</Value>
- ;;<Units>
- ;;<Unit>@@RESULTTESTUNITS@@</Unit>
- ;;</Units>
- ;;</TestResult>
- ;;<NormalResult>
- ;;<Normal>
- ;;<Description>
- ;;<Text>@@RESULTTESTNORMALDESCTEXT@@</Text>
- ;;</Description>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@RESULTTESTNORMALSOURCEACTORID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Normal>
- ;;</NormalResult>
- ;;<Flag>
- ;;<Text>@@RESULTTESTFLAG@@</Text>
- ;;</Flag>
- ;;</Test>
- ;;</Result>
- ;;</Results>
- ;;<HealthCareProviders>
- ;;<Provider>
- ;;<ActorID>AA0005</ActorID>
- ;;<ActorRole>
- ;;<Text>Primary Provider</Text>
- ;;</ActorRole>
- ;;</Provider>
- ;;</HealthCareProviders>
- ;;</Body>
- ;;<Actors>
- ;;<ACTOR-PATIENT>
- ;;<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>
- ;;<Code>
- ;;<Value>@@ACTORGENDER@@</Value>
- ;;<CodingSystem>2.16.840.1.113883.5.1</CodingSystem>
- ;;</Code>
- ;;</Gender>
- ;;</Person>
- ;;<IDs>
- ;;<Type>
- ;;<Text>@@ACTORSSNTEXT@@</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>@@ACTORRESTEL@@</Value>
- ;;<Type>
- ;;<Text>@@ACTORRESTELTEXT@@</Text>
- ;;</Type>
- ;;</Telephone>
- ;;<Telephone>
- ;;<Value>@@ACTORWORKTEL@@</Value>
- ;;<Type>
- ;;<Text>@@ACTORWORKTELTEXT@@</Text>
- ;;</Type>
- ;;</Telephone>
- ;;<Telephone>
- ;;<Value>@@ACTORCELLTEL@@</Value>
- ;;<Type>
- ;;<Text>@@ACTORCELLTELTEXT@@</Text>
- ;;</Type>
- ;;</Telephone>
- ;;<EMail>
- ;;<Value>@@ACTOREMAIL@@</Value>
- ;;</EMail>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ACTORADDRESSSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Actor>
- ;;</ACTOR-PATIENT>
- ;;<ACTOR-SYSTEM>
- ;;<Actor>
- ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
- ;;<InformationSystem>
- ;;<Name>@@ACTORINFOSYSNAME@@</Name>
- ;;<Version>@@ACTORINFOSYSVER@@</Version>
- ;;</InformationSystem>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ACTORINFOSYSSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Actor>
- ;;</ACTOR-SYSTEM>
- ;;<ACTOR-NOK>
- ;;<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-NOK>
- ;;<ACTOR-PROVIDER>
- ;;<Actor>
- ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
- ;;<Person>
- ;;<Name>
- ;;<CurrentName>
- ;;<Given>@@ACTORGIVENNAME@@</Given>
- ;;<Middle>@@ACTORMIDDLENAME@@</Middle>
- ;;<Family>@@ACTORFAMILYNAME@@</Family>
- ;;<Title>@@ACTORTITLE@@</Title>
- ;;</CurrentName>
- ;;</Name>
- ;;</Person>
- ;;<IDs>
- ;;<Type>
- ;;<Text>@@IDTYPE@@</Text>
- ;;</Type>
- ;;<ID>@@ID@@</ID>
- ;;<IssuedBy>
- ;;<Description>
- ;;<Text>@@IDDESC@@</Text>
- ;;</Description>
- ;;</IssuedBy>
- ;;</IDs>
- ;;<Specialty>
- ;;<Text>@@ACTORSPECIALITY@@</Text>
- ;;</Specialty>
- ;;<Address>
- ;;<Type>
- ;;<Text>@@ACTORADDRESSTYPE@@</Text>
- ;;</Type>
- ;;<Line1>@@ACTORADDRESSLINE1@@</Line1>
- ;;<City>@@ACTORADDRESSCITY@@</City>
- ;;<State>@@ACTORADDRESSSTATE@@</State>
- ;;<PostalCode>@@ACTORPOSTALCODE@@</PostalCode>
- ;;</Address>
- ;;<Telephone>
- ;;<Value>@@ACTORTELEPHONE@@</Value>
- ;;<Type>
- ;;<Text>@@ACTORTELEPHONETYPE@@</Text>
- ;;</Type>
- ;;</Telephone>
- ;;<Email>
- ;;<Value>@@ACTOREMAIL@@</Value>
- ;;</Email>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ACTORSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Actor>
- ;;</ACTOR-PROVIDER>
- ;;<ACTOR-ORG>
- ;;<Actor>
- ;;<ActorObjectID>@@ACTOROBJECTID@@</ActorObjectID>
- ;;<Organization>
- ;;<Name>@@ORGANIZATIONNAME@@</Name>
- ;;</Organization>
- ;;<Source>
- ;;<Actor>
- ;;<ActorID>@@ACTORSOURCEID@@</ActorID>
- ;;</Actor>
- ;;</Source>
- ;;</Actor>
- ;;</ACTOR-ORG>
- ;;</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>
