YTSCSSR2 ;ISP/LMT - C-SSRS_V2 Report ;Aug 06, 2025@12:06:28
;;5.01;MENTAL HEALTH;**269**;Dec 30, 1994;Build 7
;
;
DLLSTR(YSDATA,YS,YSTRNG) ; compute scores or report text based on YSTRNG
; input
; YSDATA(2)=adminId^patientDFN^instrumentName^dateGiven^isComplete
; YSDATA(2+n)=questionId^sequence^choiceId
; YS("AD")=adminId
; YSTRNG=1 for score, 2 for report
; output if YSTRNG=1: ^TMP($J,"YSCOR",n)=scaleId=score
; output if YSTRNG=2: append special "answers" to YSDATA
;
I YSTRNG=1 D BYKEY^YTSCORE(.YSDATA) ; just use "regular" scoring
;
I YSTRNG=2 D REPORT(.YSDATA,.YS)
;
Q
;
REPORT(YSDATA,YS) ; Add Interpretation to report
;
N YSHIGH,YSI,YSINTERP,YSLOW,YSMOD,YSN,YSNAME,YSNONE,YSSCORE,YSVALUE
;Line breaks and line spacing behaves differently between MH REPORT and PROGRESS NOTE
;Be careful making changes to risk level text.
S YSNONE=" No C-SSRS items endorsed. No additional action is required |"
S YSNONE=YSNONE_" based on current screening results."
S YSLOW=" Items endorsed indicate LOW risk C-SSRS screening level: Mental health |"
S YSLOW=YSLOW_" follow-up (may include but is not limited to, reviewing mental |"
S YSLOW=YSLOW_" health needs with a provider) must be offered."
S YSMOD=" Items endorsed indicate MODERATE risk C-SSRS screening level: |"
S YSMOD=YSMOD_" Mental health follow-up (may include but is not limited to, |"
S YSMOD=YSMOD_" reviewing mental health needs with a provider) must be offered."
S YSHIGH=" Items endorsed indicate HIGH risk C-SSRS screening level. Address any |"
S YSHIGH=YSHIGH_" immediate safety concerns. The Comprehensive Suicide Risk Evaluation must|"
S YSHIGH=YSHIGH_" be completed and documented by an LIP or APP same day (except in settings|"
S YSHIGH=YSHIGH_" that allow up to 24 hrs.)."
;
; Get Score
S YSSCORE=""
K ^TMP($J,"YSCOR")
D LDSCORES^YTSCORE(.YSDATA,.YS) ; puts score into ^TMP($J,"YSCOR",2)
S YSI=0 F S YSI=$O(^TMP($J,"YSCOR",YSI)) Q:'YSI D
. S YSNAME=$P(^TMP($J,"YSCOR",YSI),"=")
. S YSVALUE=$P(^TMP($J,"YSCOR",YSI),"=",2)
. I YSNAME="Total" S YSSCORE=YSVALUE
K ^TMP($J,"YSCOR")
;
; Calculate interpretation based off score
S YSINTERP=""
I YSSCORE=0 S YSINTERP=YSNONE ; 0 = no items endorsed/no action required
I YSSCORE>0,YSSCORE<3 S YSINTERP=YSLOW ; 1-2 = low risk C-SSRS screening level
I YSSCORE>2,YSSCORE<13 S YSINTERP=YSMOD ; 3-12 = moderate risk C-SSRS screening
I YSSCORE>12 S YSINTERP=YSHIGH ; 13+ = high risk C-SSRS screening level
;
S YSN=$O(YSDATA(""),-1) ; get last node
S YSDATA(YSN+1)="7771^9999;1^"_YSINTERP
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSCSSR2 2656 printed Jul 11, 2026@02:16:10 Page 2
YTSCSSR2 ;ISP/LMT - C-SSRS_V2 Report ;Aug 06, 2025@12:06:28
+1 ;;5.01;MENTAL HEALTH;**269**;Dec 30, 1994;Build 7
+2 ;
+3 ;
DLLSTR(YSDATA,YS,YSTRNG) ; compute scores or report text based on YSTRNG
+1 ; input
+2 ; YSDATA(2)=adminId^patientDFN^instrumentName^dateGiven^isComplete
+3 ; YSDATA(2+n)=questionId^sequence^choiceId
+4 ; YS("AD")=adminId
+5 ; YSTRNG=1 for score, 2 for report
+6 ; output if YSTRNG=1: ^TMP($J,"YSCOR",n)=scaleId=score
+7 ; output if YSTRNG=2: append special "answers" to YSDATA
+8 ;
+9 ; just use "regular" scoring
IF YSTRNG=1
DO BYKEY^YTSCORE(.YSDATA)
+10 ;
+11 IF YSTRNG=2
DO REPORT(.YSDATA,.YS)
+12 ;
+13 QUIT
+14 ;
REPORT(YSDATA,YS) ; Add Interpretation to report
+1 ;
+2 NEW YSHIGH,YSI,YSINTERP,YSLOW,YSMOD,YSN,YSNAME,YSNONE,YSSCORE,YSVALUE
+3 ;Line breaks and line spacing behaves differently between MH REPORT and PROGRESS NOTE
+4 ;Be careful making changes to risk level text.
+5 SET YSNONE=" No C-SSRS items endorsed. No additional action is required |"
+6 SET YSNONE=YSNONE_" based on current screening results."
+7 SET YSLOW=" Items endorsed indicate LOW risk C-SSRS screening level: Mental health |"
+8 SET YSLOW=YSLOW_" follow-up (may include but is not limited to, reviewing mental |"
+9 SET YSLOW=YSLOW_" health needs with a provider) must be offered."
+10 SET YSMOD=" Items endorsed indicate MODERATE risk C-SSRS screening level: |"
+11 SET YSMOD=YSMOD_" Mental health follow-up (may include but is not limited to, |"
+12 SET YSMOD=YSMOD_" reviewing mental health needs with a provider) must be offered."
+13 SET YSHIGH=" Items endorsed indicate HIGH risk C-SSRS screening level. Address any |"
+14 SET YSHIGH=YSHIGH_" immediate safety concerns. The Comprehensive Suicide Risk Evaluation must|"
+15 SET YSHIGH=YSHIGH_" be completed and documented by an LIP or APP same day (except in settings|"
+16 SET YSHIGH=YSHIGH_" that allow up to 24 hrs.)."
+17 ;
+18 ; Get Score
+19 SET YSSCORE=""
+20 KILL ^TMP($JOB,"YSCOR")
+21 ; puts score into ^TMP($J,"YSCOR",2)
DO LDSCORES^YTSCORE(.YSDATA,.YS)
+22 SET YSI=0
FOR
SET YSI=$ORDER(^TMP($JOB,"YSCOR",YSI))
if 'YSI
QUIT
Begin DoDot:1
+23 SET YSNAME=$PIECE(^TMP($JOB,"YSCOR",YSI),"=")
+24 SET YSVALUE=$PIECE(^TMP($JOB,"YSCOR",YSI),"=",2)
+25 IF YSNAME="Total"
SET YSSCORE=YSVALUE
End DoDot:1
+26 KILL ^TMP($JOB,"YSCOR")
+27 ;
+28 ; Calculate interpretation based off score
+29 SET YSINTERP=""
+30 ; 0 = no items endorsed/no action required
IF YSSCORE=0
SET YSINTERP=YSNONE
+31 ; 1-2 = low risk C-SSRS screening level
IF YSSCORE>0
IF YSSCORE<3
SET YSINTERP=YSLOW
+32 ; 3-12 = moderate risk C-SSRS screening
IF YSSCORE>2
IF YSSCORE<13
SET YSINTERP=YSMOD
+33 ; 13+ = high risk C-SSRS screening level
IF YSSCORE>12
SET YSINTERP=YSHIGH
+34 ;
+35 ; get last node
SET YSN=$ORDER(YSDATA(""),-1)
+36 SET YSDATA(YSN+1)="7771^9999;1^"_YSINTERP
+37 ;
+38 QUIT