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

YTSSODU.m

Go to the documentation of this file.
  1. YTSSODU ;BAL/KTL - Score SODU ; 10/07/23 2:02pm
  1. ;;5.01;MENTAL HEALTH;**238**;Dec 30, 1994;Build 25
  1. ;
  1. DLLSTR(YSDATA,YS,YSTRNG) ; compute scores or report text based on YSTRNG
  1. ; input
  1. ; YSDATA(2)=adminId^patientDFN^instrumentName^dateGiven^isComplete
  1. ; YSDATA(2+n)=questionId^sequence^choiceId
  1. ; YS("AD")=adminId
  1. ; YSTRNG=1 for score, 2 for report
  1. ; output if YSTRNG=1: ^TMP($J,"YSCOR",n)=scaleId=score
  1. ; output if YSTRNG=2: append special "answers" to YSDATA
  1. ;
  1. I YSTRNG=1 D SCORESV
  1. I YSTRNG=2 D
  1. . N SCOREVAL,LEVEL,N
  1. . D LDSCORES^YTSCORE(.YSDATA,.YS) ; puts score into ^TMP($J,"YSCOR",2)
  1. . D REPORT(.SCOREVAL)
  1. . S N=$O(YSDATA(""),-1) ; get last node
  1. . S YSDATA(N+1)="7771^9999;1^"_SCOREVAL
  1. Q
  1. ;
  1. SCORESV ; calculate the score
  1. ; expects YSDATA from DLLSTR
  1. N YTI,YTCHC,SCORE,YTQUES,YTRES
  1. S YTRES="NEGATIVE"
  1. S YTI=2 F S YTI=$O(YSDATA(YTI)) Q:'YTI D
  1. . S YTQUES=$P(YSDATA(YTI),U)
  1. . S YTCHC=$P(YSDATA(YTI),U,3)
  1. . I (YTCHC=1155)!(YTCHC=1156)!(YTCHC=1157) Q ; N/A or skipped
  1. . I YTQUES=9255,(YTCHC>6) S YTRES="POSITIVE"
  1. . I YTQUES=9256,(YTCHC>1) S YTRES="POSITIVE"
  1. ;
  1. ; set scores into ^TMP($J,"YSCOR",n)=scaleId=rawScore^tScore
  1. K ^TMP($J,"YSCOR")
  1. S SCORE=$S(YTRES="POSITIVE":1,1:0)
  1. I $D(^TMP($J,"YSG",1)),^TMP($J,"YSG",1)="[ERROR]" D Q ;-->out
  1. . S ^TMP($J,"YSCOR",1)="[ERROR]"
  1. . S ^TMP($J,"YSCOR",2)="No Scale found for ADMIN"
  1. S ^TMP($J,"YSCOR",1)="[DATA]"
  1. S ^TMP($J,"YSCOR",2)=$P(^YTT(601.87,1558,0),U,4)_"="_SCORE
  1. Q
  1. REPORT(SCORES) ; build the scoring display for the report
  1. ; expects ^TMP($J,"YSCOR",...) and ^TMP($J,"YSG") from DLLSTR
  1. ; YSDATA from DLLSTR
  1. N I,VALUE
  1. S SCORES="NEGATIVE"
  1. S I=1 F S I=$O(^TMP($J,"YSCOR",I)) Q:'I D
  1. . S VALUE=$P(^TMP($J,"YSCOR",I),"=",2)
  1. . I VALUE>0 S SCORES="POSITIVE"
  1. S SCORES="SODU is "_SCORES_" for DUD and NCDU."
  1. Q
  1. VERIFY(ARGS,RESULTS) ; Add inconsistency messages based on set of answers in ARGS
  1. N MSGCNT S MSGCNT=0
  1. I $$LT("q9255","q9256") D MSG("more","1","2")
  1. S RESULTS("count")=MSGCNT
  1. Q
  1. LT(ID1,ID2) ; returns 1 if ID1 is less than ID2
  1. ; expects ARGS from VERIFY
  1. N VAL1,VAL2 ; 1155=not answered, 1156=skipped by rule
  1. S VAL1=$G(ARGS(ID1)) S:(VAL1="c1156")!(VAL1="c1155") VAL1=0
  1. S VAL2=$G(ARGS(ID2)) S:(VAL2="c1156")!(VAL2="c1155") VAL2=0
  1. I +VAL1<+VAL2 Q 1
  1. Q 0
  1. MSG(REL,Q1,Q2) ; Add text of message to RESULTS
  1. ; expects MSGCNT, RESULTS from VERIFY
  1. N X
  1. S X="There is an inconsistency: The number of days entered in Question "_Q1
  1. S X=X_" should be equal to, or "_REL_" than,"
  1. S X=X_" the number of days in Question "_Q2_"."
  1. S MSGCNT=MSGCNT+1,RESULTS("messages",MSGCNT)=X
  1. Q