Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: YTSPROM

YTSPROM.m

Go to the documentation of this file.
YTSPROM ;SLC/MJB- Score PROMIS29 ; 10/14/18 2:02pm
 ;;5.01;MENTAL HEALTH;**151**;Dec 30, 1994;Build 92
 ;
 ; This routine was split from YTQAPI2A.
 ; This routine handles limited complex reporting requirements without
 ; modifying YS_AUX.DLL by adding free text "answers" that can be used by
 ; a report.
 ;,
 ; Assumptions:  EDIT incomplete instrument should ignore the extra answers
 ; since there are no associated questions.  GRAPHING should ignore the
 ; answers since they not numeric.
 ;
 Q
 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
 ;
 N TOTAL,TXT,YSMED,YSOVER,YSTOTAL,YSCALEI,YSRSC,YSSCNAM,SLIDESC
 N YSCAL,YSVAL,YSCALVI,YTSCOR,YSVALA,YSRSC1,YSRSC2,YSRSC3,YSRSC4,YSRSC5,YSRSC6,YSRSC7
 N YSTSC1,YSTSC2,YSTSC3,YSTSC4,YSTSC5,YSTSC6,YSTSC7,II,PROM,YSCALIEN,YSSCNAM,YSTSC
 S N=N+1,II=0
 IF YSTRNG=1 D DATA1 D SCORESV
 I YSTRNG=2 D
 .;D SCORESV
 .D LDSCORES(.YSDATA,.YS)
 .D 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"
 S YSSCNAM=$P($G(^TMP($J,"YSG",3)),U,4)             ; Scale Name=$P($G(^TMP($J,"YSG",3)),U,4)             ; Scale Name=$P($G(^TMP($J,"YSG",3)),U,4)             ; Scale Name
 ;
 K ^TMP($J,"YSCOR")
 S ^TMP($J,"YSCOR",1)="[DATA]"
 ;this needs to be changed to the current instrument scale
 S I=2
 F  S I=$O(^TMP($J,"YSG",I)) Q:'I  D
 .S YSCALIEN=$P($P(^TMP($J,"YSG",I),"^",1),"=",2)
 .S YSRSC="YSRSC"_(I-2)
 .S YSTSC="YSTSC"_(I-2)
 .S ^TMP($J,"YSCOR",I)=$$GET1^DIQ(601.87,YSCALIEN_",",3,"I")_"="_@YSRSC_U_@YSTSC
 Q
 ;
DATA1 ;
 N I
 S N=N+1,II=0
 ;D YSARRAY^YTQAPI2C(.PROM)
 S I="",YSRSC1=0,YSRSC2=0,YSRSC3=0,YSRSC4=0,YSRSC5=0,YSRSC6=0,YSRSC7=0
 F I=3:1:6 S YSRSC1=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC1
 F I=7:1:10 S YSRSC2=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC2
 F I=11:1:14 S YSRSC3=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC3
 F I=15:1:18 S YSRSC4=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC4
 F I=19:1:22 S YSRSC5=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC5
 F I=23:1:26 S YSRSC6=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC6
 F I=27:1:30 S YSRSC7=$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")+YSRSC7
 S SLIDESC=$P(YSDATA(31),"^",3)
 S YSTSC1=$$BRADJ1(YSRSC1)
 S YSTSC2=$$BRADJ2(YSRSC2)
 S YSTSC3=$$BRADJ3(YSRSC3)
 S YSTSC4=$$BRADJ4(YSRSC4)
 S YSTSC5=$$BRADJ5(YSRSC5)
 S YSTSC6=$$BRADJ6(YSRSC6)
 S YSTSC7=$$BRADJ7(YSRSC7)
 Q
 ;
BRADJ1(YSRSC1) ;Adjust the Base Rate based on Scales - Physical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adjust the Base Rate based on Scales - Fatigue
 Q:YSRSC4=4 33.7
 Q:YSRSC4=5 39.7
 Q:YSRSC4=6 43.1
 Q:YSRSC4=7 46.0
 Q:YSRSC4=8 48.6
 Q:YSRSC4=9 51.0
 Q:YSRSC4=10 53.1
 Q:YSRSC4=11 55.1
 Q:YSRSC4=12 57.0
 Q:YSRSC4=13 58.8
 Q:YSRSC4=14 60.7
 Q:YSRSC4=15 62.7
 Q:YSRSC4=16 64.6
 Q:YSRSC4=17 66.7
 Q:YSRSC4=18 69.0
 Q:YSRSC4=19 71.6
 Q:YSRSC4=20 75.8
 Q ""
 ;
BRADJ5(YSRSC5) ;Adjust the Base Rate based on Scales - Sleep Disturbance
 Q:YSRSC5=4 32.0
 Q:YSRSC5=5 37.5
 Q:YSRSC5=6 41.1
 Q:YSRSC5=7 43.8
 Q:YSRSC5=8 46.2
 Q:YSRSC5=9 48.4
 Q:YSRSC5=10 50.5
 Q:YSRSC5=11 52.4
 Q:YSRSC5=12 54.3
 Q:YSRSC5=13 56.1
 Q:YSRSC5=14 57.9
 Q:YSRSC5=15 59.8
 Q:YSRSC5=16 61.7
 Q:YSRSC5=17 63.8
 Q:YSRSC5=18 66.0
 Q:YSRSC5=19 68.8
 Q:YSRSC5=20 73.3
 Q ""
 ;
