modifications to clean up temp storage after processing

This commit is contained in:
george 2010-10-04 17:46:18 +00:00
parent 768e61605d
commit 30420e775a
5 changed files with 23 additions and 10 deletions

View File

@ -40,7 +40,7 @@ XPAT(DFN,XPARMS,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
I '$D(XPARMS) S XPARMS="" I '$D(XPARMS) S XPARMS=""
N C0CRTN ; RETURN ARRAY N C0CRTN ; RETURN ARRAY
D CCRRPC(.C0CRTN,DFN,XPARMS,"CCR") D CCRRPC(.C0CRTN,DFN,XPARMS,"CCR")
S OARY=$NA(^TMP("C0CCCR",$J,DFN,"CCR",1)) S OARY=$NA(^TMP("C0CCUR",$J,DFN,"CCR",1))
S ONAM=UFN S ONAM=UFN
I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_0.xml" I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_0.xml"
S ODIRGLB=$NA(^TMP("C0CCCR","ODIR")) S ODIRGLB=$NA(^TMP("C0CCCR","ODIR"))
@ -61,7 +61,7 @@ XPAT(DFN,XPARMS,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
DCCR(DFN) ; DISPLAY A CCR THAT HAS JUST BEEN EXTRACTED DCCR(DFN) ; DISPLAY A CCR THAT HAS JUST BEEN EXTRACTED
; ;
N G1 N G1
S G1=$NA(^TMP("C0CCCR",$J,DFN,"CCR")) S G1=$NA(^TMP("C0CCUR",$J,DFN,"CCR"))
I $D(@G1@(0)) D ; CCR EXISTS I $D(@G1@(0)) D ; CCR EXISTS
. D PARY^C0CXPATH(G1) . D PARY^C0CXPATH(G1)
E W "CCR NOT CREATED, RUN D XPAT^C0CCCR(DFN,"""","""") FIRST",! E W "CCR NOT CREATED, RUN D XPAT^C0CCCR(DFN,"""","""") FIRST",!
@ -77,6 +77,8 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
; EXAMPLE: "LABLIMIT:T-60" TO LIMIT LAB EXTRACTION TO THE LAST 60 DAYS ; EXAMPLE: "LABLIMIT:T-60" TO LIMIT LAB EXTRACTION TO THE LAST 60 DAYS
; SEE C0CPARMS FOR A COMPLETE LIST OF SUPPORTED PARAMETERS ; SEE C0CPARMS FOR A COMPLETE LIST OF SUPPORTED PARAMETERS
K ^TMP("C0CCCR",$J) ; CLEAN UP THE GLOBAL BEFORE WE USE IT K ^TMP("C0CCCR",$J) ; CLEAN UP THE GLOBAL BEFORE WE USE IT
M ^TMP("C0CSAV",$J)=^TMP($J) ; SAVING CALLER'S TMP SETTINGS
K ^TMP($J) ; START CLEAN
I '$D(DEBUG) S DEBUG=0 I '$D(DEBUG) S DEBUG=0
S CCD=0 ; NEED THIS FLAG TO DISTINGUISH FROM CCD S CCD=0 ; NEED THIS FLAG TO DISTINGUISH FROM CCD
I '$D(CCRPARMS) S CCRPARMS="" I '$D(CCRPARMS) S CCRPARMS=""
@ -88,7 +90,7 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
I '$D(TESTALERT) S TESTALERT=1 ; FLAG FOR TESTING ALERTS SECTION I '$D(TESTALERT) S TESTALERT=1 ; FLAG FOR TESTING ALERTS SECTION
I '$D(TESTMEDS) S TESTMEDS=0 ; FLAG FOR TESTING C0CMED SECTION I '$D(TESTMEDS) S TESTMEDS=0 ; FLAG FOR TESTING C0CMED SECTION
S TGLOBAL=$NA(^TMP("C0CCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE S TGLOBAL=$NA(^TMP("C0CCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
S CCRGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR S CCRGLO=$NA(^TMP("C0CCUR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
S ACTGLO=$NA(^TMP("C0CCCR",$J,DFN,"ACTORS")) ; GLOBAL FOR ALL ACTORS S ACTGLO=$NA(^TMP("C0CCCR",$J,DFN,"ACTORS")) ; GLOBAL FOR ALL ACTORS
; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC ; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
;M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART OR ALL ;M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART OR ALL
@ -141,9 +143,12 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
. I DEBUG W "TRIMMED",J,! . I DEBUG W "TRIMMED",J,!
. I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE . I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE
;S CCRGRTN=$NA(^TMP("C0CCCR",$J,DFN,CCRPART)) ; RTN GLOBAL OF PART OR ALL ;S CCRGRTN=$NA(^TMP("C0CCCR",$J,DFN,CCRPART)) ; RTN GLOBAL OF PART OR ALL
M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART OR ALL I CCRPART="CCR" M CCRGRTN=@CCRGLO ; ENTIRE CCR
E M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART
I '$D(C0CNRPC) S ^TMP("C0CRPC",$H,"RESULT",CCRGRTN(0))="" I '$D(C0CNRPC) S ^TMP("C0CRPC",$H,"RESULT",CCRGRTN(0))=""
;K ^TMP("C0CCCR",$J) ; BEGIN TO CLEAN UP K ^TMP("C0CCCR",$J) ; BEGIN TO CLEAN UP
K ^TMP($J) ; REALLY CLEAN UP
M ^TMP($J)=^TMP("C0CSAV",$J) ; RESTORE CALLER'S $J
Q Q
; ;
INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS

View File

@ -75,6 +75,7 @@ VISTA
N HIST S HIST=$NA(^TMP($J,"MED","HIST")) ; Meds already dispensed N HIST S HIST=$NA(^TMP($J,"MED","HIST")) ; Meds already dispensed
N PEND S PEND=$NA(^TMP($J,"MED","PEND")) ; Pending Meds N PEND S PEND=$NA(^TMP($J,"MED","PEND")) ; Pending Meds
N NVA S NVA=$NA(^TMP($J,"MED","NVA")) ; non-VA Meds N NVA S NVA=$NA(^TMP($J,"MED","NVA")) ; non-VA Meds
K @HIST K @PEND K @NVA ; MAKE SURE THEY ARE EMPTY
S @HIST@(0)=0,@PEND@(0)=0,@NVA@(0)=0 ; At first, they are all empty... (prevent undefined errors) S @HIST@(0)=0,@PEND@(0)=0,@NVA@(0)=0 ; At first, they are all empty... (prevent undefined errors)
; N IPIV ; Inpatient IV Meds ; N IPIV ; Inpatient IV Meds
; N IPUD ; Inpatient UD Meds ; N IPUD ; Inpatient UD Meds
@ -93,5 +94,12 @@ VISTA
. I @HIST@(0)>0!(@PEND@(0)>0) D INSINNER^C0CXPATH(MEDOUTXML,NVA) . I @HIST@(0)>0!(@PEND@(0)>0) D INSINNER^C0CXPATH(MEDOUTXML,NVA)
. E D CP^C0CXPATH(NVA,MEDOUTXML) . E D CP^C0CXPATH(NVA,MEDOUTXML)
. W:$G(DEBUG) "HAS NON-VA MEDS",! . W:$G(DEBUG) "HAS NON-VA MEDS",!
N ZI
S ZI=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
M ^TMP("C0CRIM","VARS",DFN,"MEDS")=@ZI ; PERSIST MEDS VARIABLES
K @ZI ; CLEAN UP MED MAP AFTER - GPL 10/10
K @PEND
K @HIST
K @NVA
Q Q

View File

@ -257,7 +257,7 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; EXTRACT MEDICATIONS INTO PROVIDE
. I MEDFIRST D ; . I MEDFIRST D ;
. . S MEDFIRST=0 ; RESET FIRST FLAG . . S MEDFIRST=0 ; RESET FIRST FLAG
. . D CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy . . D CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
. D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER XML . D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER
N MEDTMP,MEDI N MEDTMP,MEDI
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@ I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@

View File

@ -104,6 +104,9 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; Extract medications into provided xml temp
. . . M NDFDATA=^TMP($J,"NDF",MEDIEN) . . . M NDFDATA=^TMP($J,"NDF",MEDIEN)
. . . S NDFIEN=$P(NDFDATA(20),U) . . . S NDFIEN=$P(NDFDATA(20),U)
. . . S VAPROD=$P(NDFDATA(22),U) . . . S VAPROD=$P(NDFDATA(22),U)
. . . S @MAP@("MEDPRODUCTNAMETEXT")=$$GET1^DIQ(50.68,VAPROD,.01) ;
. . ; GPL - RESET THE NAME TO THE REAL NAME OF THE DRUG NOW THAT WE
. . ; HAVE IT.
. . ; . . ;
. . ; NDFIEN is not necessarily defined; it won't be if the drug . . ; NDFIEN is not necessarily defined; it won't be if the drug
. . ; is not matched to the national drug file (e.g. if the drug is . . ; is not matched to the national drug file (e.g. if the drug is
@ -255,8 +258,5 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; Extract medications into provided xml temp
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@ I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
. W "MEDICATION MISSING ",! . W "MEDICATION MISSING ",!
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),! . F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
N ZI
S ZI=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
M ^TMP("C0CRIM","VARS",DFN,"MEDS")=@ZI ; PERSIST MEDS VARIABLES
Q Q
; ;

View File

@ -23,7 +23,7 @@ SET(INPARMS) ;INITIALIZE RUNTIME PARMS USING INPARMS TO OVERRIDE DEFAULTS
; ;
N PTMP ; N PTMP ;
S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;BASE FOR THIS RUN S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;BASE FOR THIS RUN
;K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
I $G(INPARMS)'="" D ; OVERRIDES PROVIDED I $G(INPARMS)'="" D ; OVERRIDES PROVIDED
. N C0CI S C0CI="" . N C0CI S C0CI=""
. N C0CN S C0CN=1 . N C0CN S C0CN=1