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

YTSBAS24.m

Go to the documentation of this file.
YTSBAS24 ;SLC/PIJ - Score BASIS-24 ; 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) ; Choice ID
 .D DESGNTR^YTSCORE(YSQN,.DES)
 .I YSCDA=1155 S LEG="X" ; SKIPPED
 .I (YSCDA=803) S LEG=0  ; No difficulty
 .I (YSCDA=2853) S LEG=1 ; A little difficult 
 .I (YSCDA=805) S LEG=2  ; Moderate difficulty
 .I (YSCDA=806) S LEG=3  ; Quite a bit of difficulty
 .I (YSCDA=807) S LEG=4  ; Extreme difficulty
 .;
 .I (YSCDA=814) S LEG=0 ; None of the time
 .I (YSCDA=815) S LEG=1 ; A little of the time
 .I (YSCDA=884) S LEG=2 ; Half of the time
 .I (YSCDA=772) S LEG=3 ; Most of the time
 .I (YSCDA=817) S LEG=4 ; All of the time
 .;
 .I (YSCDA=217) S LEG=0 ; Never
 .I (YSCDA=242) S LEG=1 ; Rarely
 .I (YSCDA=213) S LEG=2 ; Sometimes
 .I (YSCDA=215) S LEG=3 ; Often
 .I (YSCDA=995) S LEG=4 ; Always
 .I LEG="X" D SKIPQUES Q
 .D TALLYSUM
 D TOTCAL
 Q
 ;
SKIPQUES ;
 ; Depression
 I (DES=1) S DEPWT="0.186",TOTALWT="0.0696",DEP=DEP+1 Q
 I (DES=2) S DEPWT="0.2612",TOTALWT="0.1061",DEP=DEP+1 Q
 I (DES=3) S DEPWT="0.1763",TOTALWT="0.07",DEP=DEP+1 Q
 I (DES=9) S DEPWT="0.0882",TOTALWT="0.0565",DEP=DEP+1 Q
 I (DES=10) S DEPWT="0.1679",TOTALWT="0.0942",DEP=DEP+1 Q
 I (DES=12) S DEPWT="0.1204",TOTALWT="0.0586",DEP=DEP+1 Q
 ; Interpersonal Problems
 I (DES=4) S INTERWT="0.1583",TOTALWT="0.0251",INTER=INTER+1 Q
 I (DES=5) S INTERWT="0.3299",TOTALWT="0.0279",INTER=INTER+1 Q
 I (DES=6) S INTERWT="0.2754",TOTALWT="0.0297",INTER=INTER+1 Q
 I (DES=7) S INTERWT="0.1362",TOTALWT="0.027",INTER=INTER+1 Q
 I (DES=8) S INTERWT="0.1002",TOTALWT="0.0241",INTER=INTER+1 Q
 ; Psycholtic Symptoms
 I (DES=14) S PSYWT="0.1049",TOTALWT="0.0164",PSY=PSY+1 Q
 I (DES=15) S PSYWT="0.136",TOTALWT="0.023",PSY=PSY+1 Q
 I (DES=16) S PSYWT="0.4636",TOTALWT="0.0243",PSY=PSY+1 Q
 I (DES=17) S PSYWT="0.2955",TOTALWT="0.0304",PSY=PSY+1 Q
 ; Alcohol/Drug Use
 I (DES=21) S ALCWT="0.34",TOTALWT="0.0178",ALC=ALC+1 Q
 I (DES=22) S ALCWT="0.234",TOTALWT="0.0135",ALC=ALC+1 Q
 I (DES=23) S ALCWT="0.1556",TOTALWT="0.01",ALC=ALC+1 Q
 I (DES=24) S ALCWT="0.2704",TOTALWT="0.0128",ALC=ALC+1 Q
 ; Emotional Liability
 I (DES=13) S EMOWT="11.02",TOTALWT="0.0384",EMO=EMO+1 Q
 I (DES=18) S EMOWT="61.32",TOTALWT="0.065",EMO=EMO+1 Q
 I (DES=19) S EMOWT="27.66",TOTALWT="0.0589",EMO=EMO+1 Q
 ; Self-Harm
 I (DES=11) S HARMWT="0.4175",TOTALWT="0.0483",HARM=HARM+1 Q
 I (DES=20) S HARMWT="0.5825",TOTALWT="0.0524",HARM=HARM+1 Q
 Q
 ;
