source: qrda/C0Q/trunk/p/C0QQRDA.m@ 1516

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

C0QQRDA file by George for calcing QRDA stuff

File size: 2.8 KB
Line 
1C0QQRDA ; GPL - Quality Reporting QRDA Processing ; 8/1/12 7:34am
2 ;;1.0;C0Q;**4**;May 21, 2012;Build 28
3 ;Copyright 2012 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 ;
20EN
21 N REF S REF=$NAME(^TMP("C0QQRDA",$J))
22 K @REF
23 D WORK(REF)
24 D ZWRITE^C0QUTIL(REF)
25 D PRINTXML(REF)
26 QUIT
27 ;
28 ; Get measure set iens from Measure Set file
29 ; TODO: Populate from a config file.
30WORK(C0QREF)
31 N C0Q1 S C0Q1=$O(^C0Q(201,"B","ED CMS REPORTING MEASURES",""))
32 N C0Q2 S C0Q2=$O(^C0Q(201,"B","STK CMS REPORTING MEASURES",""))
33 N C0Q3 S C0Q3=$O(^C0Q(201,"B","VTE CMS REPORTING MEASURES",""))
34 ;
35 ; For each measure, write it, count totals and move patients over
36 N C0QX F C0QX="C0Q1","C0Q2","C0Q3" D
37 . Q:'@C0QX
38 . D EN^DDIOL(@C0QX_": "_^C0Q(201,@C0QX,0))
39 . D EN^DDIOL("")
40 . D UPDATE^C0QUPDT(.A,@C0QX)
41 . ;
42 . ; Get QRDA code for Measure Set.
43 . N C0QMSQRDA S C0QMSQRDA=$$GET1^DIQ($$C0QMFN^C0QUPDT(),@C0QX_",","QRDA TEMPLATE ROOT")
44 . N C0QI S C0QI=0 ; Fileman IEN looper
45 . F S C0QI=$O(^C0Q(201,@C0QX,5,C0QI)) Q:'C0QI D ; For each measure
46 . . N C0QMEASUREQRDA S C0QMEASUREQRDA=$$GET1^DIQ($$C0QMMFN^C0QUPDT(),C0QI_","_@C0QX_",",".01:QRDA TEMPLATE ROOT")
47 . . N C0QP S C0QP=0
48 . . F S C0QP=$O(^C0Q(201,@C0QX,5,C0QI,3,C0QP)) Q:'C0QP D ; For each patient in denominator
49 . . . N C0QDFN S C0QDFN=+^(C0QP,0)
50 . . . S @C0QREF@(C0QDFN,C0QMSQRDA,C0QMEASUREQRDA)=""
51 QUIT
52 ;
53PRINTXML(C0QREF)
54 N C0QDFN,C0QMS,C0QM S (C0QDFN,C0QMS,C0QM)=""
55 S L=0
56 F S C0QDFN=$O(@C0QREF@(C0QDFN)) Q:C0QDFN="" D
57 . D OT("QUALITY")
58 . F S C0QMS=$O(@C0QREF@(C0QDFN,C0QMS)) Q:C0QMS="" D
59 . . D OT("MEASURE_SET")
60 . . D TAG("ID",C0QMS)
61 . . D OT("MEASURES")
62 . . F S C0QM=$O(@C0QREF@(C0QDFN,C0QMS,C0QM)) Q:C0QM="" D
63 . . . D TAG("MEASURE",C0QM)
64 . . D CT("MEASURES")
65 . . D CT("MEASURE_SET")
66 . D CT("QUALITY")
67 QUIT
68 ;
69 ; Quick XML stuff
70OT(STR) D L1 W "<"_STR_">",! Q ; Open Tag
71CT(STR) D L2 W "</"_STR_">",! Q ; Close Tag
72TAG(NM,CONTENT) D WS W "<"_NM_">",CONTENT,"</"_NM_">",! Q ; Write whole tag
73L1 D WS S L=L+1 Q ; Write space and increment
74L2 S L=L-1 D WS Q ; Decrement and Write space
75WS X "F I=1:1:L W "" """ Q ; Write Space
Note: See TracBrowser for help on using the repository browser.