YTSMINIC ;SLC/PIJ - Score MINI COG ; 01/08/2016
;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
S YSINSNAM=$P($G(YSDATA(2)),U,3)
I $G(YSINSNAM)="" S YSINSNAM=$G(YS("CODE"),"NO NAME PASSED")
S NODE=2 F S NODE=$O(YSDATA(NODE)) Q:NODE="" D ; Start at YSDATA(3)
.S DATA=YSDATA(NODE)
.S YSQN=$P(DATA,U,1)
.S YSSEQ=$P(DATA,U,2),YSSEQ=$P(YSSEQ,";",1)
.S YSCDA=$P($G(DATA),U,3)
.D DESGNTR^YTSCORE(YSQN,.DES)
.S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
.I (DES=1),(LEG=0) S CLOCK="false"
.; Skipped Question
.I LEG="X" S SKIPQUES=SKIPQUES+1
.E D
..I (LEG=1) S TOTAL=TOTAL+1
I SKIPQUES>0 S TOTAL="CND"
Q
;
STRING ;
N STR1
I '$D(^TMP($J,"YSCOR")) D Q
.S STRING="| "_YSINSNAM_" score could not be determined. "
;
S TOTAL=$P($G(^TMP($J,"YSCOR",2)),"=",2)
S STRING="Mini-Cog Results: "
;
I SKIPQUES>0 D Q
.S STRING="|"_STRING_"Too many items were skipped to score this administration."
;
;if total = 0, value of CLOCK doesn't matter, positive screen
I (TOTAL=0) S STR1="Positive for cognitive impairment."
I (TOTAL>2) S STR1="Negative screen for dementia."
;
I (TOTAL=1)!(TOTAL=2) D
.I CLOCK="true" S STR1="Negative screen for dementia."
.E S STR1="Positive for cognitive impairment."
;
S STRING="|"_STRING_TOTAL_" "_STR1
;
SCORESV ; Used for Graph and Table
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)=YSINSNAM_" Scale not found"
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,624_",",3,"I")_"="_TOTAL
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,NODE,LEG,YSQN,YSSEQ,YSCDA
N YSSCID,YSINSNAM
N STRING,TOTAL,CLOCK,SKIPQUES
;
S (SKIPQUES,TOTAL)=0
S STRING=""
S CLOCK="true"
;
D DATA1
;
I YSTRNG=1 D
.D SCORESV
;
I YSTRNG=2 D
.D LDSCORES^YTSCORE(.YSDATA,.YS)
.D STRING
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_STRING
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSMINIC 2153 printed Mar 10, 2023@00:16:11 Page 2
YTSMINIC ;SLC/PIJ - Score MINI COG ; 01/08/2016
+1 ;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
+2 ;
+3 ;Public, Supported ICRs
+4 ; #2056 - Fileman API - $$GET1^DIQ
+5 ;
+6 QUIT
+7 ;
DATA1 ;
+1 SET YSINSNAM=$PIECE($GET(YSDATA(2)),U,3)
+2 IF $GET(YSINSNAM)=""
SET YSINSNAM=$GET(YS("CODE"),"NO NAME PASSED")
+3 ; Start at YSDATA(3)
SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+4 SET DATA=YSDATA(NODE)
+5 SET YSQN=$PIECE(DATA,U,1)
+6 SET YSSEQ=$PIECE(DATA,U,2)
SET YSSEQ=$PIECE(YSSEQ,";",1)
+7 SET YSCDA=$PIECE($GET(DATA),U,3)
+8 DO DESGNTR^YTSCORE(YSQN,.DES)
+9 SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
+10 IF (DES=1)
IF (LEG=0)
SET CLOCK="false"
+11 ; Skipped Question
+12 IF LEG="X"
SET SKIPQUES=SKIPQUES+1
+13 IF '$TEST
Begin DoDot:2
+14 IF (LEG=1)
SET TOTAL=TOTAL+1
End DoDot:2
End DoDot:1
+15 IF SKIPQUES>0
SET TOTAL="CND"
+16 QUIT
+17 ;
STRING ;
+1 NEW STR1
+2 IF '$DATA(^TMP($JOB,"YSCOR"))
Begin DoDot:1
+3 SET STRING="| "_YSINSNAM_" score could not be determined. "
End DoDot:1
QUIT
+4 ;
+5 SET TOTAL=$PIECE($GET(^TMP($JOB,"YSCOR",2)),"=",2)
+6 SET STRING="Mini-Cog Results: "
+7 ;
+8 IF SKIPQUES>0
Begin DoDot:1
+9 SET STRING="|"_STRING_"Too many items were skipped to score this administration."
End DoDot:1
QUIT
+10 ;
+11 ;if total = 0, value of CLOCK doesn't matter, positive screen
+12 IF (TOTAL=0)
SET STR1="Positive for cognitive impairment."
+13 IF (TOTAL>2)
SET STR1="Negative screen for dementia."
+14 ;
+15 IF (TOTAL=1)!(TOTAL=2)
Begin DoDot:1
+16 IF CLOCK="true"
SET STR1="Negative screen for dementia."
+17 IF '$TEST
SET STR1="Positive for cognitive impairment."
End DoDot:1
+18 ;
+19 SET STRING="|"_STRING_TOTAL_" "_STR1
+20 ;
SCORESV ; Used for Graph and Table
+1 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+2 KILL ^TMP($JOB,"YSCOR")
+3 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+4 SET ^TMP($JOB,"YSCOR",2)=YSINSNAM_" Scale not found"
End DoDot:1
QUIT
+5 ;
+6 KILL ^TMP($JOB,"YSCOR")
+7 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+8 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,624_",",3,"I")_"="_TOTAL
+9 QUIT
+10 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,DES,NODE,LEG,YSQN,YSSEQ,YSCDA
+4 NEW YSSCID,YSINSNAM
+5 NEW STRING,TOTAL,CLOCK,SKIPQUES
+6 ;
+7 SET (SKIPQUES,TOTAL)=0
+8 SET STRING=""
+9 SET CLOCK="true"
+10 ;
+11 DO DATA1
+12 ;
+13 IF YSTRNG=1
Begin DoDot:1
+14 DO SCORESV
End DoDot:1
+15 ;
+16 IF YSTRNG=2
Begin DoDot:1
+17 DO LDSCORES^YTSCORE(.YSDATA,.YS)
+18 DO STRING
+19 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING
End DoDot:1
+20 QUIT