TALLYSUM ;
 ; Depression
 I (DES=1) S DEPSUM=DEPSUM+(LEG*"0.1860"),TOTALSUM=TOTALSUM+(LEG*"0.0696") Q
 I (DES=2) S DEPSUM=DEPSUM+(LEG*"0.2612"),TOTALSUM=TOTALSUM+(LEG*"0.1061") Q
 I (DES=3) S DEPSUM=DEPSUM+(LEG*"0.1763"),TOTALSUM=TOTALSUM+(LEG*"0.07") Q
 ; Reverse this item
 I (DES=9) S DEPSUM=DEPSUM+((4-LEG)*"0.0882"),TOTALSUM=TOTALSUM+((4-LEG)*"0.0565") Q
 I (DES=10) S DEPSUM=DEPSUM+(LEG*"0.1679"),TOTALSUM=TOTALSUM+(LEG*"0.0942") Q
 I (DES=12) S DEPSUM=DEPSUM+(LEG*"0.1204"),TOTALSUM=TOTALSUM+(LEG*"0.0586") Q
 ; Interpersonal Problems: All reversed in scoring
 I (DES=4) S INTERSUM=INTERSUM+((4-LEG)*"0.1583"),TOTALSUM=TOTALSUM+((4-LEG)*"0.0251") Q
 I (DES=5) S INTERSUM=INTERSUM+((4-LEG)*"0.3299"),TOTALSUM=TOTALSUM+((4-LEG)*"0.0279") Q
 I (DES=6) S INTERSUM=INTERSUM+((4-LEG)*"0.2754"),TOTALSUM=TOTALSUM+((4-LEG)*"0.0297") Q
 I (DES=7) S INTERSUM=INTERSUM+((4-LEG)*"0.1362"),TOTALSUM=TOTALSUM+((4-LEG)*"0.027") Q
 I (DES=8) S INTERSUM=INTERSUM+((4-LEG)*"0.1002"),TOTALSUM=TOTALSUM+((4-LEG)*"0.0241") Q
 ; Psycholtic Symptoms
 I (DES=14) S PSYSUM=PSYSUM+(LEG*"0.1049"),TOTALSUM=TOTALSUM+(LEG*"0.0164") Q
 I (DES=15) S PSYSUM=PSYSUM+(LEG*"0.136"),TOTALSUM=TOTALSUM+(LEG*"0.023") Q
 I (DES=16) S PSYSUM=PSYSUM+(LEG*"0.4636"),TOTALSUM=TOTALSUM+(LEG*"0.0243") Q
 I (DES=17) S PSYSUM=PSYSUM+(LEG*"0.2955"),TOTALSUM=TOTALSUM+(LEG*"0.0304") Q
 ; Alcohol/Drug Use
 I (DES=21) S ALCSUM=ALCSUM+(LEG*"0.34"),TOTALSUM=TOTALSUM+(LEG*"0.0178") Q
 I (DES=22) S ALCSUM=ALCSUM+(LEG*"0.234"),TOTALSUM=TOTALSUM+(LEG*"0.0135") Q
 I (DES=23) S ALCSUM=ALCSUM+(LEG*"0.1556"),TOTALSUM=TOTALSUM+(LEG*"0.01") Q
 I (DES=24) S ALCSUM=ALCSUM+(LEG*"0.2704"),TOTALSUM=TOTALSUM+(LEG*"0.0128") Q
 ; Emotional Liability
 I (DES=13) S EMOSUM=EMOSUM+(LEG*"0.1102"),TOTALSUM=TOTALSUM+(LEG*"0.0384") Q
 I (DES=18) S EMOSUM=EMOSUM+(LEG*"0.6132"),TOTALSUM=TOTALSUM+(LEG*"0.065") Q
 I (DES=19) S EMOSUM=EMOSUM+(LEG*"0.2766"),TOTALSUM=TOTALSUM+(LEG*"0.0589") Q
 ; Self Harm
 I (DES=11) S HARMSUM=HARMSUM+(LEG*"0.4175"),TOTALSUM=TOTALSUM+(LEG*"0.0483") Q
 I (DES=20) S HARMSUM=HARMSUM+(LEG*"0.5825"),TOTALSUM=TOTALSUM+(LEG*"0.0524") Q
 Q
 ;
