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

YTQAPI2A.m

Go to the documentation of this file.
  1. YTQAPI2A ;SLC/KCM - MHAX ANSWERS SPECIAL HANDLING ;10/17/16 13:43
  1. ;;5.01;MENTAL HEALTH;**121,134,123,250**;Dec 30, 1994;Build 26
  1. ;
  1. ; This routine handles limited complex reporting requirements without
  1. ; modifying YS_AUX.DLL by adding free text "answers" that can be used by
  1. ; a report.
  1. ;
  1. ; Assumptions: EDIT incomplete instrument should ignore the extra answers
  1. ; since there are no associated questions. GRAPHING should ignore the
  1. ; answers since they not numeric.
  1. ;
  1. SPECIAL(YSDATA,N,YSAD,YSTSTN) ; add "hidden" computed question text
  1. ; 123 - 134 need YS array below for call to GETSCORE
  1. I $G(YSAD) S YS("AD")=YSAD
  1. S N=N+1
  1. N TSTNM S TSTNM=$P(YSDATA(2),U,3)
  1. ;
  1. I TSTNM="CCSA-DSM5" D Q
  1. .N ANS,CHCE,I,LP,RES,SAVEN,SC,STR,TMP
  1. .D SETARR
  1. .S LP=2,SAVEN=N
  1. .F S LP=$O(YSDATA(LP)) Q:'LP S RES=$P(YSDATA(LP),U,3) S CHCE=$S(RES=3449:1,RES>3449:2,1:0) I CHCE D
  1. ..S ANS=$P(YSDATA(LP),U)
  1. ..I CHCE=2 D
  1. ...I (ANS=7216)!(ANS=7217) S TMP(7771)=7771_U_"9999;1^Positive"
  1. ...I ANS=7218 S TMP(7772)=7772_U_"9999;1^Positive"
  1. ...I (ANS=7219)!(ANS=7220) S TMP(7773)=7773_U_"9999;1^Positive"
  1. ...I (ANS=7221)!(ANS=7222)!(ANS=7223) S TMP(7774)=7774_U_"9999;1^Positive"
  1. ...I (ANS=7224)!(ANS=7225) S TMP(7775)=7775_U_"9999;1^Positive"
  1. ...I ANS=7229 S TMP(7778)=7778_U_"9999;1^Positive"
  1. ...I ANS=7230 S TMP(7779)=7779_U_"9999;1^Positive"
  1. ...I (ANS=7231)!(ANS=7232) S TMP(7780)=7780_U_"9999;1^Positive"
  1. ...I ANS=7233 S TMP(7781)=7781_U_"9999;1^Positive"
  1. ...I (ANS=7234)!(ANS=7235) S TMP(7782)=7782_U_"9999;1^Positive"
  1. ..; CHCE will be 1 here, 3 scales with lower threshold for being positive
  1. ..I ANS=7226 S TMP(7776)=7776_U_"9999;1^Positive"
  1. ..I (ANS=7227)!(ANS=7228) S TMP(7777)=7777_U_"9999;1^Positive"
  1. ..I (ANS=7236)!(ANS=7237)!(ANS=7238) S TMP(7783)=7783_U_"9999;1^Positive"
  1. .;Calculations completed, need to update TMP array into YSDATA
  1. .S I=0 F S I=$O(TMP(I)) Q:'I S YSDATA(SAVEN)=TMP(I),SAVEN=SAVEN+1
  1. .Q
  1. ;
  1. ; Questions: 3382 = PHQ9 question #9
  1. ; Choices: 1008 = Several days, 1009 = More than half the days,
  1. ; 1010 = Nearly every day
  1. I TSTNM="PHQ9","^1008^1009^1010^"[(U_$$ANSWER(3382)_U) D Q
  1. . S YSDATA(N)="7771^9999;1^Question 9 answered in the POSITIVE direction, additional clinical assessment is indicated."
  1. ;
  1. ;
  1. ;Calculate totals for the CEMI, SIP-2L, and YBOCSII.
  1. I TSTNM="SIP-2L"!(TSTNM="CEMI")!(TSTNM="YBOCSII") D Q
  1. .N LP,TOT,YSCORE,SCALE,SCORE
  1. .S TOT=0
  1. .D GETSCORE^YTQAPI8(.YSCORE,.YS)
  1. .I ^TMP($J,"YSCOR",1)'="[DATA]" Q
  1. .S LP=1
  1. .F S LP=$O(^TMP($J,"YSCOR",LP)) Q:'LP D
  1. ..; run this code to get the total score for SIP-2L, CEMI, YBOCSII
  1. ..S TOT=TOT+$P(^TMP($J,"YSCOR",LP),"=",2)
  1. ..S YSDATA(N)="7772^9999;1^"_TOT
  1. ..;
  1. ;
  1. I $L($T(SPECIAL^YTQAPI2B)) D SPECIAL^YTQAPI2B(TSTNM,.YSDATA,N,.YSAD,.YSTSTN) Q
  1. Q
  1. ;
  1. ANSWER(QID) ; return answer given question ID
  1. N ANS,I
  1. S ANS=""
  1. S I=2 F S I=$O(YSDATA(I)) Q:'I D Q:$L(ANS)
  1. . I $P(YSDATA(I),U)=QID S ANS=$P(YSDATA(I),U,3)
  1. Q ANS
  1. ;
  1. SETARR ; set YSDATA(ARR) for the customized questions
  1. F I=1:1 S STR=$T(SCLGRP+I) Q:$P(STR,";;",2)="Q" D
  1. .S SC=$P($P(STR,";;",2),";",3)
  1. .S TMP(SC)=SC_U_"9999;1^Negative"
  1. Q
  1. ;
  1. SCLGRP ;; Scale grouping for the CCSA-DSM5 ;;QIEN^QIEN;Scale Name;custom question to display;
  1. ;;7216^7217;Depression;7771;
  1. ;;7218;Anger;7772;
  1. ;;7219^7220;Mania;7773;
  1. ;;7221^7222^7223;Anxiety;7774;
  1. ;;7224^7225;Somatic Symptoms;7775;
  1. ;;7226;Suicidal Ideation;7776
  1. ;;7227^7228;Psychosis;7777;
  1. ;;7229;Sleep Problems;7778;
  1. ;;7230;Memory;7779;
  1. ;;7231^7232;Repetitive Thoughts and Behaviors;7780;
  1. ;;7233;Dissociation;7781;
  1. ;;7334^7235;Personality Functioning;7782;
  1. ;;7236^7237^7238;Substance Use;7783;
  1. ;;Q
  1. Q
  1. ;