YTSCES ;SLC/BLD - Score for Combat Exposure Scale (CES) ; 9/26/2018
;;5.01;MENTAL HEALTH;**123,147**;DEC 30,1994;Build 283
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
;
S QUES1=($$GET1^DIQ(601.75,$P(YSDATA(3),"^",3)_",",4,"I")-1)*2
S QUES2=(+$$GET1^DIQ(601.75,$P(YSDATA(4),"^",3)_",",4,"I")-1)
S QUES3=+$$GET1^DIQ(601.75,$P(YSDATA(5),"^",3)_",",4,"I") D
.I QUES3>0,QUES3<5 S QUES3=(QUES3-1)*2
.I QUES3=5 S QUES3=(QUES3-2)*2
S QUES4=+$$GET1^DIQ(601.75,$P(YSDATA(6),"^",3)_",",4,"I") D
.I QUES4>0,QUES4<5 S QUES4=QUES4-1
.I QUES4=5 S QUES4=QUES4-2
S QUES5=+$$GET1^DIQ(601.75,$P(YSDATA(7),"^",3)_",",4,"I")-1
S QUES6=(+$$GET1^DIQ(601.75,$P(YSDATA(8),"^",3)_",",4,"I")-1)*2
S QUES7=(+$$GET1^DIQ(601.75,$P(YSDATA(9),"^",3)_",",4,"I")-1)*2
S TOTSCORE=QUES1+QUES2+QUES3+QUES4+QUES5+QUES6+QUES7
S STRING1=TOTSCORE
;
Q
;
STRING ;
;
I '$D(^TMP($J,"YSCOR")) D LDSCORES(.YSDATA,.YS)
S TOTSCORE=+$P(^TMP($J,"YSCOR",2),"=",2)
I TOTSCORE'<0,TOTSCORE'>8 S STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates light Combat Exposure" S N=N+1
I TOTSCORE>8,TOTSCORE<17 S STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates light - moderate Combat Exposure" S N=N+1
I TOTSCORE>16,TOTSCORE<25 S STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates moderate Combat Exposure" S N=N+1
I TOTSCORE>24,TOTSCORE<33 S STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates moderate-heavy Combat Exposure" S N=N+1
I TOTSCORE>32,TOTSCORE<42 S STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates heavy Combat Exposure" S N=N+1
Q
;
;
SCORESV ;
D DATA1
I $D(^TMP($J,"YSG",1)),^TMP($J,"YSG",1)="[ERROR]" D Q ;-->out
.K ^TMP($J,"YSCOR")
.S ^TMP($J,"YSCOR",1)="[ERROR]"
.S ^TMP($J,"YSCOR",2)=$G(YSINSNAM)_" Scale not found"
S YSSCNAM=$P($G(^TMP($J,"YSG",3)),U,4) ; Scale Name
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S YSSCALIEN=+$P(^TMP($J,"YSG",3),"=",2)
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_STRING1
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,LEG,NODE,YSQN,YSSCALIEN,QUES5,QUES6,QUES7
N YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1,QUES3,QUES4
N TOTAL,TXT,TEXT1,TEXT2,QUETOT,CES,QUES1,QUES2,TOTSCORE
;
; CES returns a scale score which is calculated and stored, no special text in report
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.D STRING
.S YSDATA(N)="7772^9999;1^"_STRING S N=N+1
Q
;
LDSCORES(YSDATA,YS) ; new call for patch 123
;input:AD = ADMINISTRATION #
;output: [DATA]
N G,N,IEN71,SCALE,YSAD,YSCODEN,YSCALE
S YSAD=$G(YS("AD"))
;
S YSDATA=$NA(^TMP($J,"YSCOR"))
S ^TMP($J,"YSCOR",1)="[DATA]",N=1
;
S YSCALE="",N=1
F S YSCALE=$O(^YTT(601.92,"AC",YSAD,YSCALE)) Q:'YSCALE D
.S G=$G(^YTT(601.92,YSCALE,0))
.S SCALE=$P(G,U,3),N=N+1
.S ^TMP($J,"YSCOR",N)=SCALE_"="_$P(G,U,4,7)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSCES 3007 printed Oct 16, 2024@18:20:12 Page 2
YTSCES ;SLC/BLD - Score for Combat Exposure Scale (CES) ; 9/26/2018
+1 ;;5.01;MENTAL HEALTH;**123,147**;DEC 30,1994;Build 283
+2 ;
+3 ;Public, Supported ICRs
+4 ; #2056 - Fileman API - $$GET1^DIQ
+5 ;
+6 QUIT
+7 ;
DATA1 ;
+1 ;
+2 SET QUES1=($$GET1^DIQ(601.75,$PIECE(YSDATA(3),"^",3)_",",4,"I")-1)*2
+3 SET QUES2=(+$$GET1^DIQ(601.75,$PIECE(YSDATA(4),"^",3)_",",4,"I")-1)
+4 SET QUES3=+$$GET1^DIQ(601.75,$PIECE(YSDATA(5),"^",3)_",",4,"I")
Begin DoDot:1
+5 IF QUES3>0
IF QUES3<5
SET QUES3=(QUES3-1)*2
+6 IF QUES3=5
SET QUES3=(QUES3-2)*2
End DoDot:1
+7 SET QUES4=+$$GET1^DIQ(601.75,$PIECE(YSDATA(6),"^",3)_",",4,"I")
Begin DoDot:1
+8 IF QUES4>0
IF QUES4<5
SET QUES4=QUES4-1
+9 IF QUES4=5
SET QUES4=QUES4-2
End DoDot:1
+10 SET QUES5=+$$GET1^DIQ(601.75,$PIECE(YSDATA(7),"^",3)_",",4,"I")-1
+11 SET QUES6=(+$$GET1^DIQ(601.75,$PIECE(YSDATA(8),"^",3)_",",4,"I")-1)*2
+12 SET QUES7=(+$$GET1^DIQ(601.75,$PIECE(YSDATA(9),"^",3)_",",4,"I")-1)*2
+13 SET TOTSCORE=QUES1+QUES2+QUES3+QUES4+QUES5+QUES6+QUES7
+14 SET STRING1=TOTSCORE
+15 ;
+16 QUIT
+17 ;
STRING ;
+1 ;
+2 IF '$DATA(^TMP($JOB,"YSCOR"))
DO LDSCORES(.YSDATA,.YS)
+3 SET TOTSCORE=+$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+4 IF TOTSCORE'<0
IF TOTSCORE'>8
SET STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates light Combat Exposure"
SET N=N+1
+5 IF TOTSCORE>8
IF TOTSCORE<17
SET STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates light - moderate Combat Exposure"
SET N=N+1
+6 IF TOTSCORE>16
IF TOTSCORE<25
SET STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates moderate Combat Exposure"
SET N=N+1
+7 IF TOTSCORE>24
IF TOTSCORE<33
SET STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates moderate-heavy Combat Exposure"
SET N=N+1
+8 IF TOTSCORE>32
IF TOTSCORE<42
SET STRING="Total Combat Exposure Score: "_TOTSCORE_" which indicates heavy Combat Exposure"
SET N=N+1
+9 QUIT
+10 ;
+11 ;
SCORESV ;
+1 DO DATA1
+2 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+3 KILL ^TMP($JOB,"YSCOR")
+4 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+5 SET ^TMP($JOB,"YSCOR",2)=$GET(YSINSNAM)_" Scale not found"
End DoDot:1
QUIT
+6 ; Scale Name
SET YSSCNAM=$PIECE($GET(^TMP($JOB,"YSG",3)),U,4)
+7 ;
+8 KILL ^TMP($JOB,"YSCOR")
+9 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+10 SET YSSCALIEN=+$PIECE(^TMP($JOB,"YSG",3),"=",2)
+11 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_STRING1
+12 QUIT
+13 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,DES,LEG,NODE,YSQN,YSSCALIEN,QUES5,QUES6,QUES7
+4 NEW YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1,QUES3,QUES4
+5 NEW TOTAL,TXT,TEXT1,TEXT2,QUETOT,CES,QUES1,QUES2,TOTSCORE
+6 ;
+7 ; CES returns a scale score which is calculated and stored, no special text in report
+8 IF YSTRNG=1
DO SCORESV
+9 IF YSTRNG=2
Begin DoDot:1
+10 DO STRING
+11 SET YSDATA(N)="7772^9999;1^"_STRING
SET N=N+1
End DoDot:1
+12 QUIT
+13 ;
LDSCORES(YSDATA,YS) ; new call for patch 123
+1 ;input:AD = ADMINISTRATION #
+2 ;output: [DATA]
+3 NEW G,N,IEN71,SCALE,YSAD,YSCODEN,YSCALE
+4 SET YSAD=$GET(YS("AD"))
+5 ;
+6 SET YSDATA=$NAME(^TMP($JOB,"YSCOR"))
+7 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
SET N=1
+8 ;
+9 SET YSCALE=""
SET N=1
+10 FOR
SET YSCALE=$ORDER(^YTT(601.92,"AC",YSAD,YSCALE))
if 'YSCALE
QUIT
Begin DoDot:1
+11 SET G=$GET(^YTT(601.92,YSCALE,0))
+12 SET SCALE=$PIECE(G,U,3)
SET N=N+1
+13 SET ^TMP($JOB,"YSCOR",N)=SCALE_"="_$PIECE(G,U,4,7)
End DoDot:1
+14 QUIT