update to support parameters .. XPAT^GPLCCR(1,"LABSTART:T^LABLIMIT:T-5000")
This commit is contained in:
parent
5ea8987faa
commit
7d4b190641
|
@ -0,0 +1,51 @@
|
|||
GPLPARMS ; CCDCCR/GPL - CCR/CCD PARAMETER PROCESSING ; 1/29/09
|
||||
;;0.3;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.
|
||||
;
|
||||
SET(INPARMS) ;INITIALIZE RUNTIME PARMS USING INPARMS TO OVERRIDE DEFAULTS
|
||||
; PARAMETERS ARE PASSED AS A STRING: "PARM1:VALUE1^PARM2:VALUE2^ETC"
|
||||
; THE SAME FORMAT IS USED BY RPC AND COMMAND LINE ENTRY POINTS
|
||||
;
|
||||
N PTMP ;
|
||||
S C0CPARMS=$NA(^TMP($J,"C0CPARMS")) ;BASE FOR THIS RUN
|
||||
;K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
|
||||
I $G(INPARMS)'="" D ; OVERRIDES PROVIDED
|
||||
. N C0CI S C0CI=""
|
||||
. N C0CN S C0CN=1
|
||||
. F S C0CI=$P(INPARMS,"^",C0CN) Q:C0CI="" D ;
|
||||
. . S C0CN=C0CN+1 ;NEXT PARM
|
||||
. . S @C0CPARMS@($P(C0CI,":",1))=$P(C0CI,":",2) ; SET THE PARM
|
||||
. I C0CN=1 S @C0CPARMS@($P(INPARMS,":",1))=$P(C0CI,":",2) ; ONLY ONE
|
||||
; THIS IS WHERE WE WILL INSERT CALLS TO THE PARAMETER FILE FOR DEFAULTS
|
||||
; IF THEY FAIL, THE FOLLOWING WILL BE HARDCODED DEFAULTS
|
||||
I '$D(@C0CPARMS@("LABLIMIT")) S @C0CPARMS@("LABLIMIT")="T-360" ;ONE YR WORTH
|
||||
I '$D(@C0CPARMS@("LABSTART")) S @C0CPARMS@("LABSTART")="T" ;TODAY
|
||||
Q
|
||||
;
|
||||
CHECK ; CHECK TO SEE IF PARMS ARE PRESENT, ELSE RUN SET
|
||||
;
|
||||
I '$D(C0CPARMS) S C0CPARMS=$NA(^TMP($J,"C0CPARMS")) ;SHOULDN'T HAPPEN
|
||||
I '$D(@C0CPARMS) D SET("SETWITHCHECK:1")
|
||||
Q
|
||||
;
|
||||
GET(WHICHP) ;EXTRINSIC TO RETURN THE VALUE OF PARAMETER WHICHP
|
||||
;
|
||||
D CHECK ; SHOULDN'T HAPPEN BUT TO BE SAFE
|
||||
N GTMP
|
||||
Q $G(@C0CPARMS@(WHICHP)) ;PULL THE PARM FROM THE TABLE
|
||||
;
|
|
@ -37,7 +37,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
; Output of API is ^TMP($J,"SUBSCRIPT",DFN,RXIENS).
|
||||
; D PARY^GPLXPATH(MINXML)
|
||||
N MEDS,MAP
|
||||
K ^TMP($J)
|
||||
K ^TMP($J,"CCDCCR") ; PLEASE DON'T KILL ALL OF ^TMP($J) HERE!!!!
|
||||
D RX^PSO52API(DFN,"CCDCCR")
|
||||
M MEDS=^TMP($J,"CCDCCR",DFN)
|
||||
; @(0) contains the number of meds or -1^NO DATA FOUND
|
||||
|
@ -79,16 +79,16 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
. ; Field 99.99 is the VUID.
|
||||
. ;
|
||||
. ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. ; $$GET1^DIQ.
|
||||
. ;
|
||||
. ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. N MEDIEN S MEDIEN=$P(MED(6),U)
|
||||
. D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. ;
|
||||
. ; 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
|
||||
|
|
10
p/CCRMEDS2.m
10
p/CCRMEDS2.m
|
@ -40,7 +40,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
; the IEN in 52.41, and the Med Name, and route.
|
||||
; So, most of the info is going to get pulled from 52.41.
|
||||
N MEDS,MAP
|
||||
K ^TMP($J)
|
||||
K ^TMP($J,"CCDCCR") ; PLEASE DON'T KILL ALL OF ^TMP($J) HERE!!!!
|
||||
D PEN^PSO5241(DFN,"CCDCCR")
|
||||
M MEDS=^TMP($J,"CCDCCR",DFN)
|
||||
; @(0) contains the number of meds or -1^NO DATA FOUND
|
||||
|
@ -79,7 +79,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. ; NDC not supplied in API, but is rather trivial to obtain
|
||||
. ; MED(11) piece 1 has the IEN of the drug (file 50)
|
||||
. ; IEN is field 31 in the drug file.
|
||||
. ;
|
||||
. ;
|
||||
. ; MEDIEN (node 11 in the returned output) might not necessarily be defined
|
||||
. ; It is not defined when a dose in not chosen in CPRS. There is a long
|
||||
. ; series of fields that depend on it. We will use If and Else to deal
|
||||
|
@ -96,15 +96,15 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. . ; Field 99.99 is the VUID.
|
||||
. . ;
|
||||
. . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; $$GET1^DIQ.
|
||||
. . ;
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ;
|
||||
. . ; 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
|
||||
|
|
11
p/CCRMEDS3.m
11
p/CCRMEDS3.m
|
@ -37,7 +37,8 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
|||
; Will use Fileman API GETS^DIQ
|
||||
;
|
||||
N MEDS,MAP
|
||||
K ^TMP($J),NVA
|
||||
K ^TMP($J,"CCDCCR") ; PLEASE DON'T KILL ALL OF ^TMP($J) HERE!!!!
|
||||
K NVA
|
||||
D GETS^DIQ(55,DFN,"52.2*","IE","NVA") ; Output in NVA in FDA array format.
|
||||
; If NVA does not exist, then patient has no non-VA meds
|
||||
I $D(NVA)=0 S @OUTXML@(0)=0 QUIT
|
||||
|
@ -89,15 +90,15 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
|||
. . ; Field 99.99 is the VUID.
|
||||
. . ;
|
||||
. . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; $$GET1^DIQ.
|
||||
. . ;
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ;
|
||||
. . ; 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
|
||||
|
@ -129,7 +130,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
|||
. . ; NDF Entry IEN, and VA Product Name
|
||||
. . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
|
||||
. . ; Documented in the same manual; executed above.
|
||||
. . ;
|
||||
. . ;
|
||||
. . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
|
||||
. . ; and this will crash the call. So...
|
||||
. . I NDFIEN="" S CONCDATA=""
|
||||
|
|
26
p/GPLCCR.m
26
p/GPLCCR.m
|
@ -24,10 +24,10 @@ EXPORT ; EXPORT ENTRY POINT FOR CCR
|
|||
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
|
||||
D XPAT(DFN) ; EXPORT TO A FILE
|
||||
Q
|
||||
;
|
||||
XPAT(DFN,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
|
||||
XPAT(DFN,XPARMS,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
|
||||
; DIR IS THE DIRECTORY, DEFAULTS IF NULL TO ^TMP("GPLCCR","ODIR")
|
||||
; FN IS FILE NAME, DEFAULTS IF NULL
|
||||
N CCRGLO,UDIR,UFN
|
||||
|
@ -35,10 +35,11 @@ XPAT(DFN,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
|
|||
E S UDIR=DIR
|
||||
I '$D(FN) S UFN=""
|
||||
E S UFN=FN
|
||||
D CCRRPC(.CCRGLO,DFN,"CCR","","","")
|
||||
I '$D(XPARMS) S XPARMS=""
|
||||
D CCRRPC(.CCRGLO,DFN,XPARMS,"CCR")
|
||||
S OARY=$NA(^TMP("GPLCCR",$J,DFN,"CCR",1))
|
||||
S ONAM=UFN
|
||||
I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_12.xml"
|
||||
I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_14.xml"
|
||||
S ODIRGLB=$NA(^TMP("GPLCCR","ODIR"))
|
||||
I '$D(@ODIRGLB) D ; IF NOT ODIR HAS BEEN SET
|
||||
. ;S @ODIRGLB="/home/glilly/CCROUT"
|
||||
|
@ -60,19 +61,18 @@ DCCR(DFN) ; DISPLAY A CCR THAT HAS JUST BEEN EXTRACTED
|
|||
E W "CCR NOT CREATED, RUN D XPAT^GPLCCR(DFN,"""","""") FIRST",!
|
||||
Q
|
||||
;
|
||||
CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT
|
||||
CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;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" DUZ AND "TO" DFN
|
||||
; CCRPARMS ARE PARAMETERS THAT AFFECT THE EXTRACTION
|
||||
; IN THE FORM "PARM1:VALUE1^PARM2:VALUE2"
|
||||
; EXAMPLE: "LABLIMIT:T-60" TO LIMIT LAB EXTRACTION TO THE LAST 60 DAYS
|
||||
; SEE C0CPARMS FOR A COMPLETE LIST OF SUPPORTED PARAMETERS
|
||||
I '$D(DEBUG) S DEBUG=0
|
||||
S CCD=0 ; NEED THIS FLAG TO DISTINGUISH FROM CCD
|
||||
D SET^C0CPARMS(XPARMS) ;SET PARAMETERS WITH XPARMS AS OVERRIDES
|
||||
I '$D(TESTLAB) S TESTLAB=0 ; FLAG FOR TESTING RESULTS SECTION
|
||||
I '$D(TESTALERT) S TESTALERT=1 ; FLAG FOR TESTING ALERTS SECTION
|
||||
I '$D(TESTMEDS) S TESTMEDS=0 ; FLAG FOR TESTING CCRMEDS SECTION
|
||||
|
@ -91,7 +91,7 @@ CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT
|
|||
D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Signatures")
|
||||
I DEBUG F I=1:1:@CCRGLO@(0) W @CCRGLO@(I),!
|
||||
;
|
||||
D HDRMAP(CCRGLO,DFN,HDRARY) ; MAP HEADER VARIABLES
|
||||
D HDRMAP(CCRGLO,DFN) ; MAP HEADER VARIABLES
|
||||
;
|
||||
K ^TMP("GPLCCR",$J,"CCRSTEP") ; KILL GLOBAL PRIOR TO ADDING TO IT
|
||||
S CCRXTAB=$NA(^TMP("GPLCCR",$J,"CCRSTEP")) ; GLOBAL TO STORE CCR STEPS
|
||||
|
@ -137,7 +137,7 @@ INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
|
|||
I TESTALERT D PUSH^GPLXPATH(TAB,"EXTRACT;GPLALERT;//ContinuityOfCareRecord/Body/Alerts;^TMP(""GPLCCR"",$J,DFN,""ALERTS"")")
|
||||
Q
|
||||
;
|
||||
HDRMAP(CXML,DFN,IHDR) ; MAP HEADER VARIABLES: FROM, TO ECT
|
||||
HDRMAP(CXML,DFN) ; MAP HEADER VARIABLES: FROM, TO ECT
|
||||
N VMAP S VMAP=$NA(^TMP("GPLCCR",$J,DFN,"HEADER"))
|
||||
; K @VMAP
|
||||
S @VMAP@("DATETIME")=$$FMDTOUTC^CCRUTIL($$NOW^XLFDT,"DT")
|
||||
|
|
20
p/GPLLABS.m
20
p/GPLLABS.m
|
@ -142,12 +142,14 @@ GHL7 ; GET HL7 MESSAGE FOR LABS FOR THIS PATIENT
|
|||
. W "LAB LOOKUP FAILED, NO SSN",!
|
||||
. S C0CNSSN=1 ; SET NO SSN FLAG
|
||||
S C0CSPC="*" ; LOOKING FOR ALL LAB TYPES
|
||||
I $D(^TMP("GPLCCR","LABLIMIT")) D ; IS LAB LIMIT SET? MOVE THIS TO PARMS
|
||||
. S C0CLLMT=^TMP("GPLCCR","LABLIMIT") ;USE THE LAB LIMIT PARAMATER
|
||||
E S C0CLLMT="T-360" ;START DATE LONG AGO TO GET EVERYTHING
|
||||
D DT^DILF(,C0CLLMT,.C0CSDT) ;
|
||||
;I $D(^TMP("GPLCCR","LABLIMIT")) D ; IS LAB LIMIT SET? MOVE THIS TO PARMS
|
||||
;. S C0CLLMT=^TMP("GPLCCR","LABLIMIT") ;USE THE LAB LIMIT PARAMATER
|
||||
;E S C0CLLMT="T-360" ;START DATE LONG AGO TO GET EVERYTHING
|
||||
S C0CLLMT=$$GET^C0CPARMS("LABLIMIT") ; GET THE LIMIT PARM
|
||||
S C0CLSTRT=$$GET^C0CPARMS("LABSTART") ; GET START PARM
|
||||
D DT^DILF(,C0CLLMT,.C0CSDT) ;
|
||||
W "LAB LIMIT: ",C0CLLMT,!
|
||||
D DT^DILF(,"T",.C0CEDT) ; END DATE TODAY - IMPLEMENT END DATE PARM
|
||||
D DT^DILF(,C0CLSTRT,.C0CEDT) ; END DATE TODAY - IMPLEMENT END DATE PARM
|
||||
S C0CR=$$GCPR^LA7QRY(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
|
||||
Q
|
||||
;
|
||||
|
@ -158,9 +160,9 @@ LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
|
|||
I '$D(C0CQT) S C0CQT=0
|
||||
I '$D(DFN) S DFN=1 ; DEFAULT TEST PATIENT
|
||||
I '$D(^KVAI(0)) D SETTBL ; INITIALIZE LAB TABLE
|
||||
I ^KBAI(0)'="V2" D SETTBL ; NEED NEWEST VERSION
|
||||
I ^TMP("GPLCCR","LABTBL",0)'="V2" D SETTBL ; NEED NEWEST VERSION
|
||||
I '$D(^TMP("HLS",$J,1)) D GHL7 ; GET HL7 MGS IF NOT ALREADY DONE
|
||||
S C0CTAB=$NA(^KBAI) ; BASE OF OBX TABLE
|
||||
S C0CTAB=$NA(^TMP("GPLCCR","LABTBL")) ; BASE OF OBX TABLE
|
||||
S C0CHB=$NA(^TMP("HLS",$J))
|
||||
S C0CI=""
|
||||
S @C0CLB@(0)=0 ; INITALIZE RESULTS VARS COUNT
|
||||
|
@ -376,7 +378,7 @@ SETTBL ;
|
|||
S X("OBX","OBX15")="15^00583^Producer.s ID^RESULTTESTSOURCEACTORID"
|
||||
S X("OBX","OBX16")="16^00584^Responsible Observer"
|
||||
S X("OBX","OBX17")="17^00936^Observation Method"
|
||||
M ^KBAI=X ; SET VALUES IN ^KBAI
|
||||
S ^KBAI(0)="V2"
|
||||
M ^TMP("GPLCCR","LABTBL")=X ; SET VALUES IN ^TMP("GPLCCR","LABTBL")
|
||||
S ^TMP("GPLCCR","LABTBL",0)="V2"
|
||||
Q
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue