Changeset 1444 for qrda/C0Q


Ignore:
Timestamp:
Jun 11, 2012, 7:27:59 PM (13 years ago)
Author:
Sam Habiel
Message:

Adding counting code to C0QMUERX

File:
1 edited

Legend:

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

    r1443 r1444  
    1 C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 1:48am
     1C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 9:35am
    22 ;;1.0;C0Q;;May 21, 2012;Build 44
    33 QUIT  ; No Entry from the top
     
    2626 N C0QDEBUG S C0QDEBUG=1
    2727 D EN($$PATLN^C0QMU12("MU12-EP-HasERX"))
     28 W $$COUNT($$PATLN^C0QMU12("MU12-EP-HasERX"))
    2829 QUIT
    2930EN(C0QLIST) ; PEP - Analyze ERx Data and store
     
    207208 Q +$G(HASERX)
    208209 ;
    209 SAVE(C0QLIST,C0QDFN,TYPE,COUNT) ; Proc - Private; Save Count
    210  ; TODO: Documentation
     210SAVE(C0QLIST,C0QDFN,TYPE,COUNT) ; Proc - Private; Save Count in C0Q(301, file
     211 ; Layman's Explanation: Save the denominator or numerator for ePrescribing for
     212 ; each of the patients in the Subfile for that patient in ^C0Q(301,
     213 ; Still hard to understand though! Here's a demo:
     214 ; ^C0Q(301,IEN has a subfile under node 1 which stores the patients. E.g.
     215 ; ^C0Q(301,48,1,15,0)=91$
     216 ; ^C0Q(301,48,1,16,0)=93$
     217 ; ^C0Q(301,48,1,17,0)=173$
     218 ;
     219 ; I store the numerator and denominator under each of the patients. The numerator
     220 ; stands for the number of prescriptions that were electronically transmitted;
     221 ; the denominator stands for the numbers of prescriptions that COULD HAVE BEEN
     222 ; electronically transmitted. End result for Patient 173 is as follows:
     223 ; ^C0Q(301,48,1,17,0)=173
     224 ; ^C0Q(301,48,1,17,1,0)="^1130580001.3111^2^2"
     225 ; ^C0Q(301,48,1,17,1,1,0)="ERXDEN^0"
     226 ; ^C0Q(301,48,1,17,1,2,0)="ERXNUM^0"
     227 ; ^C0Q(301,48,1,17,1,"B","ERXDEN",1)=""
     228 ; ^C0Q(301,48,1,17,1,"B","ERXNUM",2)=""
     229 ;
     230 ; Subroutine COUNT (below) goes and counts the data
     231 ;
     232 ; Params:
     233 ; C0QLIST (by val): "B" x-ref where patients are located. Only supports ^C0Q(301, file.
     234 ; C0QDFN (by val): Patient DFN for whom to file data.
     235 ; TYPE (by val): Either ERXDEN or ERXNUM for eRx Denominator or eRx Numerator
     236 ; COUNT (by val): The number to save
    211237 ;
    212238 ; First, QUIT if this isn't a Quality Measures List?
     
    246272 I $D(C0QERR) DO
    247273 . W "Error in filing data",!
    248  . S %=$NAME(C0QERR) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
     274 . N % S %=$NAME(C0QERR) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
    249275 ;
    250276 QUIT
     277 ;
     278COUNT(C0QLIST) ; $$ - Private; Count Numerator and Denominator for a Patient List
     279 ; Input: C0QLIST - Pass by Value - Patient Listing B index (only C0Q(301,IEN,1,"B", listing is supported)
     280 ; Output: (as string) NUMERATOR/DENOMINATOR
     281 ;
     282 I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Counting for files other than C0Q(301, not supported ",! QUIT
     283 ; MEASURE -----------
     284 ; IEN -----------   |
     285 ; L1 ------|    |   |
     286 ;          V    V   V
     287 ; ^C0Q(301,48,1,2,1,1,0)="ERXDEN^0"
     288 ; ^C0Q(301,48,1,2,1,2,0)="ERXNUM^0"
     289 ; ^C0Q(301,48,1,2,1,"B","ERXDEN",1)=""
     290 ; ^C0Q(301,48,1,2,1,"B","ERXNUM",2)=""
     291 ; ^C0Q(301,48,1,2,1,"B"
     292 W:$G(C0QDEBUG) "DFN",?20,"Denominator",?40,"Numerator",!
     293 ;
     294 N L1 S L1=$QS(C0QLIST,2) ; Top Level IEN
     295 ;
     296 N DENTOT,NUMTOT S (DENTOT,NUMTOT)=0 ; Denominator Total, Numerator Total
     297 ;
     298 N C0QDFN S C0QDFN=0 ; Walker through B index
     299 F  S C0QDFN=$O(^C0Q(301,L1,1,"B",C0QDFN)) Q:C0QDFN=""  DO
     300 . N IEN S IEN=$O(^(C0QDFN,"")) ; naked naked - get IEN from B index
     301 . W:$G(C0QDEBUG) C0QDFN
     302 . ;
     303 . ; Denom Processing
     304 . N DENIEN S DENIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXDEN","")) ; Denom IEN
     305 . N DEN S DEN=$S(DENIEN:$P(^C0Q(301,L1,1,IEN,1,DENIEN,0),U,2),1:"N/A") ; Denominator
     306 . W:$G(C0QDEBUG) ?20,DEN
     307 . S DENTOT=DENTOT+DEN ; Total it up (N/A becomes zero)
     308 . ;
     309 . N NUMIEN S NUMIEN=$O(^C0Q(301,L1,1,IEN,1,"B","ERXNUM","")) ; Numerator IEN
     310 . N NUM S NUM=$S(NUMIEN:$P(^C0Q(301,L1,1,IEN,1,NUMIEN,0),U,2),1:"N/A") ; Numerator
     311 . W:$G(C0QDEBUG) ?40,NUM
     312 . S NUMTOT=NUMTOT+NUM ; Total it up (N/A becomes zero)
     313 . ;
     314 . w:$G(C0QDEBUG) !
     315 ;
     316 ; Write the totals
     317 D:$G(C0QDEBUG)
     318 . W ?20,"==="
     319 . W ?40,"==="
     320 . W !
     321 . ;
     322 . W ?20,DENTOT
     323 . W ?40,NUMTOT
     324 . W !
     325 ;
     326 ; Quit with Numeartor/Denominator
     327 QUIT NUMTOT_"/"_DENTOT
Note: See TracChangeset for help on using the changeset viewer.