YTSIMRS ;SLC/BLD- ANSWERS SPECIAL HANDLING - IMRS ; 10/16/18 9:35am
;;5.01;MENTAL HEALTH;**151**;DEC 30,1994;Build 92
;
DATA1 ;expects score, returns SCORE
N NODE
S NODE=2 F S NODE=$O(YSDATA(NODE)) Q:NODE="" D
.N YSCDA,LEG,DATA
.S DATA=YSDATA(NODE)
.S YSCDA=$P($G(DATA),U,3) ; Choice ID
.S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
.S SCORE=SCORE+LEG
Q
;
STRING ; Expects ^TMP($J,"YSCOR"
N SCORE,SKIP13
I YSDATA(15)="8347^13^1155" S SKIP13=1 ;if question 13 has 1155 mh choice (aka skipped choice)
S SCORE=$P($G(^TMP($J,"YSCOR",2)),"=",2)
S STRING1="|IMRS TOTAL SCORE = "_SCORE
S STRING1=STRING1_"|Total score can range from 15 to 75*. Higher scores indicate better functioning."
I $G(SKIP13) S STRING1=STRING1_"||Question 13 was skipped because no medication was prescribed."
S STRING1=STRING1_"||* If Question 13 is skipped, the score range is 14-70"
S STRING1=STRING1_"||"
;
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)="No Scale found for ADMIN"
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,1314_",",3,"I")_"="_SCORE
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,LEG,NODE,SCORE,STRING1,SC
N YSCDA,YSDFN,YSINSNAM,YSSEX,YSQN
;
S (SC,YSSEX)=""
S SCORE=0
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.D LDSCORES^YTSCORE(.YSDATA,.YS)
.D STRING
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_STRING1
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSIMRS 1606 printed Dec 13, 2024@02:19:53 Page 2
YTSIMRS ;SLC/BLD- ANSWERS SPECIAL HANDLING - IMRS ; 10/16/18 9:35am
+1 ;;5.01;MENTAL HEALTH;**151**;DEC 30,1994;Build 92
+2 ;
DATA1 ;expects score, returns SCORE
+1 NEW NODE
+2 SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+3 NEW YSCDA,LEG,DATA
+4 SET DATA=YSDATA(NODE)
+5 ; Choice ID
SET YSCDA=$PIECE($GET(DATA),U,3)
+6 SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
+7 SET SCORE=SCORE+LEG
End DoDot:1
+8 QUIT
+9 ;
STRING ; Expects ^TMP($J,"YSCOR"
+1 NEW SCORE,SKIP13
+2 ;if question 13 has 1155 mh choice (aka skipped choice)
IF YSDATA(15)="8347^13^1155"
SET SKIP13=1
+3 SET SCORE=$PIECE($GET(^TMP($JOB,"YSCOR",2)),"=",2)
+4 SET STRING1="|IMRS TOTAL SCORE = "_SCORE
+5 SET STRING1=STRING1_"|Total score can range from 15 to 75*. Higher scores indicate better functioning."
+6 IF $GET(SKIP13)
SET STRING1=STRING1_"||Question 13 was skipped because no medication was prescribed."
+7 SET STRING1=STRING1_"||* If Question 13 is skipped, the score range is 14-70"
+8 SET STRING1=STRING1_"||"
+9 ;
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)="No Scale found for ADMIN"
End DoDot:1
QUIT
+6 ;
+7 KILL ^TMP($JOB,"YSCOR")
+8 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+9 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,1314_",",3,"I")_"="_SCORE
+10 QUIT
+11 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,LEG,NODE,SCORE,STRING1,SC
+4 NEW YSCDA,YSDFN,YSINSNAM,YSSEX,YSQN
+5 ;
+6 SET (SC,YSSEX)=""
+7 SET SCORE=0
+8 IF YSTRNG=1
DO SCORESV
+9 IF YSTRNG=2
Begin DoDot:1
+10 DO LDSCORES^YTSCORE(.YSDATA,.YS)
+11 DO STRING
+12 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING1
End DoDot:1
+13 QUIT
+14 ;