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

YTSI9CSS.m

Go to the documentation of this file.
  1. YTSI9CSS ;SLC/BLD- MHAX ANSWERS SPECIAL HANDLING FOR I9-CSS; 10/11/18 2:18pm
  1. ;;5.01;MENTAL HEALTH;**151**;DEC 30,1994;Build 92
  1. ;
  1. DATA1(SCORE) ;expects YSDATA, returns SCORE, multiple scales so we use nodes i.e. SCORE(SCALEIEN)=###
  1. ;specialized DATA1 uses SCOREDATA table to map question to score relationships
  1. N QUES,TEXT
  1. F I=1:1:9 D
  1. .N SCALE,NODE,DATA,RAW
  1. .S SCALE=I+1126
  1. .S NODE=I+2 ;YSDATA question nodes start at 3
  1. .S DATA=YSDATA(NODE)
  1. .S RAW=$$GET1^DIQ(601.75,$P($G(DATA),U,3)_",",4,"I")
  1. .I RAW="X" S RAW="" ;skipped question
  1. .S SCORE(SCALE)=RAW
  1. Q
  1. ;
  1. DLLSTR(YSDATA,YS,YSTRNG) ;
  1. ; YSTRNG = 1 Score Instrument
  1. ; YSTRNG = 2 get Report Answers and Text
  1. N DATA,DES,LEG,NODE,YSQN,YSSCALIEN,TOTSCORE
  1. N YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1,YSCORE
  1. ;
  1. I YSTRNG=1 D DATA1(.SCORE),SCORESV(.SCORE)
  1. I YSTRNG=2 D LDSCORES^YTSCORE("",.YS),BUILDANS(.YSDATA,YSAD)
  1. Q
  1. ;
  1. SCORESV(SCORE) ;Expects SCORE to be in format SCORE(SCALE_IEN)=###. Also expects ^TMP($J,"YSG")
  1. N YSCORNODE,YSGNODE
  1. I $D(^TMP($J,"YSG",1)),^TMP($J,"YSG",1)="[ERROR]" D Q ;-->out
  1. .K ^TMP($J,"YSCOR")
  1. .S ^TMP($J,"YSCOR",1)="[ERROR]"
  1. .S ^TMP($J,"YSCOR",2)="No Scale found for ADMIN"
  1. ;
  1. K ^TMP($J,"YSCOR")
  1. S ^TMP($J,"YSCOR",1)="[DATA]"
  1. S YSCORNODE=2
  1. S YSGNODE=2 F S YSGNODE=$O(^TMP($J,"YSG",YSGNODE)) Q:YSGNODE="" D
  1. .N SCALEIEN
  1. .I $E(^TMP($J,"YSG",YSGNODE),1,5)'="Scale" Q ;only read the lines for scales
  1. .S SCALEIEN=+$P(^TMP($J,"YSG",YSGNODE),"=",2) ;grab the first number after "=" sign
  1. .S ^TMP($J,"YSCOR",YSCORNODE)=$$GET1^DIQ(601.87,SCALEIEN_",",3,"I")_"="_SCORE(SCALEIEN)
  1. .S YSCORNODE=YSCORNODE+1
  1. ;
  1. Q
  1. ;
  1. BUILDANS(YSDATA,YSAD) ; add "hidden" computed question text
  1. ;
  1. N IEN,LP,SCRE,TEXT,TEXT1,TEXT1A,TEXT1B,TEXT2,TEXT2A,TEXT2B,I,SCORES,N
  1. S N=$O(YSDATA(""),-1)+1
  1. S SCORES=""
  1. I ^TMP($J,"YSCOR",1)'="[DATA]" Q
  1. S LP=1
  1. S TEXT1="The results of this administration suggest the presence of at least some suicidal ideation without"
  1. S TEXT1A="specific plan or intent AND/OR a history of suicidal behavior."
  1. S TEXT1B="Further suicide risk evaluation or clinical management may be needed."
  1. S TEXT2="The results of this administration suggest the presence of SUICIDAL IDEATION WITH AT LEAST SOME"
  1. S TEXT2A="INTENT TO DIE in the past one month AND/OR presence of RECENT SUICIDAL BEHAVIOR. This indicates a"
  1. S TEXT2B="need for further suicide risk evaluation and clinical management."
  1. ;
  1. F S LP=$O(^TMP($J,"YSCOR",LP)) Q:'LP D
  1. .; Ques 1: Not at all=0,Several days=1,More than half the days=2,Nearly every day=3
  1. .; Ques 2-9: Yes=1, No=2 and Skipped=0
  1. .S SCRE=+$P(^TMP($J,"YSCOR",LP),"=",2)
  1. .S SCORES=SCORES_SCRE
  1. ; First level suicide risk screening - question 1
  1. I $E(SCORES,1)=0 D Q
  1. .S YSDATA(N)="7775^9999;1^NEGATIVE" S N=N+1
  1. .S YSDATA(N)="7774^9999;1^None"
  1. S YSDATA(N)="7775^9999;1^POSITIVE" S N=N+1
  1. S YSDATA(N)="7776^9999;1^SECONDARY SUICIDE RISK SCREEN (C-SSRS)" S N=N+1
  1. ; get Suicidal Ideation in last month - question 2 and 3
  1. D
  1. .S YSDATA(N)="7771^9999;1^Suicidal Ideation in Past Month: "
  1. .I $E(SCORES,3)=1 S YSDATA(N)=YSDATA(N)_"Yes - Suicidal thoughts" S N=N+1 Q
  1. .I ($E(SCORES,2)=1)&($E(SCORES,3)=2) S YSDATA(N)=YSDATA(N)_"Yes - Wish to die" S N=N+1 Q
  1. .I ($E(SCORES,2)=2)&($E(SCORES,3)=2) S YSDATA(N)=YSDATA(N)_"None endorsed" S N=N+1 Q
  1. ;
  1. ; get Method/plan/Intent in last month - question 4,5,6 and 7
  1. S IEN=N
  1. D I '$D(YSDATA(IEN)) D CSSRS(SCORES)
  1. .S YSDATA(N)="7772^9999;1^Method/Plan/Intent in Past Month: "
  1. .I ($E(SCORES,6)=1)&($E(SCORES,7)=1) S YSDATA(N)=YSDATA(N)_"Method with specific plan and intent" S N=N+1 Q
  1. .I ($E(SCORES,6)=1)&($E(SCORES,7)=2) S YSDATA(N)=YSDATA(N)_"Method with specific plan and at least some intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=1)&($E(SCORES,5)=1)&($E(SCORES,6)=1)&($E(SCORES,7)=2) S YSDATA(N)=YSDATA(N)_"Method with specific plan and at least some intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=1)&($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)=YSDATA(N)_"Method with at least some intent and no specific plan" S N=N+1 Q
  1. .I ($E(SCORES,4)=1)&($E(SCORES,5)=2)&($E(SCORES,6)=2) S YSDATA(N)=YSDATA(N)_"Method but with no specific plan or intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=2)&($E(SCORES,5)=2)&($E(SCORES,6)=2) S YSDATA(N)=YSDATA(N)_"No method, no specific plan, and no intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=2)&($E(SCORES,5)=2)&($E(SCORES,6)=1) S YSDATA(N)=YSDATA(N)_"Method with specific plan and no intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=2)&($E(SCORES,5)=1)&($E(SCORES,6)=1)&($E(SCORES,7)=1) S YSDATA(N)=YSDATA(N)_"Method with specific plan and some intent" S N=N+1 Q
  1. .I ($E(SCORES,4)=2)&($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)=YSDATA(N)_"Method with at least some intent and no specific plan" S N=N+1 Q
  1. .I ($E(SCORES,4)=0)&($E(SCORES,5)=0)&($E(SCORES,6)=0) S YSDATA(N)=YSDATA(N)_"No method, no specific plan, and no intent" S N=N+1 Q
  1. .S YSDATA(N)=YSDATA(N)_"END!",N=N+1
  1. ;
  1. ; get Sucidal Behavior based on question 8 and 9
  1. D
  1. .S YSDATA(N)="7773^9999;1^Suicidal Behavior: "
  1. .I ($E(SCORES,9)=1) S YSDATA(N)=YSDATA(N)_"Recent Suicidal Behavior (<3 months)" S N=N+1 Q
  1. .I ($E(SCORES,8)=1)&($E(SCORES,9)=2) S YSDATA(N)=YSDATA(N)_"Past Suicidal Behavior (>3 Months)" S N=N+1 Q
  1. .I ($E(SCORES,8)=2) S YSDATA(N)=YSDATA(N)_"No Past Suicidal Behavior Reported" S N=N+1 Q
  1. ;
  1. ;Screening Indicators
  1. I $E(SCORES,4,7)_$E(SCORES,9)["1" D Q
  1. .S YSDATA(N)="7774^9999;1^"_TEXT2 S N=N+1
  1. .S YSDATA(N)="7777^9999;1^"_TEXT2A S N=N+1
  1. .S YSDATA(N)="7778^9999;1^"_TEXT2B S N=N+1
  1. ;
  1. S YSDATA(N)="7774^9999;1^"_TEXT1 S N=N+1
  1. S YSDATA(N)="7777^9999;1^"_TEXT1A S N=N+1
  1. S YSDATA(N)="7778^9999;1^"_TEXT1B S N=N+1
  1. ; Get results code is saved in One Note
  1. Q
  1. ;
  1. CSSRS(SCORES) ;logic for method/plan/intent section of CSSRS report
  1. ;
  1. I ($E(SCORES,5)=1)&($E(SCORES,6)=1) S YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent" S N=N+1 Q
  1. I ($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)="7772^9999;1^Method with specific plan and no intent" S N=N+1 Q
  1. ;