added functions to RIM reporting

This commit is contained in:
george 2008-08-25 16:06:14 +00:00
parent 472b79df31
commit 7b29b5e18f
1 changed files with 35 additions and 1 deletions

View File

@ -150,10 +150,44 @@ CPUSH(CATRTN,CBASE,CTBL,CDFN,CATTR) ; ADD PATIENTS TO CATEGORIES
;
S CPATLIST=$NA(@CBASE@(CTBL,"PATS",CATRTN)) ; BASE OF PAT LIST FOR THIS CAT
W "PATS BASE: ",CPATLIST,!
D PUSH^GPLXPATH(CPATLIST,CDFN) ; ADD THIS PATIENT TO THE CAT PAT LIST
S @CPATLIST@(CDFN)="" ; ADD THIS PATIENT TO THE CAT PAT LIST
;
Q
;
CCOUNT ; RECOUNT THE CATEGORIES.. USE IN CASE OF RESTART OF ANALYZE
;
I '$D(RIMBASE) D ASETUP ; FOR COMMAND LINE CALLS
N ZI,ZJ,ZCNT,ZIDX,ZCAT,ZATR,ZTOT
S ZCBASE=$NA(@RIMBASE@("RIMTBL","CATS")) ; BASE OF CATEGORIES
S ZPBASE=$NA(@RIMBASE@("RIMTBL","PATS")) ; BASE OF PATIENTS
S ZTOT=0 ; INITIALIZE OVERALL TOTAL
F ZI=1:1:@ZCBASE@(0) D ; FOR ALL CATS
. S ZCNT=0
. S ZATR=@ZCBASE@(ZI) ; THE ATTRIBUTE OF THE CATEGORY
. S ZCAT=$P(@ZCBASE@(ZATR),"^",1) ; USE IT TO LOOK UP THE CATEGORY NAME
. ; S ZIDX=$O(@ZPBASE@(ZCAT,"")) ; FIRST PATIENT IN LIST
. ; F ZJ=0:0 D Q:$O(@ZPBASE@(ZCAT,ZIDX))="" ; ALL PATIENTS IN THE LISTS
. ; . S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
. ; . W ZCAT," DFN:",ZIDX," COUNT:",ZCNT,!
. ; . S ZIDX=$O(@ZPBASE@(ZCAT,ZIDX))
. S ZCNT=$$CNTLST($NA(@ZPBASE@(ZCAT)))
. S $P(@ZCBASE@(ZATR),"^",2)=ZCNT ; UPDATE THE COUNT IN THE CAT RECORD
. S ZTOT=ZTOT+ZCNT
W "TOTAL: ",ZTOT,!
Q
;
CNTLST(INLST) ; RETURNS THE NUMBER OF ELEMENTS IN THE LIST
; INLST IS PASSED BY NAME
N ZI,ZDX,ZCOUNT
W INLST,!
S ZCOUNT=0
S ZDX=""
F ZI=$O(@INLST@(ZDX)):0 D Q:$O(@INLST@(ZDX))="" ; LOOP UNTIL THE END
. S ZCOUNT=ZCOUNT+1
. S ZDX=$O(@INLST@(ZDX))
. W "ZDX:",ZDX," ZCNT:",ZCOUNT,!
Q ZCOUNT
;
APUSH(AMAP,AVAL) ; ADD AVAL TO ATTRIBUTE MAP AMAP (AMAP PASSED BY NAME)
; AMAP IS FORMED FOR ARRAY ACCESS: AMAP(0) IS THE COUNT
; AND AMAP(N)=AVAL IS THE NTH AVAL