YTSBAI ;SLC/PIJ - Score BAI ; 01/19/2016
;;5.01;MENTAL HEALTH;**123**;Dec 30, 1994;Build 73
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
S YSINSNAM=$P(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($G(DATA),U,1)
.S YSCDA=$P($G(DATA),U,3) ; Choice ID
.; calculate skipped questions
.I YSCDA=1155 S SKIPPED=SKIPPED+1 ; process instrument differently if > 5 questions skipped. below.
.S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
.S SCORE=SCORE+LEG
.S YSAN=$$GET1^DIQ(601.75,YSCDA_",",3,"I")
.I YSAN="Skipped"!(LEG="") S YSAN="Not Answered."
.D DESGNTR^YTSCORE(YSQN,.DES)
.S STRING=STRING_"| "_$G(DES)_". "_$P($G(YSAN),"(",1)
.I LEG'="X" S STRING=STRING_"("_LEG_$S(LEG=1:" point",1:" points")_")"
I SKIPPED>5 S SCORE="CND"
Q
;
SCORE1 ;
N RANGE,RISK
I '$D(^TMP($J,"YSCOR")) D Q
.S STRING1="| "_YSINSNAM_" score could not be determined. "
;
S SCORE=$P($G(^TMP($J,"YSCOR",2)),"=",2)
I SKIPPED>5 S SCORE=-1 D
.S STRING1=STRING1_"|BAI score could not be determined."
;
I SCORE>-1 D
.S RISK=$S(SCORE<8:"minimal",SCORE<16:"mild",SCORE<26:"moderate",1:"severe")
.S RANGE=$S(SCORE<8:"between 0 - 7",SCORE<16:"between 8 - 15",SCORE<26:"between 16 - 25",1:"above 25")
.S STRING1=STRING1_"|BAI Score: "_SCORE_" indicates "_RISK_" anxiety."
S STRING1=STRING1_"||The overall range is 0 to 63"
;
I SCORE=-1 S STRING1=STRING1_"."
ELSE S STRING1=STRING1_" with "_RISK_" anxiety "_RANGE_"."
;
S STRING1=STRING1_"|| 0-7 Minimal level of anxiety"
S STRING1=STRING1_"| 8-15 Mild anxiety"
S STRING1=STRING1_"| 16-25 Moderate anxiety"
S STRING1=STRING1_"| 26-63 Severe anxiety"
S STRING1=STRING1_"|| Questions and answers"
S STRING1=STRING1_"| "_STRING
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)=$G(YSINSNAM)_" Scale not found"
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,901_",",3,"I")_"="_SCORE
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,LEG,NODE,SCORE,SKIPPED,STRING,STRING1
N YSCDA,YSINSNAM,YSAN,YSQN
;
S (SKIPPED,SCORE)=0
S (STRING,STRING1)=""
;
D DATA1
I YSTRNG=1 D
.D SCORESV
I YSTRNG=2 D
.D LDSCORES^YTSCORE(.YSDATA,.YS)
.D SCORE1
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_STRING1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSBAI 2640 printed Dec 13, 2024@02:19:13 Page 2
YTSBAI ;SLC/PIJ - Score BAI ; 01/19/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 YSINSNAM=$PIECE(YSDATA(2),U,3)
+2 IF $GET(YSINSNAM)=""
SET YSINSNAM=$GET(YS("CODE"),"NO NAME PASSED")
+3 ; Start at YSDATA(3)
SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+4 SET DATA=YSDATA(NODE)
+5 SET YSQN=$PIECE($GET(DATA),U,1)
+6 ; Choice ID
SET YSCDA=$PIECE($GET(DATA),U,3)
+7 ; calculate skipped questions
+8 ; process instrument differently if > 5 questions skipped. below.
IF YSCDA=1155
SET SKIPPED=SKIPPED+1
+9 SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
+10 SET SCORE=SCORE+LEG
+11 SET YSAN=$$GET1^DIQ(601.75,YSCDA_",",3,"I")
+12 IF YSAN="Skipped"!(LEG="")
SET YSAN="Not Answered."
+13 DO DESGNTR^YTSCORE(YSQN,.DES)
+14 SET STRING=STRING_"| "_$GET(DES)_". "_$PIECE($GET(YSAN),"(",1)
+15 IF LEG'="X"
SET STRING=STRING_"("_LEG_$SELECT(LEG=1:" point",1:" points")_")"
End DoDot:1
+16 IF SKIPPED>5
SET SCORE="CND"
+17 QUIT
+18 ;
SCORE1 ;
+1 NEW RANGE,RISK
+2 IF '$DATA(^TMP($JOB,"YSCOR"))
Begin DoDot:1
+3 SET STRING1="| "_YSINSNAM_" score could not be determined. "
End DoDot:1
QUIT
+4 ;
+5 SET SCORE=$PIECE($GET(^TMP($JOB,"YSCOR",2)),"=",2)
+6 IF SKIPPED>5
SET SCORE=-1
Begin DoDot:1
+7 SET STRING1=STRING1_"|BAI score could not be determined."
End DoDot:1
+8 ;
+9 IF SCORE>-1
Begin DoDot:1
+10 SET RISK=$SELECT(SCORE<8:"minimal",SCORE<16:"mild",SCORE<26:"moderate",1:"severe")
+11 SET RANGE=$SELECT(SCORE<8:"between 0 - 7",SCORE<16:"between 8 - 15",SCORE<26:"between 16 - 25",1:"above 25")
+12 SET STRING1=STRING1_"|BAI Score: "_SCORE_" indicates "_RISK_" anxiety."
End DoDot:1
+13 SET STRING1=STRING1_"||The overall range is 0 to 63"
+14 ;
+15 IF SCORE=-1
SET STRING1=STRING1_"."
+16 IF '$TEST
SET STRING1=STRING1_" with "_RISK_" anxiety "_RANGE_"."
+17 ;
+18 SET STRING1=STRING1_"|| 0-7 Minimal level of anxiety"
+19 SET STRING1=STRING1_"| 8-15 Mild anxiety"
+20 SET STRING1=STRING1_"| 16-25 Moderate anxiety"
+21 SET STRING1=STRING1_"| 26-63 Severe anxiety"
+22 SET STRING1=STRING1_"|| Questions and answers"
+23 SET STRING1=STRING1_"| "_STRING
+24 QUIT
+25 ;
SCORESV ;
+1 ;
+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 ;
+7 KILL ^TMP($JOB,"YSCOR")
+8 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+9 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,901_",",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,DES,LEG,NODE,SCORE,SKIPPED,STRING,STRING1
+4 NEW YSCDA,YSINSNAM,YSAN,YSQN
+5 ;
+6 SET (SKIPPED,SCORE)=0
+7 SET (STRING,STRING1)=""
+8 ;
+9 DO DATA1
+10 IF YSTRNG=1
Begin DoDot:1
+11 DO SCORESV
End DoDot:1
+12 IF YSTRNG=2
Begin DoDot:1
+13 DO LDSCORES^YTSCORE(.YSDATA,.YS)
+14 DO SCORE1
+15 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING1
End DoDot:1
+16 QUIT