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

YS142FIX.m

Go to the documentation of this file.
  1. YS142FIX ;SLC/KCM - Patch 142 fix scores with extra scales ; 03/20/2017
  1. ;;5.01;MENTAL HEALTH;**142**;Dec 30, 1994;Build 14
  1. ;
  1. ADM2019 ; loop through administrations from 2019
  1. N YS142S,YS142T,YS142D,YS142A,YS142U ; scales,test,date,admin,updates
  1. D BLDSCL
  1. S ^XTMP("YTS-RESCORE",0)=$$FMADD^XLFDT(DT,30)_U_DT_U_"MH Extraneous Scores"
  1. S YS142U=0
  1. S YS142T=0 F S YS142T=$O(^YTT(601.84,"AC",YS142T)) Q:'YS142T D
  1. . S YS142D=3190000 F S YS142D=$O(^YTT(601.84,"AC",YS142T,YS142D)) Q:'YS142D D
  1. . . S YS142A=0 F S YS142A=$O(^YTT(601.84,"AC",YS142T,YS142D,YS142A)) Q:'YS142A D
  1. . . . I $$SCALERR(YS142A) D RESCORE(YS142A)
  1. S ^XTMP("YTS-RESCORE","SCALE-UPDATES")=YS142U
  1. Q
  1. RESCORE(YS142A) ; delete results and rescore admin
  1. ; expects YS142U (update count)
  1. D DELRSLTS^YTSCOREV(YS142A)
  1. S $P(^YTT(601.84,YS142A,0),U,12)=0 ; force re-score to current revision
  1. I $$SCOREONE^YTSCOREV(YS142A) S YS142U=YS142U+1
  1. Q
  1. SCALERR(YS142A) ; return 1 if more scale scores than expected
  1. N TEST,CNT,RSLT,IEN
  1. S TEST=$P($G(^YTT(601.84,YS142A,0)),U,3)
  1. I '$G(YS142S(TEST),0) QUIT 0
  1. ;
  1. S CNT=0,RSLT=0
  1. S IEN=0 F S IEN=$O(^YTT(601.92,"AC",YS142A,IEN)) Q:'IEN D Q:RSLT
  1. . S CNT=CNT+1
  1. . I CNT>YS142S(TEST) S RSLT=1
  1. Q RSLT
  1. ;
  1. BLDSCL ; Build scales into YS142S
  1. ; builds array of scale counts per instrument
  1. N TEST,SCLCNT,GSEQ,GRP,SSEQ,SCL
  1. S TEST=0 F S TEST=$O(^YTT(601.71,TEST)) Q:'TEST D
  1. . I $P($G(^YTT(601.71,TEST,2)),U,2)'="Y" QUIT ; is active instrument?
  1. . S SCLCNT=0
  1. . S GSEQ=0 F S GSEQ=$O(^YTT(601.86,"AC",TEST,GSEQ)) Q:'GSEQ D
  1. . . S GRP=0 F S GRP=$O(^YTT(601.86,"AC",TEST,GSEQ,GRP)) Q:'GRP D
  1. . . . S SSEQ=0 F S SSEQ=$O(^YTT(601.87,"AC",GRP,SSEQ)) Q:'SSEQ D
  1. . . . . S SCL=0 F S SCL=$O(^YTT(601.87,"AC",GRP,SSEQ,SCL)) Q:'SCL D
  1. . . . . . S SCLCNT=SCLCNT+1
  1. . S YS142S(TEST)=SCLCNT ;_U_$P(^YTT(601.71,TEST,0),U)
  1. Q
  1. QTASK(RESUME) ; Create background task for checking extraneous scales
  1. N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTSK
  1. S ZTIO=""
  1. S ZTRTN="ADM2019^YS142FIX"
  1. S ZTDESC="Check extraneous MH scales"
  1. S ZTDTH=RESUME
  1. D ^%ZTLOAD
  1. I '$G(ZTSK) D MES^XPDUTL("Unsuccessful queue of re-scoring job.")
  1. Q