YTSPTSD ;SLC/PIJ - Score PC PTSD ; 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
 .S DATA=YSDATA(NODE)
 .S YSQN=$P(DATA,U,1)
 .S YSCDA=$P($G(DATA),U,3)
 .S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
 .I (LEG="Y") S TOTYES=TOTYES+1
 Q
 ;
STRING ;
 I '$D(^TMP($J,"YSCOR")) D  Q
 .S STRING="| "_YSINSNAM_" score could not be determined. "
 S TOTYES=$P($G(^TMP($J,"YSCOR",2)),"=",2)
 I TOTYES<=2 S STRING=STRING_"| A score of "_TOTYES_" indicates a negative screen." Q
 S STRING=STRING_"| A score of "_TOTYES_" indicates a positive screen."
 Q
 ;
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,203_",",3,"I")_"="_TOTYES
 Q
 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
 ;  YSTRNG = 1 Score Instrument
 ;  YSTRNG = 2 get Report Answers and Text
 N DATA,NODE,LEG,YSCDA,YSQN,YSINSNAM
 N STRING,TOTYES
 ;
 S STRING=""
 S TOTYES=0
 ;
 D DATA1
 ;
 I YSTRNG=1 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[HYTSPTSD   1507     printed  Sep 23, 2025@19:56:51                                                                                                                                                                                                     Page 2
YTSPTSD   ;SLC/PIJ - Score PC PTSD ; 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        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 YSCDA=$PIECE($GET(DATA),U,3)
 +7                SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
 +8                IF (LEG="Y")
                       SET TOTYES=TOTYES+1
               End DoDot:1
 +9        QUIT 
 +10      ;
STRING    ;
 +1        IF '$DATA(^TMP($JOB,"YSCOR"))
               Begin DoDot:1
 +2                SET STRING="| "_YSINSNAM_" score could not be determined. "
               End DoDot:1
               QUIT 
 +3        SET TOTYES=$PIECE($GET(^TMP($JOB,"YSCOR",2)),"=",2)
 +4        IF TOTYES<=2
               SET STRING=STRING_"| A score of "_TOTYES_" indicates a negative screen."
               QUIT 
 +5        SET STRING=STRING_"| A score of "_TOTYES_" indicates a positive screen."
 +6        QUIT 
 +7       ;
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,203_",",3,"I")_"="_TOTYES
 +9        QUIT 
 +10      ;
DLLSTR(YSDATA,YS,YSTRNG) ;
 +1       ;  YSTRNG = 1 Score Instrument
 +2       ;  YSTRNG = 2 get Report Answers and Text
 +3        NEW DATA,NODE,LEG,YSCDA,YSQN,YSINSNAM
 +4        NEW STRING,TOTYES
 +5       ;
 +6        SET STRING=""
 +7        SET TOTYES=0
 +8       ;
 +9        DO DATA1
 +10      ;
 +11       IF YSTRNG=1
               DO SCORESV
 +12       IF YSTRNG=2
               Begin DoDot:1
 +13               DO LDSCORES^YTSCORE(.YSDATA,.YS)
 +14               DO STRING
 +15               SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_STRING
               End DoDot:1
 +16       QUIT