TOTCAL ;
 I (DEP=0) S DEPSUM=$J(DEPSUM,0,2)
 I (DEP=1) S DEPSUM=$J((DEPSUM/(1-DEPWT)),0,2)
 I (DEP>1) S DEPSUM="Too many skipped questions"
 ;
 I (INTER=0) S INTERSUM=$J(INTERSUM,0,2)
 I (INTER=1) S INTERSUM=$J((INTERSUM/(1-INTERWT)),0,2)
 I (INTER>1) S INTERSUM="Too many skipped questions"
 ;
 I (PSY=0) S PSYSUM=$J(PSYSUM,0,2)
 I (PSY=1) S PSYSUM=$J(PSYSUM/(1-PSYWT),0,2)
 I (PSY>1) S PSYSUM="Too many skipped questions"
 ;
 I (ALC=0) S ALCSUM=$J(ALCSUM,0,2)
 I (ALC=1) S ALCSUM=$J((ALCSUM/(1-ALCWT)),0,2)
 I (ALC>1) S ALCSUM="Too many skipped questions"
 ;
 I (EMO=0) S EMOSUM=$J(EMOSUM,0,2)
 I (EMO=1) S EMOSUM=$J((EMOSUM/(1-EMOWT)),0,2)
 I (EMO>1) S EMOSUM="Too many skipped questions"
 ;
 I (HARM=0) S HARMSUM=$J(HARMSUM,0,2)
 I (HARM=1) S HARMSUM=$J((HARMSUM/(1-HARMWT)),0,2)
 I (HARM>1) S HARMSUM="Too many skipped questions"
 ;
 I (DEP+INTER+PSY+ALC+EMO+HARM)=0 S TOTALSUM=$J(TOTALSUM,0,2)
 I (DEP+INTER+PSY+ALC+EMO+HARM)=1 S TOTALSUM=$J((TOTALSUM/(1-TOTALWT)),0,2)
 I (DEP+INTER+PSY+ALC+EMO+HARM)>1 S TOTALSUM="Too many skipped questions"
 Q
 ;
SCORESV ;
 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"
 ;
 S YSSCNAM=$P($G(^TMP($J,"YSG",3)),U,4)       ; Scale Name
 K ^TMP($J,"YSCOR")
 S ^TMP($J,"YSCOR",1)="[DATA]"
 S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,596_",",3,"I")_"="_$J(DEPSUM,0,2)
 S ^TMP($J,"YSCOR",3)=$$GET1^DIQ(601.87,597_",",3,"I")_"="_$J(INTERSUM,0,2)
 S ^TMP($J,"YSCOR",4)=$$GET1^DIQ(601.87,598_",",3,"I")_"="_$J(PSYSUM,0,2)
 S ^TMP($J,"YSCOR",5)=$$GET1^DIQ(601.87,599_",",3,"I")_"="_$J(ALCSUM,0,2)
 S ^TMP($J,"YSCOR",6)=$$GET1^DIQ(601.87,600_",",3,"I")_"="_$J(EMOSUM,0,2)
 S ^TMP($J,"YSCOR",7)=$$GET1^DIQ(601.87,601_",",3,"I")_"="_$J(HARMSUM,0,2)
 S ^TMP($J,"YSCOR",8)=$$GET1^DIQ(601.87,602_",",3,"I")_"="_$J(TOTALSUM,0,2)
 Q
 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
 ;  YSTRNG = 1 Score Instrument
 ;  YSTRNG = 2 get Report Answers and Text)
 N DATA,DES,LEG,NODE,YSQN
 N YSCDA,YSSCNAM,YSINSNAM,YSSEQ,STRING
 N ALCWT,DEPWT,EMOWT,HARMWT,INTERWT,PSYWT,TOTALWT
 N DEP,INTER,PSY,ALC,EMO,HARM,TOTAL
 N DEPSUM,INTERSUM,PSYSUM,ALCSUM,EMOSUM,HARMSUM,TOTALSUM
 N DEPSC,INTERSC,PSYSC,ALCSC,EMOSC,HARMSC,TOTALSC,RESULT
 ;
 S (ALCWT,DEPWT,EMOWT,HARMWT,INTERWT,PSYWT,TOTALWT)=0
 S (DEP,INTER,PSY,ALC,EMO,HARM,TOTAL)=0
 S (DEPSUM,INTERSUM,PSYSUM,ALCSUM,EMOSUM,HARMSUM,TOTALSUM)=0
 S (DEPSC,INTERSC,PSYSC,ALCSC,EMOSC,HARMSC,TOTALSC,RESULT)=0
 ;
 S STRING=""
 ;
 ;BASIS-24 returns scale scores which are calculated and stored, all special text in MH REPORT File
 I YSTRNG=2 Q
 ;
 D DATA1
 D SCORESV
 Q