YTSFTND ;SLC/BLD - Fagerström Test for Nicotine Dependence (FTND) ; 9/26/2018
;;5.01;MENTAL HEALTH;**147**;DEC 30,1994;Build 283
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
;
S TOTAL=0
F I=3:1 Q:'$D(YSDATA(I)) S TOTAL=$G(TOTAL)+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
;
Q
;
STRING ;
;
N TXT,FTND,TEXT1,TEXT2,TEXT3,TXT2
S N=N+1
I '$D(^TMP($J,"YSCOR")) D LDSCORES(.YSDATA,.YS)
I ^TMP($J,"YSCOR",1)'="[DATA]" Q
S TOTAL=$P(^TMP($J,"YSCOR",2),"=",2)
S TEXT1=" indicating "
;S TEXT2="nicotine dependence."
I TOTAL<3 S TEXT3="VERY LOW nicotine dependence."
I TOTAL>2,TOTAL<5 S TEXT3="LOW nicotine dependence."
I TOTAL=5 S TEXT3="MEDIUM nicotine dependence."
I TOTAL>5,TOTAL<8 S TEXT3="HIGH nicotine dependence."
I TOTAL>7 S TEXT3="VERY HIGH nicotine dependence."
S YSDATA(N)="7771^9999;1^"_TOTAL_TEXT1_TEXT3
;
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")_"="_TOTAL
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
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[HYTSFTND 2207 printed Oct 16, 2024@18:20:32 Page 2
YTSFTND ;SLC/BLD - Fagerstrm Test for Nicotine Dependence (FTND) ; 9/26/2018
+1 ;;5.01;MENTAL HEALTH;**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 TOTAL=0
+3 FOR I=3:1
if '$DATA(YSDATA(I))
QUIT
SET TOTAL=$GET(TOTAL)+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+4 ;
+5 QUIT
+6 ;
STRING ;
+1 ;
+2 NEW TXT,FTND,TEXT1,TEXT2,TEXT3,TXT2
+3 SET N=N+1
+4 IF '$DATA(^TMP($JOB,"YSCOR"))
DO LDSCORES(.YSDATA,.YS)
+5 IF ^TMP($JOB,"YSCOR",1)'="[DATA]"
QUIT
+6 SET TOTAL=$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+7 SET TEXT1=" indicating "
+8 ;S TEXT2="nicotine dependence."
+9 IF TOTAL<3
SET TEXT3="VERY LOW nicotine dependence."
+10 IF TOTAL>2
IF TOTAL<5
SET TEXT3="LOW nicotine dependence."
+11 IF TOTAL=5
SET TEXT3="MEDIUM nicotine dependence."
+12 IF TOTAL>5
IF TOTAL<8
SET TEXT3="HIGH nicotine dependence."
+13 IF TOTAL>7
SET TEXT3="VERY HIGH nicotine dependence."
+14 SET YSDATA(N)="7771^9999;1^"_TOTAL_TEXT1_TEXT3
+15 ;
+16 QUIT
+17 ;
+18 ;
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")_"="_TOTAL
+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
End DoDot:1
+11 QUIT
+12 ;
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