Ignore:
Timestamp:
Oct 14, 2012, 4:06:20 PM (12 years ago)
Author:
Sam Habiel
Message:

Updated routines with changes for patch 1 and 5. Patch 5 fixes several bugs:
Vitals date range now includes today's date.
Empty lists are now created in advance for Outpatient Measures.
Inverse date display for visit was incorrect. That is fixed.
Outpatient Quality Measure Set in Parameters is now used; before it was ignored.
In C0QUPDT, (all previous are in C0QMU12), the variable C0QNALT is newed. This variable is a flag to indicate whether a measure uses the reminders package or uses the quality measures package for a patient list. Previously, if not newed it adversely affects subsequenet processing of lists, as the counts of the patients depends on the value of the flag. For example, a measurement set that mixes quality measures with performance measures will calculate wrong counts for the quality measures.

Patch 1 adds support for real-data MU ERx Measure based on data from the eRx vendor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qrda/C0Q/trunk/p/C0QUPDT.m

    r1445 r1572  
    1 C0QUPDT ; GPL - Quality Reporting List Update Routines ; 5/30/12 3:47pm
    2         ;;1.0;C0Q;;May 21, 2012;Build 44
     1C0QUPDT ; GPL - Quality Reporting List Update Routines ; 10/10/12 11:36am
     2        ;;1.0;C0Q;**1**;May 21, 2012;Build 32
    33        ;Copyright 2009 George Lilly.  Licensed under the terms of the GNU
    44        ;General Public License See attached copy of the License.
     
    4848        . ;
    4949        . ; Special processing for eRx measure.
    50         . I $P(C0QM(ZII),U,2)="MU EP ERX" D ERXCOUNT(MSET,ZII) QUIT
     50        . I $$GET1^DIQ(1130580001.101,+C0QM(ZII)_",",4,"I")="E" D ERXCOUNT(MSET,ZII) Q
    5151        . ;
    5252        . ; Otherwise, we go on
    53         . N C0QNL,C0QDL,C0QFLTN,C0QFLTD
     53        . N C0QNL,C0QDL,C0QFLTN,C0QFLTD,C0QNALT ; VEN/SMH - line changed in *5
    5454        . S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST
    5555        . S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST
     
    204204        K ZERR
    205205        D CLEAN^DILF
    206         N % S %=$NA(C0QFDA) F  S %=$Q(@%) Q:%=""  W %_"="_@%,! ; smh instead of zwrite
     206        D ZWRITE^C0QUTIL("C0QFDA")
    207207        D UPDATE^DIE("","C0QFDA","","ZERR")
    208208        I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
     
    213213        Q
    214214        ;
    215 ERXCOUNT(MSETIEN,MIEN) ; Private Proc; Get eRx and file as Numerator, Denominator, and %
    216  ; Inputs:
    217  ; MSETIEN - Measurement Set IEN - By Value
    218  ; MIEN - Measurement IEN inside the Measurement Set - By Value
    219  ; No check is done to see if the caller is sending bad data. Measurement must be
    220  ; in a subfile under Measurement Set.
    221  ;
    222  ; Example of Data we go through in the C0Q Parameter File, so the code below
    223  ; will make sense.
    224  ; ^C0Q(401,"AMMS",2,1)=""
    225  ; ^C0Q(401,"AMMS",2,2)=""
    226  ; ^C0Q(401,"AQMS",6,2)=""
    227  ; ^C0Q(401,"B","INPATIENT",2)=""
    228  ; ^C0Q(401,"B","OUTPATIENT",1)=""
    229  ; ^C0Q(401,"MU","MU12",1)=""
    230  ; ^C0Q(401,"MU","MU12",2)=""
    231  ; ^C0Q(401,"MUTYP","MU12","EP",1)=""
    232  ; ^C0Q(401,"MUTYP","MU12","INP",2)=""
    233  ;
    234  ; Get Parameter year from the Parameters file.
    235  ; 1. Get parameter associated with this measurement set from AMMS x-ref (new in C0Q*1*1).
    236  N C0QPARAM
    237  N % S %="" F  S %=$O(^C0Q(401,"AMMS",MSETIEN,%)) Q:%=""  S C0QPARAM(%)=""
    238  ;
    239  ; 2. Find the year for each of those--store as value of node; IEN still subscript.
    240  N % S %="" F  S %=$O(C0QPARAM(%)) Q:%=""  S C0QPARAM(%)=$$GET1^DIQ(1130580001.401,%_",",.02)
    241  ;
    242  ; 3. Now make sure that this parameter that point to an Outpatient Parameters
    243  ; WARNING: CONFUSING CODE WRITTEN BY ME AHEAD
    244  ; The % loop will stop with a valid value if found; % is used in the lines immediately below
    245  N % S %="" F  S %=$O(C0QPARAM(%)) Q:%=""  Q:$D(^C0Q(401,"MUTYP",C0QPARAM(%),"EP",%))
    246  ;
    247  ; 4. If % has a valid IEN (there can be multiple, we take the first), then off we go.
    248  ; Otherwise, if it is back to "", we quit.
    249  N MUYEAR
    250  IF '% W "No suitable parameter found. Cannot determine Measurement Year.",! QUIT
    251  ELSE  S MUYEAR=C0QPARAM(%)
    252  ;
    253  ; Now, based on the MU year, construct the patient list name that has the eRx data.
    254  N LISTNAME S LISTNAME=MUYEAR_"-"_"EP"_"-"_"HasERX"
    255  ;
    256  ; Call the API in C0QMUERX to get the counts already calculated
    257  ; Data is returned NUM/DEN
    258  N COUNTS S COUNTS=$$COUNT^C0QMUERX($$PATLN^C0QMU12(LISTNAME))
    259  ;
    260  ; File the count
    261  N NUM S NUM=$P(COUNTS,"/") ; Numerator
    262  N DEN S DEN=$P(COUNTS,"/",2) ; Denominator
    263  ;
    264  ; Prepare FDA
    265  N C0QFDA,C0QERR
    266  S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",1.1)=NUM ; Numerator
    267  S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",2.1)=DEN ; Denominator
    268  S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",3)=$S(DEN=0:0,1:$J(100*NUM/DEN,0,0)) ; Percentage; avoid dividing by zero!
    269  ;
    270  ; File FDA using Filer not updater (editing existing entry only)
    271  D FILE^DIE("ET",$NAME(C0QFDA),$NAME(C0QERR)) ; Flags: External, Transaction
    272  ;
    273  ; If error, print it out
    274  I $D(C0QERR) DO
    275  . W "Error filing data",!
    276  . N % S %=$NAME(C0QERR) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
    277  ;
    278  QUIT
     215ERXCOUNT(MSETIEN,MIEN)  ; Private Proc; Get eRx and file as Numerator, Denominator, and %
     216        ; Inputs:
     217        ; MSETIEN - Measurement Set IEN - By Value
     218        ; MIEN - Measurement IEN inside the Measurement Set - By Value
     219        ;
     220        ; Optional Symtab input: C0QDEBUG to print out debug messages to STDOUT.
     221        ; ZEXCEPT: C0QDEBUG ; For Dr. Ivey's parser.
     222        ;
     223        ; No check is done to see if the caller is sending bad data. Measurement must be
     224        ; in a subfile under Measurement Set.
     225        ;
     226        W:$G(C0QDEBUG) "Processing E-Prescribing Counts",!
     227        ; Example of Data we go through in the C0Q Parameter File, so the code below
     228        ; will make sense.
     229        ; ^C0Q(401,"AMMS",2,1)=""
     230        ; ^C0Q(401,"AMMS",2,2)=""
     231        ; ^C0Q(401,"AQMS",6,2)=""
     232        ; ^C0Q(401,"B","INPATIENT",2)=""
     233        ; ^C0Q(401,"B","OUTPATIENT",1)=""
     234        ; ^C0Q(401,"MU","MU12",1)=""
     235        ; ^C0Q(401,"MU","MU12",2)=""
     236        ; ^C0Q(401,"MUTYP","MU12","EP",1)=""
     237        ; ^C0Q(401,"MUTYP","MU12","INP",2)=""
     238        ;
     239        ; Get Parameter year from the Parameters file.
     240        ; 1. Get parameter associated with this measurement set from AMMS x-ref (new in C0Q*1*1).
     241        N C0QPARAM
     242        N % S %="" F  S %=$O(^C0Q(401,"AMMS",MSETIEN,%)) Q:%=""  S C0QPARAM(%)=""
     243        ;
     244        ; 2. Find the year for each of those--store as value of node; IEN still subscript.
     245        N % S %="" F  S %=$O(C0QPARAM(%)) Q:%=""  S C0QPARAM(%)=$$GET1^DIQ(1130580001.401,%_",",.02)
     246        ;
     247        ; 3. Now make sure that this parameter that point to an Outpatient Parameters
     248        ; WARNING: CONFUSING CODE WRITTEN BY ME AHEAD
     249        ; The % loop will stop with a valid value if found; % is used in the lines immediately below
     250        N % S %="" F  S %=$O(C0QPARAM(%)) Q:%=""  Q:$D(^C0Q(401,"MUTYP",C0QPARAM(%),"EP",%))
     251        ;
     252        ; 4. If % has a valid IEN (there can be multiple, we take the first), then off we go.
     253        ; Otherwise, if it is back to "", we quit.
     254        N MUYEAR
     255        IF '% W "No suitable parameter found. Cannot determine Measurement Year.",! QUIT
     256        ELSE  S MUYEAR=C0QPARAM(%)
     257        ;
     258        ; Now, based on the MU year, construct the patient list name that has the eRx data.
     259        N LISTNAME S LISTNAME=MUYEAR_"-"_"EP"_"-"_"HasERX"
     260        ;
     261        ; Call the API in C0QMUERX to get the counts already calculated
     262        ; Data is returned NUM/DEN
     263        N COUNTS S COUNTS=$$COUNT^C0QMUERX($$PATLN^C0QMU12(LISTNAME))
     264        ;
     265        ; File the count
     266        N NUM S NUM=$P(COUNTS,"/") ; Numerator
     267        N DEN S DEN=$P(COUNTS,"/",2) ; Denominator
     268        ;
     269        ; Prepare FDA
     270        N C0QFDA,C0QERR
     271        S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",1.1)=NUM ; Numerator
     272        S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",2.1)=DEN ; Denominator
     273        S C0QFDA($$C0QMMFN(),MIEN_","_MSETIEN_",",3)=$S(DEN=0:0,1:$J(100*NUM/DEN,0,0)) ; Percentage; avoid dividing by zero!
     274        ;
     275        ; File FDA using Filer not updater (editing existing entry only)
     276        D FILE^DIE("ET",$NAME(C0QFDA),$NAME(C0QERR)) ; Flags: External, Transaction
     277        ;
     278        ; If error, print it out
     279        I $D(C0QERR) DO
     280        . W "Error filing data",!
     281        . N % S %=$NAME(C0QERR) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
     282        ;
     283        QUIT
Note: See TracChangeset for help on using the changeset viewer.