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

RGMTDPSC.m

Go to the documentation of this file.
  1. RGMTDPSC ;GAI/TMG-COUNT DUPLICATE RECORD ENTRIES BY CMOR SCORE RANGE ;5/30/98
  1. ;;1.0;CLINICAL INFO RESOURCE NETWORK;**19**;30 Apr 99
  1. ;
  1. ;Reference to ^VA(15 supported by IA #2532
  1. ;Reference to ^DPT("ACMORS" and ^DPT(0 supported by IA #2070
  1. ;
  1. ;; search the Duplicate Record file (#15) for duplicate pairs and
  1. ;; display by CMOR activity score range. The ranges are in 100's with
  1. ;; a separate range for pairs where both members have no score and where
  1. ;; both members have zero score or one member has a zero score and the
  1. ;; other has no score.
  1. ;;
  1. EN ; que or select device for output
  1. I '$D(^DPT("ACMORS")) D Q
  1. . W !,"The option, Start/Restart CMOR Score Calculation"
  1. . W !,"[RG CMOR START], needs to be run before this option."
  1. S %ZIS="QM" D ^%ZIS Q:POP S:IO'=IO(0) IO("Q")="" I '$D(IO("Q")) G SCAN
  1. S ZTRTN="SCAN^RGMTDPSC"
  1. S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL,ZTSAVE("IO*")=""
  1. S ZTDESC="DUP. RECORD REPORT BY CMOR SCORE" D ^%ZTLOAD,EXIT,^%ZISC
  1. Q
  1. ;
  1. SCAN ; search and count duplicate pairs by score ranges
  1. S U="^",MSG=0,MSGLINE=1,DPTCNT=0 K SCRARR
  1. N NODE1,NODE2
  1. S IEN=0 F S IEN=$O(^VA(15,IEN)) Q:+IEN'>0 I $D(^VA(15,+IEN,0)) S NODE=^(0) D
  1. . S (SCRANGE,SCORE,SCORE1,SCORE2)="NO SCORE"
  1. . S DPT1=+$P(NODE,U),DPT2=+$P(NODE,U,2)
  1. . S NODE1=$$MPINODE^MPIFAPI(+DPT1)
  1. . I $P($G(NODE1),U,6)'="" S SCORE1=$P(NODE1,U,6)
  1. . S NODE2=$$MPINODE^MPIFAPI(+DPT2)
  1. . I $P($G(NODE2),U,6)'="" S SCORE2=$P(NODE2,U,6)
  1. . I SCORE1=0&(SCORE2=0) S (SCRANGE,SCORE)="ZERO"
  1. . I SCORE1?.N!(SCORE2?.N) D
  1. . . Q:SCRANGE="ZERO"
  1. . . S:+SCORE1>+SCORE SCORE=SCORE1 S:+SCORE2>+SCORE SCORE=SCORE2 S SCRANGE=SCORE\100 I SCRANGE>0 S SCRANGE=SCRANGE*100
  1. . S:'$D(SCRARR("RANGE",SCRANGE)) SCRARR("RANGE",SCRANGE)=0
  1. . S SCRARR("RANGE",SCRANGE)=SCRARR("RANGE",SCRANGE)+1
  1. D PRINT
  1. ;
  1. EXIT K COUNT,DPT1,DPT2,DPTCNT,IEN,MSG,MSGLINE,NODE,PAGE,POP,PRANGE,PRDT,SCORE
  1. K SCORE1,SCORE2,SCRANGE,SCRARR,S,TXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZZ,%DT,%ZIS,DTOUT,DUOUT,SITE,XMSUB,XMTEXT,XMY,XMDUZ
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. Q
  1. ;
  1. PRINT ; print duplicate pair counts by score range
  1. S (PAGE,COUNT)=0 S X="N",%DT="T" D ^%DT S X=Y X ^DD("DD") S PRDT=Y
  1. D HDR I MSG=0 D MSG
  1. I $D(SCRARR("RANGE","ZERO")) D
  1. . S PRANGE="0" W !?10,PRANGE,?40,$J(SCRARR("RANGE","ZERO"),6,0)
  1. . S COUNT=COUNT+SCRARR("RANGE","ZERO")
  1. S SCRANGE="" F S SCRANGE=$O(SCRARR("RANGE",SCRANGE)) Q:SCRANGE="" Q:SCRANGE="ZERO" D
  1. . I SCRANGE=0 S PRANGE="1 - 99"
  1. . I SCRANGE'="NO SCORE" I SCRANGE>0 S PRANGE=SCRANGE_" - "_(SCRANGE+99)
  1. . I SCRANGE="NO SCORE" S PRANGE=SCRANGE
  1. . S MSGLINE=MSGLINE+.001
  1. . S TXT(MSGLINE)=$J(" ",10)_PRANGE_$J(" ",23)_$J(SCRARR("RANGE",SCRANGE),6,0)
  1. . D:$Y>(IOSL-6) HDR W !?10,PRANGE,?39,$J(SCRARR("RANGE",SCRANGE),6,0) S COUNT=COUNT+SCRARR("RANGE",SCRANGE)
  1. S DPTCNT=$P(^DPT(0),U,4)
  1. D:$Y>(IOSL-6) HDR W !!,"TOTAL Potential Duplicates (15): ",?39,$J(COUNT,6,0)
  1. D:$Y>(IOSL-6) HDR W !,"TOTAL Patients (2): ",?39,$J(DPTCNT,6,0)
  1. S MSGLINE=MSGLINE+.001 D
  1. . S TXT(MSGLINE)=" ",MSGLINE=MSGLINE+.001
  1. . S TXT(MSGLINE)="TOTAL Potential Duplicates (15) "_COUNT
  1. . S MSGLINE=MSGLINE+.001
  1. . S TXT(MSGLINE)="TOTAL Patients (2) "_DPTCNT
  1. D MSG1
  1. Q
  1. ;
  1. HDR I ($E(IOST,1,2)="C-")&(IO=IO(0)) D
  1. . S DIR(0)="E" D ^DIR K DIR
  1. Q:$D(DUOUT)!($D(DTOUT))
  1. S PAGE=PAGE+1 W #
  1. W "Duplicate Record Count by CMOR Score",?(IOM-23),"Page: ",PAGE
  1. W !?(IOM-23),"Date: ",PRDT,!
  1. F ZZ=1:1:IOM W "-"
  1. I PAGE=1 D
  1. .W !,"This report is drawn from the Duplicate Record file (#15) with"
  1. .W !,"CMOR scores from the PATIENT file, CMOR ACTIVITY SCORE field.",!
  1. .W !,"- If both members of a pair have a score of zero the pair is"
  1. .W !," counted in the '0' group."
  1. .W !,"- If one or both members of the pair have a score greater than"
  1. .W !," zero, that pair is counted in the group for the higher score."
  1. .W !,"- If neither member of the pair have a CMOR score, the pair is"
  1. .W !," counted in the 'NO SCORE' group."
  1. W !!,?10,"Score Range",?40,"Count",!?10,"-----------",?40,"-----",!
  1. Q
  1. MSG ;create the message
  1. S TXT(.1)="Duplicate Record Count by CMOR Score"_$J(" ",20)_"Date: "_PRDT
  1. S TXT(.2)=" "
  1. S SITE=$$SITE^VASITE()
  1. S TXT(.3)=$P(SITE,U,2)_" ("_$P(SITE,U)_")"
  1. S TXT(.4)=" "
  1. S TXT(.5)=$J(" ",10)_"Score Range"_$J(" ",20)_"Count"
  1. S TXT(.6)=$J(" ",10)_"-----------"_$J(" ",20)_"-----"
  1. S TXT(.7)=" "
  1. Q
  1. MSG1 ;call XMD
  1. S XMSUB="Duplicate Records by CMOR Score: "_$P(SITE,U,2)
  1. S XMY(DUZ)="",XMDUZ=DUZ
  1. S XMTEXT="TXT(" D ^XMD
  1. Q