Changeset 1443


Ignore:
Timestamp:
Jun 8, 2012, 9:27:49 PM (12 years ago)
Author:
Sam Habiel
Message:

Adding support for filing the denominator and numerator into a patient list

File:
1 edited

Legend:

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

    r1441 r1443  
    1 C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 10:21am
     1C0QMUERX ; VEN - Analyze ERx Data for Patients ; 5/30/12 1:48am
    22 ;;1.0;C0Q;;May 21, 2012;Build 44
    33 QUIT  ; No Entry from the top
     
    2323 D EN("^C0Q(301,4,1,""B"")")
    2424 QUIT
     25UT3 ; More Unit Tests
     26 N C0QDEBUG S C0QDEBUG=1
     27 D EN($$PATLN^C0QMU12("MU12-EP-HasERX"))
     28 QUIT
    2529EN(C0QLIST) ; PEP - Analyze ERx Data and store
    2630 ; Parameters:
     
    5458 ;
    5559 ; Walk the global
    56  N C0QWALK S C0QWALK=$SELECT(C0QB:"",'C0QB:0) ; Walker
     60 N C0QWALK S C0QWALK=$SELECT(C0QB:"",'C0QB:0) ; Walker, start of $ORDER?
    5761 N C0QDONE S C0QDONE=0 ; Finish Flag
    5862 FOR  SET C0QWALK=$O(@C0QLIST@(C0QWALK)) QUIT:C0QDONE  DO
     
    8084 . W:$G(C0QDEBUG) "Calling GETMEDS6 SOAP Web Service Call for "_C0QDFN,!
    8185 . D SOAP^C0PWS2("C0POUT","GETMEDS6",DUZ,C0QDFN)
    82  . Q:$G(^TMP($J,C0QDFN,1,"RowCount"))=0 ; WS says no data
     86 . Q:$G(C0POUT(1,"RowCount"))=0 ; WS says no data
    8387 . M ^TMP($J,C0QDFN)=C0POUT
    8488 ;
     
    109113 ;
    110114 N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
    111  N C0QD S C0QD=0 ; Denominator
     115 N C0QD S C0QD=0 ; Denominator - Overall (cf C0QDP below)
    112116 ;
    113117 ; Calculate Denominator below
    114118 F  S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN=""  DO
     119 . N C0QDP S C0QDP=0 ; Denominator - Patient Specific
    115120 . F  S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO=""  DO
    116121 .. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
     
    139144 .. ;
    140145 .. W:$G(C0QDEBUG) "Adding to Denominator",!
     146 .. S C0QDP=C0QDP+1
    141147 .. S C0QD=C0QD+1
     148 . ;
     149 . ; SAVE C0QDP - while it lasts!
     150 . D SAVE(C0QLIST,C0QDFN,"ERXDEN",C0QDP)
    142151 ;
    143152 ; Calculate Numerator below
    144153 N C0QDFN,C0QRXNO S (C0QDFN,C0QRXNO)=0
    145  N C0QN S C0QN=0 ; Numerator
     154 N C0QN S C0QN=0 ; Numerator - Overall (cf C0QNP below)
    146155 F  S C0QDFN=$O(^TMP($J,C0QDFN)) Q:C0QDFN=""  DO
     156 . N C0QNP S C0QNP=0 ; Numerator - Patient Specific
    147157 . F  S C0QRXNO=$O(^TMP($J,C0QDFN,C0QRXNO)) Q:C0QRXNO=""  DO
    148158 .. W:$G(C0QDEBUG) "Patient "_C0QDFN_" Rx "_C0QRXNO,!
     
    171181 .. ;
    172182 .. W:$G(C0QDEBUG) "Adding to Numerator",!
     183 .. S C0QNP=C0QNP+1
    173184 .. S C0QN=C0QN+1
     185 . ;
     186 . ; Save C0QNP while it lasts
     187 . D SAVE(C0QLIST,C0QDFN,"ERXNUM",C0QNP)
    174188 ;
    175189 S ^TMP($J)=C0QN_U_C0QD
     
    192206 . I $G(@ZERX@(ZI,1,1,0))["E-Rx Web" S (DONE,HASERX)=1
    193207 Q +$G(HASERX)
     208 ;
     209SAVE(C0QLIST,C0QDFN,TYPE,COUNT) ; Proc - Private; Save Count
     210 ; TODO: Documentation
     211 ;
     212 ; First, QUIT if this isn't a Quality Measures List?
     213 ; $QS(x,0) gets you the global name
     214 ;
     215 ; This should give you an idea of what I am dealing with!
     216 ;
     217 ; ^C0Q(301,48,1,15,0)=91
     218 ; ^C0Q(301,48,1,16,0)=93
     219 ; ^C0Q(301,48,1,17,0)=173
     220 ; ^C0Q(301,48,1,18,0)=174
     221 ; ^C0Q(301,48,1,"B",5,1)=""
     222 ; ^C0Q(301,48,1,"B",10,2)=""
     223 ; ^C0Q(301,48,1,"B",11,3)=""
     224 ; ^C0Q(301,48,1,"B",14,4)=""
     225 ;
     226 I $QS(C0QLIST,0)'="^C0Q" W:$G(C0QDEBUG) "Not Saving Patient "_C0QDFN,! QUIT
     227 ;
     228 ; Otherwise, prepare to save
     229 N C0QFDA ; Fileman Data Array
     230 N C0QIENS ; IENS
     231 N L1,L2 ; Top Level, Level 2
     232 S L1=$QS(C0QLIST,2) ; Top Level IEN
     233 S L2=$O(^C0Q(301,L1,1,"B",C0QDFN,"")) ; Patient IEN
     234 S C0QIENS="?+1"_C0QDFN_","_L2_","_L1_"," ; TODO: Here C0QDFN is a dummy for uniqueness in FDA, not meaningful! - DO BETTER!
     235 W:$G(C0QDEBUG) "IENs "_C0QIENS_" ready to file",!
     236 W:$G(C0QDEBUG) "Saving "_TYPE_" of "_COUNT_" for Patient "_$P(^DPT(C0QDFN,0),U)_" ("_C0QDFN_")",!
     237 S C0QFDA(1130580001.3111,C0QIENS,.01)=TYPE
     238 S C0QFDA(1130580001.3111,C0QIENS,.02)=COUNT
     239 ;
     240 W:$G(C0QDEBUG) "Fileman Data Array",!
     241 I $G(C0QDEBUG) N % S %=$NA(C0QFDA) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
     242 ;
     243 N C0QERR ; Errors
     244 D UPDATE^DIE("","C0QFDA","","C0QERR")
     245 ;
     246 I $D(C0QERR) DO
     247 . W "Error in filing data",!
     248 . S %=$NAME(C0QERR) F  S %=$Q(@%) Q:%=""  W %_": "_@%,!
     249 ;
     250 QUIT
Note: See TracChangeset for help on using the changeset viewer.