Changeset 1572 for qrda/C0Q/trunk/p/C0QUPDT.m
- Timestamp:
- Oct 14, 2012, 4:06:20 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
qrda/C0Q/trunk/p/C0QUPDT.m
r1445 r1572 1 C0QUPDT ; GPL - Quality Reporting List Update Routines ; 5/30/12 3:47pm2 ;;1.0;C0Q; ;May 21, 2012;Build 441 C0QUPDT ; GPL - Quality Reporting List Update Routines ; 10/10/12 11:36am 2 ;;1.0;C0Q;**1**;May 21, 2012;Build 32 3 3 ;Copyright 2009 George Lilly. Licensed under the terms of the GNU 4 4 ;General Public License See attached copy of the License. … … 48 48 . ; 49 49 . ; Special processing for eRx measure. 50 . I $ P(C0QM(ZII),U,2)="MU EP ERX" D ERXCOUNT(MSET,ZII) QUIT50 . I $$GET1^DIQ(1130580001.101,+C0QM(ZII)_",",4,"I")="E" D ERXCOUNT(MSET,ZII) Q 51 51 . ; 52 52 . ; Otherwise, we go on 53 . N C0QNL,C0QDL,C0QFLTN,C0QFLTD 53 . N C0QNL,C0QDL,C0QFLTN,C0QFLTD,C0QNALT ; VEN/SMH - line changed in *5 54 54 . S C0QFLTN=$P(C0QM(ZII),U,3) ;IEN OF NUMERATOR FILTER LIST 55 55 . S C0QFLTD=$P(C0QM(ZII),U,4) ; IEN OF DENOMINATOR FILTER LIST … … 204 204 K ZERR 205 205 D CLEAN^DILF 206 N % S %=$NA(C0QFDA) F S %=$Q(@%) Q:%="" W %_"="_@%,! ; smh instead of zwrite206 D ZWRITE^C0QUTIL("C0QFDA") 207 207 D UPDATE^DIE("","C0QFDA","","ZERR") 208 208 I $D(ZERR) S ZZERR=ZZERR ; ZZERR DOESN'T EXIST, INVOKE THE ERROR TRAP IF TASKED … … 213 213 Q 214 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 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 ; 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.