source: qrda/C0Q/trunk/p/C0QPQRI.m@ 1700

Last change on this file since 1700 was 1501, checked in by Sam Habiel, 12 years ago

Latest routines; T11 copy

File size: 6.1 KB
Line 
1C0QPQRI ; GPL - GENERATES A PQRI XML FILE ; 5/23/12 2:42pm
2 ;;1.0;C0Q;;May 21, 2012;Build 63
3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 Q
21 ;
22C0QQFN() Q 1130580001.101 ; FILE NUMBER FOR C0Q QUALITY MEASURE FILE
23C0QMFN() Q 1130580001.201 ; FILE NUMBER FOR C0Q MEASUREMENT FILE
24C0QMMFN() Q 1130580001.2011 ; FN FOR MEASURE SUBFILE
25C0QMMNFN() Q 1130580001.20111 ; FN FOR NUMERATOR SUBFILE
26C0QMMDFN() Q 1130580001.20112 ; FN FOR DENOMINATOR SUBFILE
27RLSTFN() Q 810.5 ; FN FOR REMINDER PATIENT LIST FILE
28RLSTPFN() Q 810.53 ; FN FOR REMINDER PATIENT LIST PATIENT SUBFILE
29 ;
30EN ;
31 ; lets try some hard coded values for now
32 N C0QVAR
33 ;
34 ; first, the values that occur only once for the file
35 ;
36 S C0QVAR("create-by")="RegistryA"
37 S C0QVAR("create-date")="12-10-2010"
38 S C0QVAR("create-time")="14:27"
39 S C0QVAR("file-number")=1
40 S C0QVAR("number-of-files")=9
41 S C0QVAR("version")="1.0"
42 ;
43 ; registry values
44 ;
45 S C0QVAR("registry-id")=125789123
46 S C0QVAR("registry-name")="Model Registry"
47 S C0QVAR("submission-method")="C"
48 ;
49 ; values for each provider
50 ;
51 S C0QVAR("npi")=12011989
52 S C0QVAR("tin")=387682321
53 S C0QVAR("waiver-signed")="Y"
54 S C0QVAR("encounter-from-date")="06-13-2010"
55 S C0QVAR("encounter-to-date")="12-10-2010"
56 ;
57 ; values for each measure group
58 ;
59 S C0QVAR("ffs-patient-count")=2
60 S C0QVAR("group-eligible-instances")=30
61 S C0QVAR("group-reporting-rate")=66.67
62 S C0QVAR("group-reporting-rate-numerator")=20
63 ;
64 ; for each measure
65 ;
66 S C0QVAR("pqri-measure-number")=128
67 S C0QVAR("eligible-instances")=100
68 S C0QVAR("meets-performance-instances")=18
69 S C0QVAR("performance-exclusion-instances")=0
70 S C0QVAR("performance-not-met-instances")=10
71 S C0QVAR("performance-rate")="90.00"
72 S C0QVAR("reporting-rate")="28.00"
73 ;
74 ;
75 N ZG,ZV
76 D GETTEMP^C0CMXP("ZG","PQRIXML") ; GET THE TEMPLATE
77 D BIND^C0CSOAP("ZV","C0QVAR","PQRIXML") ; GET BINDING VALUES
78 D MAP^C0CXPATH("ZG","ZV","ZO") ; MAP THE XML
79 D MEA("GG","GGG") ; GET THE MEASURES
80 N GB ; BUILD LIST
81 D QUEUE^C0CXPATH("GB","ZO",1,30) ; first part of pqri.xml
82 D QUEUE^C0CXPATH("GB","GG",2,$O(GG(""),-1)-1) ; the measures
83 D QUEUE^C0CXPATH("GB","ZO",$O(ZO(""),-1)-2,$O(ZO(""),-1)) ; LAST LINES
84 D BUILD^C0CXPATH("GB","GZO") ; BUILD THE XML
85 N ZI S ZI=0
86 F S ZI=$O(ZO(ZI)) Q:ZI="" D ; FOR EACH LINE OF XML
87 . W !,GZO(ZI) ; WRITE OUT THE XML
88 N GN,GN1,GD S GN=$NA(^TMP("C0QXML",$J))
89 K @GN
90 K ZO(0) ; GET RID OF LINE COUNT
91 M @GN=GZO
92 S GN1=$NA(@GN@(1))
93 S GD=$G(^TMP("C0CCCR","ODIR")) ; CONVENIENT OUTPUT DIRECTORY
94 W $$OUTPUT^C0CXPATH(GN1,"pqri.xml",GD)
95 K @GN ; DONT NEED IT ANYMORE
96 Q
97 ;
98INSERT(ZARY,ZONE) ; INSERT ONE MEASURE INTO THE ARRAY
99 ;
100 ;N GGG
101 S GGG="//submission/measure-group ID='C'/provider/pqri-measure" ;XPATH
102 D INSINNER^C0CXPATH(ZARY,GGG,ZONE) ; INSERT XML
103 Q
104 ;
105PQRI(ZOUT,KEEP) ; RETURN THE NHIN ARRAY FOR THE PQRI XML TEMPLATE
106 ;
107 N ZG
108 S ZG=$NA(^TMP("PQRIXML",$J))
109 K @ZG
110 D GETXML^C0CMXP(ZG,"PQRIXML") ; GET THE XML FROM C0C MISC XML
111 N C0CDOCID
112 S C0CDOCID=$$PARSE^C0CDOM(ZG,"PQRIXML") ; PARSE THE XML
113 D DOMO^C0CDOM(C0CDOCID,"/","ZOUT","GIDX","GARY",,"//submission") ; BLD ARRAYS
114 I '$G(KEEP) K GIDX,GARY ; GET RID OF THE ARRAYS UNLESS KEEP=1
115 Q
116 ;
117PROCESS(ZRSLT,ZXML,ZREDUCE,KEEP) ; PARSE AND RUN DOMO ON XML
118 ; ZRTN IS PASSED BY REFERENCE
119 ; ZXML IS PASSED BY NAME
120 ; IF KEEP IS 1, GARY AND GIDX ARE NOT KILLED
121 ;
122 N ZG
123 S ZG=$NA(^TMP("C0CXML",$J))
124 K @ZG
125 M @ZG=@ZXML
126 S C0CDOCID=$$PARSE^C0CDOM(ZG,"NHINARRAY") ; PARSE WITH MXML
127 D DOMO^C0CDOM(C0CDOCID,"/","ZRSLT","GIDX","GARY",,$G(ZREDUCE)) ; BLD ARRAYS
128 I '$G(KEEP) K GIDX,GARY,@ZG ; GET RID OF THE ARRAYS UNLESS KEEP=1
129 Q
130 ;
131GETFM(RTN,ZREC) ; GET THE QUALITY MEASURES ARRAY
132 ;
133 I '$D(ZREC) S ZREC=7 ; OUTPATIENT CERTIFICATION SET
134 ;N GPL
135 D LIST^DIC($$C0QMMFN(),","_ZREC_",",".01;1.1;2.1;3;",,,,,,,,"GPL")
136 N ZI S ZI=""
137 F S ZI=$O(GPL("DILIST","ID",ZI)) Q:ZI="" D ;
138 . S @RTN@(ZI,"measure")=GPL("DILIST","ID",ZI,.01)
139 . N ZMIEN,ZMEAIEN,ZRNAME
140 . S ZMIEN=GPL("DILIST",2,ZI) ; IEN OF MEASURE IN MEASURE FILE
141 . ;S ZMEAIEN=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",.01,"I") ; MEASURE
142 . S ZRNAME=$$GET1^DIQ($$C0QMMFN(),ZMIEN_","_ZREC_",",".01:.8") ; MEASURE
143 . ;S @RTN@(ZI,"reportingName")=$$GET1^DIQ($$C0QQFN(),ZMEAIEN_",",.8) ; RNAME
144 . S @RTN@(ZI,"reportingName")=ZRNAME ; A SHORTCUT TO THE REPORTING NAME
145 . S @RTN@(ZI,"reportingNumber")=$P(ZRNAME,"NQF",2) ; NQF0001 -> 0001
146 . S @RTN@(ZI,"denominator")=+GPL("DILIST","ID",ZI,2.1)
147 . S @RTN@(ZI,"numerator")=+GPL("DILIST","ID",ZI,1.1)
148 . N ZNUM,ZDEM,ZPCT
149 . S (ZNUM,ZDEM,ZPCT)=0
150 . S ZDEM=+GPL("DILIST","ID",ZI,2.1)
151 . S ZNUM=+GPL("DILIST","ID",ZI,1.1)
152 . I ZDEM>0 S ZPCT=((ZNUM*100)/ZDEM)
153 . S @RTN@(ZI,"percent")=$P(ZPCT,".",1)
154 . S @RTN@(ZI,"ien")=ZI
155 ;ZWR GPL
156 Q
157 ;
158MEA(ZOUT,ZIN) ; CREATE XML FROM THE MEASURES ARRAY
159 ;
160 D GETFM(ZIN) ; GET THE MEASURES
161 ;N G
162 ;N ZI,ZJ
163 S ZI=""
164 F S ZI=$O(@ZIN@(ZI)) Q:ZI="" D ;
165 . N ZDEN,ZNUM,ZPCT
166 . S ZDEN=$G(@ZIN@(ZI,"denominator"))
167 . S ZNUM=$G(@ZIN@(ZI,"numerator"))
168 . S ZPCT=$G(@ZIN@(ZI,"percent"))
169 . S G("pqri-measure",ZI,"eligible-instances")=ZDEN
170 . S G("pqri-measure",ZI,"meets-performance-instances")=ZNUM
171 . S G("pqri-measure",ZI,"performance-exclusion-instances")=0
172 . S G("pqri-measure",ZI,"performance-not-met-instances")=ZDEN-ZNUM
173 . S G("pqri-measure",ZI,"performance-rate")=ZPCT
174 . S G("pqri-measure",ZI,"pqri-measure-number")="NQF "_@ZIN@(ZI,"reportingNumber")
175 . S G("pqri-measure",ZI,"reporting-rate")=ZPCT
176 K ^TMP("MXMLDOM",$J)
177 S C0CDOCID=$$DOMI^C0CDOM("G",1,"root")
178 D OUTXML^C0CDOM(ZOUT,C0CDOCID,1)
179 Q
180 ;
Note: See TracBrowser for help on using the repository browser.