Ignore:
Timestamp:
Jun 12, 2012, 8:11:47 PM (12 years ago)
Author:
Sam Habiel
Message:

Adding support for running eRx from the main C0Q package

File:
1 edited

Legend:

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

    r1438 r1445  
    1 C0QUPDT ; GPL - Quality Reporting List Update Routines ; 5/23/12 5:46pm
    2         ;;1.0;C0Q;;May 21, 2012;Build 43
     1C0QUPDT ; GPL - Quality Reporting List Update Routines ; 5/30/12 3:47pm
     2        ;;1.0;C0Q;;May 21, 2012;Build 44
    33        ;Copyright 2009 George Lilly.  Licensed under the terms of the GNU
    44        ;General Public License See attached copy of the License.
     
    4646        N ZII S ZII=""
    4747        F  S ZII=$O(C0QM(ZII)) Q:ZII=""  D  ; FOR EACH MEASURE
     48        . ;
     49        . ; Special processing for eRx measure.
     50        . I $P(C0QM(ZII),U,2)="MU EP ERX" D ERXCOUNT(MSET,ZII) QUIT
     51        . ;
     52        . ; Otherwise, we go on
    4853        . N C0QNL,C0QDL,C0QFLTN,C0QFLTD
    4954        . S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST
    5055        . S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST
    5156        . S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE
     57        . ;
     58        . ; Numerator
    5259        . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER
    5360        . I C0QNL="" D  ; CHECK ALTERNATE LIST
    5461        . . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER
    5562        . . I C0QNL'="" S C0QNALT=1
     63        . I C0QNL="" QUIT  ; No Numerator. Can't perform calculation.--smh
     64        . ;
     65        . ; Denominator
    5666        . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER
    5767        . I C0QDL="" D  ; CHECK ALTERNATE LIST
    5868        . . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER
    5969        . . I C0QDL'="" S C0QDALT=1
     70        . I C0QDL="" QUIT  ; No Denominator. Can't perform calcuation.--smh
    6071        . ;
    6172        . ; FIRST PROCESS THE NUMERATOR
     
    161172        . . S ZC=ZC+1
    162173        . I $D(C0QFDA) D UPDIE ; PROCESS
     174        . ;
     175        . ; File Percentage
    163176        . N C0QPCT ; PERCENT
    164177        . D  ;
    165                . . I C0QDCNT>0 D  ;
     178        . . I C0QDCNT>0 D  ;
    166179        . . . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0)
    167                . . E  S C0QPCT=0
     180        . . E  S C0QPCT=0
    168181        . . K C0QFDA
    169182        . . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT
     
    191204        K ZERR
    192205        D CLEAN^DILF
    193         ZWRITE C0QFDA
     206        N % S %=$NA(C0QFDA) F  S %=$Q(@%) Q:%=""  W %_"="_@%,! ; smh instead of zwrite
    194207        D UPDATE^DIE("","C0QFDA","","ZERR")
    195208        I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED
     
    200213        Q
    201214        ;
     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 ; 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
Note: See TracChangeset for help on using the changeset viewer.