improved CCR ELEMENT interface

This commit is contained in:
george 2009-02-10 00:16:47 +00:00
parent 783219e67b
commit 128dd39535
1 changed files with 25 additions and 13 deletions

View File

@ -17,7 +17,7 @@ C0CFM1 ; CCDCCR/GPL - CCR FILEMAN utilities; 12/6/08
;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 the CCR RXNORM Utility Library ",!
W "This is the CCR FILEMAN Utility Library ",!
W !
Q
;
@ -31,17 +31,17 @@ PUTRIM(DFN,ZWHICH) ;DFN IS PATIENT , WHICH IS ELEMENT TYPE
E D ; MULTIPLE SECTIONS
. S C0CVARS=$NA(@C0CGLB)
. S C0CI=""
. F S C0CI=$O(C0CVARS(C0CI)) Q:C0CI="" D ;FOR EACH SECTION
. . S C0CVARSN=$NA(C0CVARS(C0CI)) ; GRAB ONE SECTION
. F S C0CI=$O(@C0CVARS@(C0CI)) Q:C0CI="" D ;FOR EACH SECTION
. . S C0CVARSN=$NA(@C0CVARS@(C0CI)) ; GRAB ONE SECTION
. . D PUTRIM1(DFN,C0CI,C0CVARSN)
Q
;
PUTRIM1(DFN,ZZTYP,ZVARS) ;INTERNAL TO PUTRIM FOR ONE SECTION
PUTRIM1(DFN,ZZTYP,ZVARS) ; PUT ONE SECTION OF VARIABLES INTO CCR ELEMENTS
; ZVARS IS PASSED BY NAME AN HAS THE FORM @ZVARS@(1,"VAR1")="VAL1"
S C0CX=0
F S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX=2 D ; FOR EACH OCCURANCE
F S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX="" D ; FOR EACH OCCURANCE
. W "ZOCC=",C0CX,!
. S C0CV=$NA(@ZVARS@(C0CX)) ; VARIABLES FOR THIS OCCURANCE
. B
. D PUTELS(DFN,ZZTYP,C0CX,C0CV) ; PUT THEM TO THE CCR ELEMENTS FILE
Q
;
@ -55,23 +55,35 @@ PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
;
S ZSRC=1 ; CCR SOURCE IS ASSUMED TO BE THIS EHR, WHICH IS ALWAYS SOURCE 1
; PUT THIS IN PARAMETERS - SO SOURCE NUMBER FOR PROCESSING IN CONFIGURABLE
N ZF,ZSUBF S ZF=171.201 S ZSUBF=171.20122 ;FILE AND SUBFILE NUMBERS
N ZF,ZFV S ZF=171.201 S ZFV=171.2012
S ZSUBF=171.20122 ;FILE AND SUBFILE NUMBERS
N ZSFV S ZSFV=171.201221 ; SUBFILE VARIABLE FILE NUMBER
N ZTYPN S ZTYPN=$O(^C0CDIC(170.101,"B",ZTYPE,""))
W "ZTYPE: ",ZTYPE," ",ZTYPN,!
N ZVARN ; IEN OF VARIABLE BEING PROCESSED
;N C0CFDA ; FDA FOR CCR ELEMENT UPDATE
S C0CFDA(ZF,"+1,",.01)=DFN
S C0CFDA(ZF,"+1,"_DFN_",",.02)=ZSRC
S C0CFDA(ZF,"+1,"_DFN_","_ZSRC_",",.03)=ZTYPN
S C0CFDA(ZF,"+1,"_DFN_","_ZSRC_","_ZTYPN_",",.04)=ZOCC ;CREATE OCCURANCE
S C0CFDA(ZF,"?+1,",.01)=DFN
S C0CFDA(ZF,"?+1,",.02)=ZSRC
S C0CFDA(ZF,"?+1,",.03)=ZTYPN
S C0CFDA(ZF,"?+1,",.04)=ZOCC ;CREATE OCCURANCE
K ZERR
D UPDATE^DIE("","C0CFDA","","ZERR") ;ASSIGN RECORD NUMBER
I $D(ZERR) B ;OOPS
K C0CFDA
S ZD0=$O(^C0C(ZF,"C",DFN,ZSRC,ZTYPN,ZOCC,""))
W "RECORD NUMBER: ",ZD0,!
;B
S ZCNT=0
S ZC0CI="" ;
F S ZC0CI=$O(@ZVALS@(ZC0CI)) Q:ZC0CI="" D ;
. I ZC0CI'="M" D ; NOT A SUBVARIABLE
. . S ZCNT=ZCNT+1 ;INCREMENT COUNT
. . S ZVARN=$$VARPTR(ZC0CI,ZTYPE) ;GET THE POINTER TO THE VAR IN THE CCR DICT
. . ; WILL ALLOW FOR LAYGO IF THE VARIABLE IS NOT FOUND
. . S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",.01)=ZVARN
. . S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",1)=@ZVALS@(ZC0CI)
. . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",.01)=ZVARN
. . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",1)=@ZVALS@(ZC0CI)
. . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",.01)=ZVARN
. . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",1)=@ZVALS@(ZC0CI)
;S GT1(170,"?+1,",.01)="ZZZ NEW MEDVEHICLETEXT"
;S GT1(170,"?+1,",12)="DIR"
;S GT1(171.201221,"?+1,1,5,1,",.01)="ZZZ NEW MEDVEHICLETEXT"