YTSMPIPN ;SLC/BLD - Score for MPI-PAIN-INTRF (MPI-PAIN-INTRF) ; 01/08/2016
;;5.01;MENTAL HEALTH;**123,147**;DEC 30,1994;Build 283
;
;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")
N TOTAL,TXT,WHYMPI,TEXT1,TEXT2,QUETOT,WHYMPI
S N=N+1
F I=3:1:13 D
.I $L($P(YSDATA(I),"^",3))<2 S STRING=$G(STRING)+$P(YSDATA(I),"^",3),QUETOT=$G(QUETOT)+1
S STRING=+$FN(STRING/QUETOT,"",2)
;
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=1113 ;this needs to be changed to the current instrument scale
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_STRING
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,LEG,NODE,STAGE,YSQN,YSSCALIEN,STRING1,TMP,TSTNM
N YSCDA,YSSCNAM,YSINSNAM,STRING,YSCORE,I
;
; WHYMPI-INTRF returns a scale score which is calculated and stored, no special text in report
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.I '$D(^TMP($J,"YSCOR",2)) D LDSCORES^YTSCORE(.YSDATA,.YS)
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_$P(^TMP($J,"YSCOR",2),"=",2)
;
Q
;
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.D LDSCORES^YTSCORE(.YSDATA,.YS)
.;D TRANS
.S STRING=STRING_STRING1
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_STRING
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSMPIPN 1689 printed Dec 13, 2024@02:20:21 Page 2
YTSMPIPN ;SLC/BLD - Score for MPI-PAIN-INTRF (MPI-PAIN-INTRF) ; 01/08/2016
+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 ;
DATA1 ;
+1 SET YSINSNAM=$PIECE(YSDATA(2),U,3)
+2 IF $GET(YSINSNAM)=""
SET YSINSNAM=$GET(YS("CODE"),"NO NAME PASSED")
+3 NEW TOTAL,TXT,WHYMPI,TEXT1,TEXT2,QUETOT,WHYMPI
+4 SET N=N+1
+5 FOR I=3:1:13
Begin DoDot:1
+6 IF $LENGTH($PIECE(YSDATA(I),"^",3))<2
SET STRING=$GET(STRING)+$PIECE(YSDATA(I),"^",3)
SET QUETOT=$GET(QUETOT)+1
End DoDot:1
+7 SET STRING=+$FNUMBER(STRING/QUETOT,"",2)
+8 ;
+9 QUIT
+10 ;
SCORESV ;
+1 ;
+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 ;this needs to be changed to the current instrument scale
SET YSSCALIEN=1113
+12 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,YSSCALIEN_",",3,"I")_"="_STRING
+13 QUIT
+14 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,DES,LEG,NODE,STAGE,YSQN,YSSCALIEN,STRING1,TMP,TSTNM
+4 NEW YSCDA,YSSCNAM,YSINSNAM,STRING,YSCORE,I
+5 ;
+6 ; WHYMPI-INTRF 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 IF '$DATA(^TMP($JOB,"YSCOR",2))
DO LDSCORES^YTSCORE(.YSDATA,.YS)
+10 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
End DoDot:1
+11 ;
+12 QUIT
+13 ;
+14 IF YSTRNG=1
DO SCORESV
+15 IF YSTRNG=2
Begin DoDot:1
+16 DO LDSCORES^YTSCORE(.YSDATA,.YS)
+17 ;D TRANS
+18 SET STRING=STRING_STRING1
+19 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING
End DoDot:1
+20 QUIT
+21 ;