Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SCRPW303

SCRPW303.m

Go to the documentation of this file.
  1. SCRPW303 ; BPFO/JRC - Performance Monitor Report Utils; 30 Jul 2003 ; 4/2/04 7:21am
  1. ;;5.3;SCHEDULING;**292,313,438**; AUG 13, 1993
  1. ;
  1. DSS(SCRNARR) ;Set Stop Codes into screen array (prompt is one/many/all)
  1. ;Input : SCRNARR - Screen array full global reference
  1. ;Output : 1 = OK 0 = User abort/timeout
  1. ; @SCRNARR@("DSS") = User pick all stop codes ?
  1. ; 1 = Yes (all) 0 = No
  1. ; @SCRNARR@("DSS-NTNL") = Only stop codes in national cohort ?
  1. ; 1 = Yes 0 = No
  1. ; @SCRNARR@("DSS",PtrStopCode) = Stop Code Name
  1. ; @SCRNARR@("DSS-EXCLUDE",PtrStopCod) = SC Name
  1. ;Note : @SCRNARR@("DSS") is initialized (KILLed) on input
  1. ; : @SCRNARR@("DSS",PtrStopCode) is only set when the user
  1. ; picked individual stop codes (i.e. didn't pick all) OR
  1. ; when user selected stop codes by range (i.e. 100,102-300)
  1. ; : @SCRNARR@("DSS-EXCLUDE") is only set if the user picked ALL
  1. ; stop codes and choose to only use stop codes & credit pairs
  1. ; from the national cohort
  1. ; : @SCRNARR@("DSS-EXCLUDE") is set when
  1. ; @SCRNARR@("DSS-NTNL") equals 1
  1. ;
  1. ;Declare variables
  1. N VAUTSTR,VAUTVB,VAUTNI,DSS,SCANARR,DIC,DIR,Y,X,CODE,ARRY,DIRUT,FLG
  1. K @SCRNARR@("DSS")
  1. ;Prompt user wether to use range for stop code selection or not
  1. S DIR(0)="Y",DIR("B")="No",FLG=0
  1. S DIR("A")="Would you like to select the Stop Codes by range "
  1. D ^DIR
  1. I $D(DIRUT)!$D(DTOUT) Q FLG
  1. I Y D RANGE(SCRNARR) Q FLG
  1. ;Get stop code selection using VAUTOMA
  1. I '$D(@SCRNARR@("DSS"))
  1. S DIC="^DIC(40.7,"
  1. S VAUTSTR="Stop Code"
  1. S VAUTVB="SCANARR"
  1. S VAUTNI=2
  1. D FIRST^VAUTOMA
  1. I Y<0 Q 0
  1. ;Does selection of ALL mean all stop codes in national cohort
  1. I $G(SCANARR)=1 D
  1. .N DIR,X,Y,DIRUT,DIROUT,DTOUT,DUOUT
  1. .S DIR(0)="Y"
  1. .S DIR("B")="YES"
  1. .S DIR("A",1)="By ALL do you mean stop codes from the"
  1. .S DIR("A")="Performance Monitor national cohort "
  1. .D ^DIR
  1. .I $D(DIRUT) K SCANARR Q
  1. .I Y D NTNLESC(SCRNARR)
  1. .Q
  1. I '$D(SCANARR) Q 0
  1. I $D(@SCRNARR@("DSS")) Q 1
  1. S @SCRNARR@("DSS-NTNL")=0
  1. M @SCRNARR@("DSS")=SCANARR
  1. Q 1
  1. ;
  1. SORT(SORTARR) ; Set sort order into sort array
  1. ;Input : SORTARR - Sort array full global reference
  1. ;Output : 1 = OK 0 = User abort/timeout
  1. ; @SORTARR = Sort1Code^Sort2Code
  1. ; Codes: 1 = Division 2 = Clinic
  1. ; 3 = Provider 4 = Stop Code
  1. ; 5 = Date 6 = Patient
  1. ; @SORTARR@("TEXT") = Sort1Text^Sort2Text
  1. ;Note : @SORTARR is initialized (KILLed) on input
  1. ;
  1. ;Declare variables
  1. N DIR,X,Y,DIRUT,DIROUT,DTOUT,DUOUT
  1. K @SORTARR
  1. ;Get sort level 1
  1. S DIR(0)="SC^1:DIVISION;2:CLINIC;3:PROVIDER;4:STOP CODE;5:DATE;6:PATIENT"
  1. S DIR("A")="Select primary sorting criteria"
  1. D ^DIR
  1. I $D(DIRUT) Q 0
  1. S @SORTARR=Y
  1. S @SORTARR@("TEXT")=$$SRT2TXT(Y)
  1. ;Get sort level 2
  1. K DIR,X,Y
  1. S DIR(0)="SC^1:DIVISION;2:CLINIC;3:PROVIDER;4:STOP CODE;5:DATE;6:PATIENT"
  1. S DIR("A")="Within "_@SORTARR@("TEXT")_" sort by"
  1. S DIR("S")="I Y'="_@SORTARR
  1. D ^DIR
  1. I $D(DIRUT) K @SORTARR Q 0
  1. S @SORTARR=@SORTARR_"^"_Y
  1. S @SORTARR@("TEXT")=@SORTARR@("TEXT")_"^"_$$SRT2TXT(Y)
  1. Q 1
  1. SRT2TXT(CODE) ;Convert sort code to sort text
  1. ;Input : CODE - Sort code
  1. ;Output : Text for sort code
  1. ;
  1. I CODE=1 Q "division"
  1. I CODE=2 Q "clinic"
  1. I CODE=3 Q "provider"
  1. I CODE=4 Q "stop code"
  1. I CODE=5 Q "date"
  1. I CODE=6 Q "patient"
  1. Q ""
  1. ;
  1. ROLLUP(SCRNARR,SORTARR) ;Set screen and sort arrays for national rollup
  1. ;Input : SCRNARR - Screening array
  1. ; SORTARR - Sort array full global reference
  1. ;Output : None
  1. ; Nodes in @SCRNARR are set to denote the following:
  1. ; Time limit of 10
  1. ; Include all divisions
  1. ; Use excluded stop codes from national cohort array
  1. ; Count encounters with scanned progress notes
  1. ; Nodes in @SORTARR are set to denote the following:
  1. ; Primary sort is division
  1. ; Secondary sort is date
  1. ;Note : @SCRNARR and @SORTARR are initialized (KILLed) on input
  1. ;
  1. K @SCRNARR,@SORTARR
  1. S @SCRNARR@("TLMT")=10
  1. S @SCRNARR@("DIVISION")=1
  1. S @SCRNARR@("PROVIDERS")=1
  1. D NTNLESC(SCRNARR)
  1. S @SCRNARR@("SCANNED")=1
  1. S @SORTARR="1^5"
  1. S @SORTARR@("TEXT")="division^date"
  1. Q
  1. ;
  1. NTNLSC(SCRNARR) ;Set inclusion array of stop codes for national reporting
  1. ;Input : SCRNARR - Screening array
  1. ;Output : National list of acceptable stop code & credit pairs
  1. ; @SCRNARR@("DSS") = 0
  1. ; @SCRNARR@("DSS-NTNL") = 1
  1. ; @SCRNARR@("DSS",PtrStopCode) = Stop Code Name
  1. ; @SCRNARR@("DSS-PAIR",PtrStopCode,PtrStopCode) = SC Name ^ SC Name
  1. ;
  1. N OFF,TEXT,J,CODE,PTR1,TMP,PTR2
  1. S @SCRNARR@("DSS")=0
  1. S @SCRNARR@("DSS-NTNL")=1
  1. F OFF=1:1 S TEXT=$P($T(STOP+OFF),";;",2) Q:TEXT="END" D
  1. .F J=1:1:$L(TEXT,"^") S CODE=$P(TEXT,"^",J) D
  1. ..S TMP=$L(CODE) Q:((TMP'=3)&(TMP'=6))
  1. ..I TMP=3 D Q
  1. ...;Individual stop code
  1. ...S PTR1=$$SC2PTR(CODE) Q:'PTR1
  1. ...S @SCRNARR@("DSS",+PTR1)=$P(PTR1,"^",2)
  1. ..;Credit pair
  1. ..S PTR1=$$SC2PTR($E(CODE,1,3)) Q:'PTR1
  1. ..S PTR2=$$SC2PTR($E(CODE,4,6)) Q:'PTR2
  1. ..S @SCRNARR@("DSS-PAIR",+PTR1,+PTR2)=$P(PTR1,"^",2)_"^"_$P(PTR2,"^",2)
  1. Q
  1. NTNLESC(SCRNARR) ;Set exclusion array of stop codes for national reporting
  1. ;Input : SCRNARR - Screening array
  1. ;Output : National list of stop codes to be excluded
  1. ; @SCRNARR@("DSS") = 0
  1. ; @SCRNARR@("DSS-NTNL") = 1
  1. ; @SCRNARR@("DSS-EXCLUDE",PtrStopCode) = Stop Code Name
  1. ;
  1. N OFF,TEXT,J,CODE,PTR1,TMP,PTR2
  1. S @SCRNARR@("DSS")=0
  1. S @SCRNARR@("DSS-NTNL")=1
  1. F OFF=1:1 S TEXT=$P($T(EXCSTOP+OFF),";;",2) Q:TEXT="END" D
  1. .F J=1:1:$L(TEXT,"^") S CODE=$P(TEXT,"^",J) D
  1. ..S TMP=$L(CODE) Q:((TMP'=3)&(TMP'=6))
  1. ..I TMP=3 D Q
  1. ...;Individual stop code for exclusion
  1. ...S PTR1=$$SC2PTR(CODE) Q:'PTR1
  1. ...S @SCRNARR@("DSS-EXCLUDE",+PTR1)=$P(PTR1,"^",2)
  1. Q
  1. RANGE(SCRNARR) ;Screen array by range
  1. N DIR,DIRUT,DTOUT,Y,SUB,NODE,CODE,PTR1,J
  1. S @SCRNARR@("DSS")=0
  1. S @SCRNARR@("DSS",1)=""
  1. S @SCRNARR@("DSS-NTNL")=0
  1. S DIR("A")="Select individual Stop Code or a range of Codes "
  1. S DIR("?")="This response must be a list or range, e.g., 100,302 or 200-450,800 "
  1. S DIR(0)="L"
  1. D ^DIR
  1. I $D(DIRUT)!$D(DTOUT) Q
  1. I Y D
  1. .S FLG=1
  1. .S SUB="" F S SUB=$O(Y(SUB)) Q:SUB="" D
  1. ..S NODE=(Y(SUB))
  1. ..F J=1:1:$L(NODE,",") S CODE=$P(NODE,",",J) I CODE D
  1. ...S PTR1=$$SC2PTR(CODE) Q:'PTR1
  1. ...S @SCRNARR@("DSS",+PTR1)=$P(PTR1,"^",2)
  1. Q
  1. SC2PTR(CODE) ;Get pointer to stop code
  1. ;Input : CODE - Stop code
  1. ;Output : Pointer #40.7 ^ Name (#.01)
  1. ;
  1. N NODE,PTR
  1. S PTR=+$O(^DIC(40.7,"C",CODE,0)) I 'PTR Q "0^INVALID STOP CODE"
  1. S NODE=$G(^DIC(40.7,PTR,0))
  1. Q PTR_"^"_$P(NODE,"^",1)
  1. ;
  1. STOP ;List of acceptable stop codes and credit pairs
  1. ;;END
  1. ;
  1. EXCSTOP ;Exclusion list of stop codes
  1. ;;104^105^106^107^108^109^115^116^117^120^126^127^128^144^145
  1. ;;146^149^150^151^152^153^154^155^165^166^167^168^169^174^190
  1. ;;202^205^206^207^208^212^213^214^290^291^292^293^294^295^296
  1. ;;321^327^328^329^333^334^370^417^421^422^423^429^430^431^435
  1. ;;450^451^452^453^454^455^456^458^459^460^461^462^463^464^465
  1. ;;466^467^468^469^470^471^472^473^474^475^476^477^478^479^481
  1. ;;482^483^484^485^505^506^510^513^516^519^521^522^523^525^535
  1. ;;538^545^547^550^553^554^557^558^559^560^561^563^564^565^566
  1. ;;573^574^575^577^578^590^602^603^604^606^607^608^610^650^651
  1. ;;652^653^654^655^656^657^660^670^680^681^682^690^691^701^702
  1. ;;703^704^705^706^707^708^709^710^711^725^730^731^900^999
  1. ;;END
  1. ;