GMTSPSTR ;PBM/RMS - USAGE TRACKER for HEALTH SUMMARY COMPONENT ;06/28/17 10:32
;;2.7;Health Summary;**94**;Oct 20, 1995;Build 41
Q
;This routine tracks usage of Health Summary Components
;
;Global is: ^GMT(142.3,"TRACKING")
; where each entry is an array of TAGs:
; format: ^GMT(142.3,"TRACKING",TAG)
; where each TAG is an array of SITEs:
; format: ^GMT(142.3,"TRACKING",TAG,SITE)
; where each SITE is an array of usage records:
; format: ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=USER^TIMESTAMP
; where:
; IEN is unique index number for each record
; USER is NEW PERSON (file #200) IEN/DUZ of user
; TIMESTAMP is date and time of usage
;
; Entry Point: ADD
; Adds a new tracking record to ^GMT(142.3,"TRACKING") global
; Parameter(s): TAG - identifying string (usually component/routine name)
; Returns: <nothing>
;
ADD(TAG) ;
N SITE,IEN,RECORD
S SITE=DUZ(2)
F L +^GMT(142.3,"TRACKING"):$G(DILOCKTM,3) I Q
S IEN=$$NEXTI(TAG,SITE)
L -^GMT(142.3,"TRACKING")
S RECORD=DUZ_"^"_$$NOW^XLFDT
S ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=RECORD
Q
;
; Sub-routine: NEXTI
; Retrieves next index value for ^GMT(142.3,"TRACKING",TAG,SITE)
; Parameter(s): TAG - identifying string, SITE - division identifier passed from ADD
; Returns: IEN - integer of next record number
;
NEXTI(TAG,SITE) ;
N IEN
I '$D(^GMT(142.3,"TRACKING",TAG,SITE)) S ^GMT(142.3,"TRACKING",TAG,SITE)="",IEN=1
I $D(^GMT(142.3,"TRACKING",TAG,SITE))=11 S IEN=$O(^GMT(142.3,"TRACKING",TAG,SITE,":"),-1)+1
S ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=""
Q IEN
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPSTR 1675 printed Oct 16, 2024@18:00:30 Page 2
GMTSPSTR ;PBM/RMS - USAGE TRACKER for HEALTH SUMMARY COMPONENT ;06/28/17 10:32
+1 ;;2.7;Health Summary;**94**;Oct 20, 1995;Build 41
+2 QUIT
+3 ;This routine tracks usage of Health Summary Components
+4 ;
+5 ;Global is: ^GMT(142.3,"TRACKING")
+6 ; where each entry is an array of TAGs:
+7 ; format: ^GMT(142.3,"TRACKING",TAG)
+8 ; where each TAG is an array of SITEs:
+9 ; format: ^GMT(142.3,"TRACKING",TAG,SITE)
+10 ; where each SITE is an array of usage records:
+11 ; format: ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=USER^TIMESTAMP
+12 ; where:
+13 ; IEN is unique index number for each record
+14 ; USER is NEW PERSON (file #200) IEN/DUZ of user
+15 ; TIMESTAMP is date and time of usage
+16 ;
+17 ; Entry Point: ADD
+18 ; Adds a new tracking record to ^GMT(142.3,"TRACKING") global
+19 ; Parameter(s): TAG - identifying string (usually component/routine name)
+20 ; Returns: <nothing>
+21 ;
ADD(TAG) ;
+1 NEW SITE,IEN,RECORD
+2 SET SITE=DUZ(2)
+3 FOR
LOCK +^GMT(142.3,"TRACKING"):$GET(DILOCKTM,3)
IF $TEST
QUIT
+4 SET IEN=$$NEXTI(TAG,SITE)
+5 LOCK -^GMT(142.3,"TRACKING")
+6 SET RECORD=DUZ_"^"_$$NOW^XLFDT
+7 SET ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=RECORD
+8 QUIT
+9 ;
+10 ; Sub-routine: NEXTI
+11 ; Retrieves next index value for ^GMT(142.3,"TRACKING",TAG,SITE)
+12 ; Parameter(s): TAG - identifying string, SITE - division identifier passed from ADD
+13 ; Returns: IEN - integer of next record number
+14 ;
NEXTI(TAG,SITE) ;
+1 NEW IEN
+2 IF '$DATA(^GMT(142.3,"TRACKING",TAG,SITE))
SET ^GMT(142.3,"TRACKING",TAG,SITE)=""
SET IEN=1
+3 IF $DATA(^GMT(142.3,"TRACKING",TAG,SITE))=11
SET IEN=$ORDER(^GMT(142.3,"TRACKING",TAG,SITE,":"),-1)+1
+4 SET ^GMT(142.3,"TRACKING",TAG,SITE,IEN)=""
+5 QUIT IEN