Changeset 1572 for qrda/C0Q/trunk


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.

Location:
qrda/C0Q/trunk/p
Files:
2 edited

Legend:

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

    r1501 r1572  
    1 C0QMU12 ;JJOH/ZAG/GPL - Patient Reminder List ; 7/31/12 12:34pm
    2         ;;1.0;C0Q;;May 21, 2012;Build 63
     1C0QMU12 ;JJOH/ZAG/GPL - Patient Reminder List ; 10/10/12 11:28am
     2        ;;1.0;QUALITY MEASURES;**1**;May 21, 2012;Build 32
    33        ;
    44        ;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
     
    7878        K C0QLIST
    7979        S C0QLIST(ZYR_"HasDemographics")=""
    80         S C0QLIST(ZYR_"Patient")=""
     80        S C0QLIST(ZYR_"Patient")="" ; VEN/SMH - Is this needed? Not used in EP.
    8181        S C0QLIST(ZYR_"HasProblem")=""
    8282        S C0QLIST(ZYR_"HasAllergy")=""
    8383        S C0QLIST(ZYR_"HasMed")=""
     84        S C0QLIST(ZYR_"HasERX")="" ; VEN/SMH C0Q*1*5
     85        S C0QLIST(ZYR_"HasMedRecon")="" ; VEN/SMH C0Q*1*5
    8486        S C0QLIST(ZYR_"HasVitalSigns")=""
    8587        S C0QLIST(ZYR_"HasMedOrders")=""
     
    224226        D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
    225227        D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
     228        S C0QEDT=C0QEDT+.999999 ; Move to the end of the day! VEN/SMH C0Q*1*5
    226229        D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
    227230        I $D(VITRSLT) D  ;ZWR VITRSLT B  ;
     
    347350        S ZI="" ; BEGIN AT LATEST DATE FOR THIS LOC IN VISIT FILE
    348351        F  S ZI=$O(^AUPNVSIT("AHL",ULOC,ZI)) Q:(ZI="")!(ZI>IDTE)  D  ; FOR EACH DATE
    349         . W !,$$FMTE^XLFDT(9999999-ZI) ;B  ;
     352        . N C0QDATE S C0QDATE=9999999-$P(ZI,".")_"."_$P(ZI,".",2) ; VEN/SMH *5
     353        . W !,$$FMTE^XLFDT(C0QDATE) ; VEN/SMH *5
    350354        . I ZI="" Q  ;
    351355        . N ZJ S ZJ=""
     
    389393        S DFN=""
    390394        S ZYR=ZYR_"EP-"
     395        D INITCLST ; VEN/SMH - Initialize Empty Lists just in case we don't have
     396                   ; any. C0Q*1*5
    391397        F  S DFN=$O(C0QLIST(ZYR_"ALL-PATIENTS",DFN)) Q:DFN=""  D  ; EACH PATIENT
    392398        . D DEMO^C0QMU122
     
    398404        . D VITALS
    399405        D FILE ; FILE THE PATIENT LISTS
    400         N C0QCIEN
    401         S ZI=""
     406        ;
     407        ; Now process eRx MU measures for these patients
     408        ; Check for eRx template and code first; if they exist, run the code
     409        I $D(^C0PX("B","GETMEDS6")),$L($T(SOAP^C0PWS2)) DO
     410        . N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data;
     411        . D EN^C0QMUERX($$PATLN^C0QMU12(ZYR_"HasERX")) ; Pass the eRx patient list
     412        ;
     413        N ZI S ZI=""
    402414        F  S ZI=$O(C0QPARM(ZI)) Q:ZI=""  D  ;
    403         . S C0QCIEN=C0QPARM(ZI,"EPMeasurementSet") ; ien of measurement set
    404         . D UPDATE^C0QUPDT(.G,C0QCIEN) ; UPDATE THE MU MEASUREMENT SET
     415        . N C0QDEBUG S C0QDEBUG=1 ; This causes the code to print out data;
     416        . D UPDATE^C0QUPDT(.G,C0QPARM(ZI,"EPMeasurementSet")) ; UPDATE THE MU MEASUREMENT SET
     417        . ; VEN/SMH -- Quality Set missing for Outpatient -- adding
     418        . D UPDATE^C0QUPDT(.G,C0QPARM(ZI,"EPQualitySet")) ; C0Q*1*5
    405419        Q
    406420        ;
  • 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.