Changeset 1445 for qrda/C0Q/trunk/p/C0QUPDT.m
- Timestamp:
- Jun 12, 2012, 8:11:47 PM (12 years ago)
- 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:46pm2 ;;1.0;C0Q;;May 21, 2012;Build 4 31 C0QUPDT ; GPL - Quality Reporting List Update Routines ; 5/30/12 3:47pm 2 ;;1.0;C0Q;;May 21, 2012;Build 44 3 3 ;Copyright 2009 George Lilly. Licensed under the terms of the GNU 4 4 ;General Public License See attached copy of the License. … … 46 46 N ZII S ZII="" 47 47 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 48 53 . N C0QNL,C0QDL,C0QFLTN,C0QFLTD 49 54 . S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST 50 55 . S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST 51 56 . S ZI=$P(C0QM(ZII),U,1) ; IEN OF THE MEASURE IN THE C0Q QUALITY MEAS FILE 57 . ; 58 . ; Numerator 52 59 . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1,"I") ; NUMERATOR POINTER 53 60 . I C0QNL="" D ; CHECK ALTERNATE LIST 54 61 . . S C0QNL=$$GET1^DIQ($$C0QQFN,ZI_",",1.1,"I") ; NUMERATOR POINTER 55 62 . . I C0QNL'="" S C0QNALT=1 63 . I C0QNL="" QUIT ; No Numerator. Can't perform calculation.--smh 64 . ; 65 . ; Denominator 56 66 . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2,"I") ; DENOMINATOR POINTER 57 67 . I C0QDL="" D ; CHECK ALTERNATE LIST 58 68 . . S C0QDL=$$GET1^DIQ($$C0QQFN,ZI_",",2.1,"I") ; DENOMINATOR POINTER 59 69 . . I C0QDL'="" S C0QDALT=1 70 . I C0QDL="" QUIT ; No Denominator. Can't perform calcuation.--smh 60 71 . ; 61 72 . ; FIRST PROCESS THE NUMERATOR … … 161 172 . . S ZC=ZC+1 162 173 . I $D(C0QFDA) D UPDIE ; PROCESS 174 . ; 175 . ; File Percentage 163 176 . N C0QPCT ; PERCENT 164 177 . D ; 165 178 . . I C0QDCNT>0 D ; 166 179 . . . S C0QPCT=$J(100*C0QNCNT/C0QDCNT,0,0) 167 180 . . E S C0QPCT=0 168 181 . . K C0QFDA 169 182 . . S C0QFDA($$C0QMMFN(),ZII_","_MSET_",",3)=C0QPCT ; PERCENT … … 191 204 K ZERR 192 205 D CLEAN^DILF 193 ZWRITE C0QFDA206 N % S %=$NA(C0QFDA) F S %=$Q(@%) Q:%="" W %_"="_@%,! ; smh instead of zwrite 194 207 D UPDATE^DIE("","C0QFDA","","ZERR") 195 208 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED … … 200 213 Q 201 214 ; 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
Note:
See TracChangeset
for help on using the changeset viewer.