YTSSTMS ;SLC/PIJ - Score STMS ; 03/31/2016
;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
S TOTAL=0,DIGIT=0
S YSINSNAM=$P($G(YSDATA(2)),U,3)
I $G(YSINSNAM)="" S YSINSNAM=$G(YS("CODE"),"NO NAME PASSED")
S NODE=2 F S NODE=$O(YSDATA(NODE)) Q:NODE="" D ; Start at YSDATA(3)
.S DATA=YSDATA(NODE)
.S YSQN=$P(DATA,U,1)
.S YSCDA=$P($G(DATA),U,3) ; Choice ID
.D DESGNTR^YTSCORE(YSQN,.DES)
.S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I") ; LEG = Legacy value
.;Do special processing on these questions
.I (DES="2A")!(DES="2B")!(DES="2C")!(DES="3A")!(DES="3B")!(DES=7) D Q
..;Get best number of digit spans (2A, 2B, 2C)
..I (DES="2A") S DIGIT=LEG
..I (DES="2B"),(YSCDA'=1156) D Q
...I LEG>DIGIT S DIGIT=LEG
..I (DES="2C"),(YSCDA'=1156) D Q
...I LEG>DIGIT S DIGIT=LEG
..;Get number of Attempts to learn words (3A)
..I DES="3A" D Q
...I LEG=4 S TOTAL=TOTAL-3
...I LEG=3 S TOTAL=TOTAL-2
...I LEG=2 S TOTAL=TOTAL-1
..;Get number of words learned (3B)
..I DES="3B" S TOTAL=TOTAL+LEG
..;Get answer for drawing cube (7)
..I DES=7 D Q
...I LEG=1 S TOTAL=TOTAL+2 ; full credit
...I LEG=2 S TOTAL=TOTAL+1 ; partial credit
.I LEG=1 S TOTAL=TOTAL+1
;get grand total
S TOTAL=TOTAL+DIGIT
Q
;
SCORESV ;
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)="STMS Scale not found"
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,626_",",3,"I")_"="_TOTAL
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,DIGIT,LEG,NODE,YSCDA,YSQN,YSINSNAM,TOTAL
;
I YSTRNG=2 Q ; No special text in report, use scale
D DATA1
D SCORESV
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSSTMS 1883 printed Dec 13, 2024@02:20:54 Page 2
YTSSTMS ;SLC/PIJ - Score STMS ; 03/31/2016
+1 ;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
+2 ;
+3 ;Public, Supported ICRs
+4 ; #2056 - Fileman API - $$GET1^DIQ
+5 ;
+6 QUIT
+7 ;
DATA1 ;
+1 SET TOTAL=0
SET DIGIT=0
+2 SET YSINSNAM=$PIECE($GET(YSDATA(2)),U,3)
+3 IF $GET(YSINSNAM)=""
SET YSINSNAM=$GET(YS("CODE"),"NO NAME PASSED")
+4 ; Start at YSDATA(3)
SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+5 SET DATA=YSDATA(NODE)
+6 SET YSQN=$PIECE(DATA,U,1)
+7 ; Choice ID
SET YSCDA=$PIECE($GET(DATA),U,3)
+8 DO DESGNTR^YTSCORE(YSQN,.DES)
+9 ; LEG = Legacy value
SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
+10 ;Do special processing on these questions
+11 IF (DES="2A")!(DES="2B")!(DES="2C")!(DES="3A")!(DES="3B")!(DES=7)
Begin DoDot:2
+12 ;Get best number of digit spans (2A, 2B, 2C)
+13 IF (DES="2A")
SET DIGIT=LEG
+14 IF (DES="2B")
IF (YSCDA'=1156)
Begin DoDot:3
+15 IF LEG>DIGIT
SET DIGIT=LEG
End DoDot:3
QUIT
+16 IF (DES="2C")
IF (YSCDA'=1156)
Begin DoDot:3
+17 IF LEG>DIGIT
SET DIGIT=LEG
End DoDot:3
QUIT
+18 ;Get number of Attempts to learn words (3A)
+19 IF DES="3A"
Begin DoDot:3
+20 IF LEG=4
SET TOTAL=TOTAL-3
+21 IF LEG=3
SET TOTAL=TOTAL-2
+22 IF LEG=2
SET TOTAL=TOTAL-1
End DoDot:3
QUIT
+23 ;Get number of words learned (3B)
+24 IF DES="3B"
SET TOTAL=TOTAL+LEG
+25 ;Get answer for drawing cube (7)
+26 IF DES=7
Begin DoDot:3
+27 ; full credit
IF LEG=1
SET TOTAL=TOTAL+2
+28 ; partial credit
IF LEG=2
SET TOTAL=TOTAL+1
End DoDot:3
QUIT
End DoDot:2
QUIT
+29 IF LEG=1
SET TOTAL=TOTAL+1
End DoDot:1
+30 ;get grand total
+31 SET TOTAL=TOTAL+DIGIT
+32 QUIT
+33 ;
SCORESV ;
+1 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+2 KILL ^TMP($JOB,"YSCOR")
+3 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+4 SET ^TMP($JOB,"YSCOR",2)="STMS Scale not found"
End DoDot:1
QUIT
+5 KILL ^TMP($JOB,"YSCOR")
+6 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+7 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,626_",",3,"I")_"="_TOTAL
+8 QUIT
+9 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,DES,DIGIT,LEG,NODE,YSCDA,YSQN,YSINSNAM,TOTAL
+4 ;
+5 ; No special text in report, use scale
IF YSTRNG=2
QUIT
+6 DO DATA1
+7 DO SCORESV
+8 QUIT