YTSBS24P ;SLC/BLD- MHAX ANSWERS SPECIAL HANDLING FOR BASIS-24 PSYCHOSIS ;2/7/2018
;;5.01;MENTAL HEALTH;**123,147**;DEC 30,1994;Build 283
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,LEG,NODE,YSQN,YSSCALIEN,TOTSCORE,QUES,BASIS,PYSTOTT,PYSTOT
N YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1,PYSTOT
;
; Basis-24 Psychosis 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($O(YSDATA(""),-1)+1)=999999999999_U_U_STRING
;
Q
;
STRING ;
;
I '$D(^TMP($J,"YSCOR",2)) D LDSCORES(.YSDATA,.YS)
S STRING="Psychotic Symptoms: "_$P(^TMP($J,"YSCOR",2),"=",2)
Q
;
DATA1 ;
;
S N=N+1
S QUES=0
F QUES=3:1:6 D
.S PYSTOTT=+$$GET1^DIQ(601.75,$P(YSDATA(QUES),"^",3)_",",4,"I")
.I QUES=3 S PYSTOT=$G(PYSTOT)+(0.1049*PYSTOTT) Q
.I QUES=4 S PYSTOT=$G(PYSTOT)+(0.136*PYSTOTT) Q
.I QUES=5 S PYSTOT=$G(PYSTOT)+(0.4636*PYSTOTT) Q
.I QUES=6 S PYSTOT=$G(PYSTOT)+(0.2955*PYSTOTT) Q
;
Q
;
SCORESV ;
N YSSCGROUP
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 YSSCGROUP=$P($P(^TMP($J,"YSG",2),"^",1),"=",2)
S YSSCALIEN=$P($P(^TMP($J,"YSG",3),"^",1),"=",2)
;
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_+$FN(PYSTOT,"",2)
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[HYTSBS24P 2103 printed Dec 13, 2024@02:19:25 Page 2
YTSBS24P ;SLC/BLD- MHAX ANSWERS SPECIAL HANDLING FOR BASIS-24 PSYCHOSIS ;2/7/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 ;
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,TOTSCORE,QUES,BASIS,PYSTOTT,PYSTOT
+4 NEW YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1,PYSTOT
+5 ;
+6 ; Basis-24 Psychosis returns a scale score which is calculated and stored, no special text in report
+7 IF YSTRNG=1
DO SCORESV
+8 IF YSTRNG=2
Begin DoDot:1
+9 DO STRING
+10 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING
End DoDot:1
+11 ;
+12 QUIT
+13 ;
STRING ;
+1 ;
+2 IF '$DATA(^TMP($JOB,"YSCOR",2))
DO LDSCORES(.YSDATA,.YS)
+3 SET STRING="Psychotic Symptoms: "_$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+4 QUIT
+5 ;
DATA1 ;
+1 ;
+2 SET N=N+1
+3 SET QUES=0
+4 FOR QUES=3:1:6
Begin DoDot:1
+5 SET PYSTOTT=+$$GET1^DIQ(601.75,$PIECE(YSDATA(QUES),"^",3)_",",4,"I")
+6 IF QUES=3
SET PYSTOT=$GET(PYSTOT)+(0.1049*PYSTOTT)
QUIT
+7 IF QUES=4
SET PYSTOT=$GET(PYSTOT)+(0.136*PYSTOTT)
QUIT
+8 IF QUES=5
SET PYSTOT=$GET(PYSTOT)+(0.4636*PYSTOTT)
QUIT
+9 IF QUES=6
SET PYSTOT=$GET(PYSTOT)+(0.2955*PYSTOTT)
QUIT
End DoDot:1
+10 ;
+11 QUIT
+12 ;
SCORESV ;
+1 NEW YSSCGROUP
+2 DO DATA1
+3 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+4 KILL ^TMP($JOB,"YSCOR")
+5 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+6 SET ^TMP($JOB,"YSCOR",2)=$GET(YSINSNAM)_" Scale not found"
End DoDot:1
QUIT
+7 ; Scale Name
SET YSSCNAM=$PIECE($GET(^TMP($JOB,"YSG",3)),U,4)
+8 ;
+9 KILL ^TMP($JOB,"YSCOR")
+10 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+11 ;
+12 SET YSSCGROUP=$PIECE($PIECE(^TMP($JOB,"YSG",2),"^",1),"=",2)
+13 SET YSSCALIEN=$PIECE($PIECE(^TMP($JOB,"YSG",3),"^",1),"=",2)
+14 ;
+15 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_+$FNUMBER(PYSTOT,"",2)
+16 QUIT
+17 ;
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