Changeset 1519


Ignore:
Timestamp:
Aug 22, 2012, 8:02:16 PM (12 years ago)
Author:
Sam Habiel
Message:

updated

File:
1 edited

Legend:

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

    r1518 r1519  
    1 C0QQRDA ; GPL - Quality Reporting QRDA Processing ; 8/2/12 12:42am
     1C0QQRDA ; GPL - Quality Reporting QRDA Processing ; 8/2/12 10:15am
    22        ;;1.0;QUALITY MEASURES;**4**;May 21, 2012;Build 28
    33        ;Copyright 2012 George Lilly.  Licensed under the terms of the GNU
     
    2121        ; This EP is interactive or silent depending on params
    2222        ;
    23         ; Check for config errors first
    24         N % S %=$$CHECKERR()
    25         I % D EN^DDIOL($P(%,U,2)) QUIT
     23        ; Check for config errors first; try to set-up.
     24        N % S %=$$CHECKPAR()
     25        I +%=1 D EN^DDIOL($P(%,U,2)) QUIT  ; No inpatient pars found... QUIT
     26        I +%=2 D  ; No QRDA Measure Sets... try to set it up.
     27        . D EN^DDIOL("Trying to automatically set-up measure sets in parameters")
     28        . N % S %=$$SETUPPAR($$INPPARM())
     29        . I % D EN^DDIOL("Failed to set-up..."_$P(%,U,2))
     30        . E  D EN^DDIOL("...Set-up complete")
    2631        ;
    2732        ; Print Intro
     
    3944        ; Ask user which measure set to run
    4045        N DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT,DA ; DIR variables
    41         S DIR(0)="SB^V:VTE;S:STK;E:ED"
     46        S DIR(0)="SB^V:VTE;S:STK;E:ED;A:ALL"
    4247        S DIR("A")="Measure to calculate"
    4348        S DIR("A",1)="Which measure set would you like to produce QRDA documents for?"
    4449        S DIR("A",2)="Choose to Run [V]TE Measure Set, [S]TK Measure Set, or "
    45         S DIR("A",3)="[E]D Measure Set"
     50        S DIR("A",3)="[E]D Measure Set. Or you can choose to run [A]ll of them."
    4651        D ^DIR
    4752        ;
     
    5257        ; of DIR directly.
    5358        ;
    54         N FLD S FLD=Y(0)
    55         N C0QMSIEN S C0QMSIEN=$$GET1^DIQ(1130580001.401,$$INPPARM(),FLD,"I")
    56         ;
    57         S:'C0QMSIEN $EC=",U1,"  ; Debug.Assert that MSIEN is numeric.
     59        N FLD S FLD=Y(0) ; Grab full text of user choice into var "FLD" for field.
     60        N C0QMSIENS ; Measure set IENs (^ piece); (0) stores the identifier for file names
     61        ;looks like this in the end
     62        ; C0QMSIENS=1^3^5
     63        ; C0QMSIENS(0)="ED^VTE^STK"
     64        ;
     65        N INPPARM S INPPARM=$$INPPARM() ; Inpatient Parameter IEN in 401
     66        ;
     67        ; If not all, grab the measure; else, grab all of them in ^ pieces
     68        I FLD'="ALL" D
     69        . S C0QMSIENS=$$GET1^DIQ(1130580001.401,INPPARM,FLD,"I")
     70        . S C0QMSIENS(0)=FLD
     71        ;
     72        E  D
     73        . N C0QED S C0QED=$$GET1^DIQ(1130580001.401,INPPARM,"ED","I")
     74        . N C0QVTE S C0QVTE=$$GET1^DIQ(1130580001.401,INPPARM,"VTE","I")
     75        . N C0QSTK S C0QSTK=$$GET1^DIQ(1130580001.401,INPPARM,"STK","I")
     76        . S C0QMSIENS=C0QED_U_C0QVTE_U_C0QSTK
     77        . S C0QMSIENS(0)="ED"_U_"VTE"_U_"STK"
     78        ;
     79        ;
     80        S:'C0QMSIENS $EC=",U1,"  ; Debug.Assert that MSIEN is numeric.
     81        ;
    5882        ;
    5983        ; Do the work
    60         N REF S REF=$NAME(^TMP("C0QQRDA",$J)) ; Global for data collection
    61         K @REF  ; Clear global
    62         D WORK(REF,C0QMSIEN) ; Process Measure Set, collect data in global
    63         D PRINTXML(REF,FLD) ; Generate XML; output to File.
    64         K @REF  ; Clear global
     84        N C0QI ; Counter through the measures
     85        F C0QI=1:1:$L(C0QMSIENS,U) D
     86        . N MSIEN S MSIEN=$P(C0QMSIENS,U,C0QI) ; Measure Set IEN
     87        . N MSNAME S MSNAME=$P(C0QMSIENS(0),U,C0QI) ; Measure Set Name
     88        . N REF S REF=$NAME(^TMP("C0QQRDA",$J)) ; Global for data collection
     89        . K @REF  ; Clear global
     90        . D WORK(REF,MSIEN) ; Process Measure Set, collect data in global
     91        . D PRINTXML(REF,MSNAME) ; Generate XML; output to File.
     92        . K @REF  ; Clear global
    6593        QUIT
    6694        ;
    6795        ;SILENTEN(RETURN) ; For future RPC calls...; needs to be reworked.
    68         ; N % S %=$$CHECKERR()
     96        ; N % S %=$$CHECKPAR()
    6997        ; I % S RETURN(0)=% Q
    7098        ;
     
    74102        ; QUIT
    75103        ;
    76 CHECKERR() ; Private Proc; Check if environment is okay.
    77         ; Output: 0 -> Okay; +ve^message for error
     104CHECKPAR() ; Private Proc; Check if environment is okay.
     105        ; Output: 0 or +ve^message for error
     106        ; 1 -> No Inpatient Parameters found
     107        ; 2 -> Measurement Set(s) not found.
     108        ;
    78109        N INPPARM S INPPARM=$$INPPARM() ; Inpatient Parameters IEN
    79110        I 'INPPARM Q 1_U_"No Inpatient Parameters found"
     
    88119        I 'C0QSTK S TXT=TXT_"STK,"
    89120        I 'C0QVTE S TXT=TXT_"VTE"
    90         I $E(TXT,$L(TXT)=",") S TXT=$E(TXT,1,$L(TXT)-1)
     121        I $E(TXT,$L(TXT))="," S TXT=$E(TXT,1,$L(TXT)-1) ; remove trailing comma
    91122        I $L(TXT) Q 2_U_"Measure Sets missing from parameters: "_TXT
    92123        ;
    93124        QUIT 0 ; All okay
     125        ;
     126SETUPPAR(INPPARM) ; Private Proc; Set-up QRDA lists if Inpatient Param is found.
     127        ; Input: Inpatient Parameter IEN in C0Q(401, -> C0Q Parameters
     128        ; Output: 0 if okay or 1^error description
     129        N C0QFDA
     130        ;
     131        N VTEIEN S VTEIEN=$O(^C0Q(201,"B","VTE CMS REPORTING MEASURES",""))
     132        I 'VTEIEN QUIT 1_U_"VTE not found"
     133        N STKIEN S STKIEN=$O(^C0Q(201,"B","STK CMS REPORTING MEASURES",""))
     134        I 'STKIEN QUIT 1_U_"STK not found"
     135        N EDIEN S EDIEN=$O(^C0Q(201,"B","ED CMS REPORTING MEASURES",""))
     136        I 'EDIEN QUIT 1_U_"ED not found"
     137        ;
     138        S C0QFDA(1130580001.401,INPPARM_",",5.1)=VTEIEN
     139        S C0QFDA(1130580001.401,INPPARM_",",5.2)=STKIEN
     140        S C0QFDA(1130580001.401,INPPARM_",",5.3)=EDIEN
     141        ;
     142        N C0QERR
     143        D FILE^DIE("",$NA(C0QFDA),$NA(C0QERR))
     144        I $D(C0QERR) Q 2_U_C0QERR("DIERR",1,"TEXT",1)
     145        Q 0
    94146        ;
    95147WORK(C0QREF,C0QMSIEN) ; Private Proc; Process Measure Sets; Collect the data.
     
    102154        ;
    103155        ; Calculate totals and move patients over from individual measures
     156        N A
    104157        D UPDATE^C0QUPDT(.A,C0QMSIEN) ; FYI: A isn't used.
    105158        ;
Note: See TracChangeset for help on using the changeset viewer.