BRADJ6(YSRSC6) ;Adjust the Base Rate based on Scales - Satisfaction with Social Role
 Q:YSRSC6=4 27.5
 Q:YSRSC6=5 31.8
 Q:YSRSC6=6 34.0
 Q:YSRSC6=7 35.7
 Q:YSRSC6=8 37.3
 Q:YSRSC6=9 38.8
 Q:YSRSC6=10 40.5
 Q:YSRSC6=11 42.3
 Q:YSRSC6=12 44.2
 Q:YSRSC6=13 46.2
 Q:YSRSC6=14 48.1
 Q:YSRSC6=15 50.0
 Q:YSRSC6=16 51.9
 Q:YSRSC6=17 53.7
 Q:YSRSC6=18 55.8
 Q:YSRSC6=19 58.3
 Q:YSRSC6=20 64.2
 Q ""
 ;
BRADJ7(YSRSC7) ;Adjust the Base Rate based on Scales - Pain Interference
 Q:YSRSC7=4 41.6
 Q:YSRSC7=5 49.6
 Q:YSRSC7=6 52.0
 Q:YSRSC7=7 53.9
 Q:YSRSC7=8 55.6
 Q:YSRSC7=9 57.1
 Q:YSRSC7=10 58.5
 Q:YSRSC7=11 59.9
 Q:YSRSC7=12 61.2
 Q:YSRSC7=13 52.5
 Q:YSRSC7=14 63.8
 Q:YSRSC7=15 65.2
 Q:YSRSC7=16 66.6
 Q:YSRSC7=17 68.0
 Q:YSRSC7=18 69.7
 Q:YSRSC7=19 71.6
 Q:YSRSC7=20 75.6
 Q ""
 ;
PAD(VAL,LENGTH) ; padds the value with spaces at beginning
 N RETURN,PADDING
 I VAL="Left blank by the user." S VAL="--"
 S PADDING=LENGTH-$L(VAL)
 I PADDING'>0 Q VAL
 S $P(RETURN," ",PADDING+1)=VAL
 Q RETURN
 ;
STRING ;
 S YSRSC1=$P($G(^TMP($J,"YSCOR",2)),"=",2),YSRSC1=$P(YSRSC1,U,1)
 S YSTSC1=$P($G(^TMP($J,"YSCOR",2)),U,2)
 S YSRSC2=$P($G(^TMP($J,"YSCOR",3)),"=",2),YSRSC2=$P(YSRSC2,U,1)
 S YSTSC2=$P($G(^TMP($J,"YSCOR",3)),U,2)
 S YSRSC3=$P($G(^TMP($J,"YSCOR",4)),"=",2),YSRSC3=$P(YSRSC3,U,1)
 S YSTSC3=$P($G(^TMP($J,"YSCOR",4)),U,2)
 S YSRSC4=$P($G(^TMP($J,"YSCOR",5)),"=",2),YSRSC4=$P(YSRSC4,U,1)
 S YSTSC4=$P($G(^TMP($J,"YSCOR",5)),U,2)
 S YSRSC5=$P($G(^TMP($J,"YSCOR",6)),"=",2),YSRSC5=$P(YSRSC5,U,1)
 S YSTSC5=$P($G(^TMP($J,"YSCOR",6)),U,2)
 S YSRSC6=$P($G(^TMP($J,"YSCOR",7)),"=",2),YSRSC6=$P(YSRSC6,U,1)
 S YSTSC6=$P($G(^TMP($J,"YSCOR",7)),U,2)
 S YSRSC7=$P($G(^TMP($J,"YSCOR",8)),"=",2),YSRSC7=$P(YSRSC7,U,1)
 S YSTSC7=$P($G(^TMP($J,"YSCOR",8)),U,2)
 S YSDATA(N)="7771^9999;1^"_$$PAD(YSRSC1,2) S N=N+1
 S YSDATA(N)="7772^9999;1^"_$$PAD(YSRSC2,2) S N=N+1
 S YSDATA(N)="7773^9999;1^"_$$PAD(YSRSC3,2) S N=N+1
 S YSDATA(N)="7774^9999;1^"_$$PAD(YSRSC4,2) S N=N+1
 S YSDATA(N)="7775^9999;1^"_$$PAD(YSRSC5,2) S N=N+1
 S YSDATA(N)="7776^9999;1^"_$$PAD(YSRSC6,2) S N=N+1
 S YSDATA(N)="7777^9999;1^"_$$PAD(YSRSC7,2) S N=N+1
 S YSDATA(N)="7778^9999;1^"_YSTSC1 S N=N+1
 S YSDATA(N)="7779^9999;1^"_YSTSC2 S N=N+1
 S YSDATA(N)="7780^9999;1^"_YSTSC3 S N=N+1
 S YSDATA(N)="7781^9999;1^"_YSTSC4 S N=N+1
 S YSDATA(N)="7782^9999;1^"_YSTSC5 S N=N+1
 S YSDATA(N)="7783^9999;1^"_YSTSC6 S N=N+1
 S YSDATA(N)="7784^9999;1^"_YSTSC7 S N=N+1
 Q
 ;
LDSCORES(YSDATA,YS) ;  new call for patch 123 using to get T-scores
 ;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
 ;