source: qrda/C0Q/trunk/p/C0QKIDS.m@ 1497

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

restored old KIDS file; moved logic for reminders into new init routine C0Q1P2

File size: 5.1 KB
RevLine 
[1484]1C0QKIDS ; VEN/SMH - Kids Utilities for transporting C0Q data ; 7/13/12 11:49am
[1465]2 ;;1.0;C0Q;;May 21, 2012;Build 47
[1438]3 ; Licensed under package license. See Documentation.
4 ;
[1465]5 ; PEPs: PRE, TRAN, POST
[1438]6 ;
[1465]7PRE ; Unified Pre; PEP
8 QUIT
[1438]9TRAN ; Unified Transport; PEP
10 ; D TRAN301 ; looks like I won't send that file over
11 D TRAN201
12 QUIT
13POST ; Unified Post; PEP
14 ; D POST301 ; looks like I won't send that file over
15 D POST101
16 D POST201
17 QUIT
18 ;
19 ; << >>
20 ;
21TRAN301 ; Grab FDA for entire file C0Q PATIENT LIST and store in Transport Global; Private EP
22 N C0QIEN S C0QIEN=0 ; IEN walker
23 N C0QREF1 S C0QREF1=$NAME(^TMP("C0QOLD",$J)) ; Temporary Global Reference
24 N C0QREF2 S C0QREF2=$NAME(^TMP("C0QNEW",$J)) ; Temporary Global Reference
25 K @C0QREF1,@C0QREF2 ; Kill that
26 F S C0QIEN=$O(^C0Q(301,C0QIEN)) Q:'+C0QIEN D
27 . D GETS^DIQ(1130580001.301,C0QIEN_",","*","",C0QREF1) ; Load FDA's in there
28 . M @C0QREF2@(1130580001.301,"?+"_C0QIEN_",")=@C0QREF1@(1130580001.301,C0QIEN_",") ; Change IENs to ?+ IENs
29 M @XPDGREF@("C0Q","1130580001.301")=@C0QREF2 ; Put in Transport Global
30 K @C0QREF1,@C0QREF2 ; Remove
31 QUIT
32 ;
33TRAN201 ; Grab FDA for 201 C0Q MEASUREMENTS selected fields; Private EP
34 N C0QIEN S C0QIEN=0 ; IEN walker
35 N C0QREF1 S C0QREF1=$NAME(^TMP("C0QOLD",$J)) ; Temporary Global Reference
36 N C0QREF2 S C0QREF2=$NAME(^TMP("C0QNEW",$J)) ; Temporary Global Reference
37 K @C0QREF1,@C0QREF2 ; Kill that
38 ;
39 ; We need C0QCOUNT so that it wouldn't reuse the numbers, b/c updater wants numbers for every different item
40 N C0QCOUNT S C0QCOUNT=$O(^C0Q(201," "),-1) ; Counter for SubIENs for destination array; init at highest IEN to prevent dups
41 F S C0QIEN=$O(^C0Q(201,C0QIEN)) Q:'+C0QIEN D ; Walk IENs
42 . W "Exporting "_C0QIEN,!
43 . ; Fields SET NAME, BEGIN DATE, END DATE, LOCKED, USE ALL MEASURES, MU YEAR KEY
44 . D GETS^DIQ(1130580001.201,C0QIEN_",",".01;.02;.03;.05;.2;.3","",C0QREF1)
45 . M @C0QREF2@(1130580001.201,"?+"_C0QIEN_",")=@C0QREF1@(1130580001.201,C0QIEN_",") ; Change IENs to ?+ IENs
46 . N C0QIEN2 S C0QIEN2=0 ; Subfile walker
47 . F S C0QIEN2=$O(^C0Q(201,C0QIEN,5,C0QIEN2)) Q:'+C0QIEN2 D ; MEASURE subfile
48 . . W "Exporting IENS "_C0QIEN2_","_C0QIEN_",",!
49 . . D GETS^DIQ(1130580001.2011,C0QIEN2_","_C0QIEN_",",".01","",C0QREF1) ; MEASURE (#.01)
50 . . S C0QCOUNT=C0QCOUNT+1 ; Increment the counter for SubIEN (can't reuse)
51 . . M @C0QREF2@(1130580001.2011,"?+"_C0QCOUNT_","_"?+"_C0QIEN_",")=@C0QREF1@(1130580001.2011,C0QIEN2_","_C0QIEN_",") ; as above
52 ;
53 M @XPDGREF@("C0Q","1130580001.201")=@C0QREF2 ; Put in transport global
54 K @C0QREF1,@C0QREF2 ; Remove temp
55 QUIT
56 ;
57POST201 ; File FDA for 201; Private EP
58 IF $O(^C0Q(201,0)) DO QUIT ; Quit if data is already there.
59 . D MES^XPDUTL("Data exists in file C0Q MEASUREMENTS... Not adding new data")
60 ;
61 D MES^XPDUTL("Adding data to C0Q MEASUREMENTS")
62 N C0QFDA S C0QFDA=$NAME(@XPDGREF@("C0Q","1130580001.201")) ; Grab FDA from Transport Global
63 N C0QERR ; Error array for filer
64 D UPDATE^DIE("E",C0QFDA,"","C0QERR") ; File all
65 I $D(C0QERR) D ; if there's an error, print it out
66 . D MES^XPDUTL("Couldn't add data into C0Q MEASUREMENTS")
67 . S C0QERR=$Q(C0QERR)
68 . F S C0QERR=$Q(@C0QERR) Q:C0QERR="" D MES^XPDUTL(C0QERR_": "_@C0QERR)
69 QUIT
70 ;
71POST301 ; Get FDA from Transport Global and install in destination system for C0Q PATIENT LIST; Private EP
72 N C0QFDA S C0QFDA=$NAME(@XPDGREF@("C0Q","1130580001.301")) ; FDA array name is the global reference
73 N C0QERR ; Error
74 D UPDATE^DIE("E",C0QFDA,"","C0QERR") ; File all
75 I $D(C0QERR) D ; if there's an error, print it out
76 . D MES^XPDUTL("Couldn't add data into C0Q PATIENT LIST file")
77 . S C0QERR=$Q(C0QERR)
78 . F S C0QERR=$Q(@C0QERR) Q:C0QERR="" D MES^XPDUTL(C0QERR_": "_@C0QERR)
79 QUIT
80 ;
81POST101 ; Clean transported data from broken pointers in C0Q QUALITY MEASURE in destination systems; Private EP
82 D MES^XPDUTL("Cleaning C0Q QUALITY MEASURE data")
83 N C0QIEN S C0QIEN=0 ; Ien looper
84 N C0QFDA ; Fileman Data Array
85 F S C0QIEN=$O(^C0Q(101,C0QIEN)) Q:'+C0QIEN DO ; For each record, delete these fields
86 . S C0QFDA(1130580001.101,C0QIEN_",",1)="@" ; NUMERATOR PATIENT LIST
87 . S C0QFDA(1130580001.101,C0QIEN_",",1.5)="@" ; NEGATIVE NUMERATOR LIST
88 . S C0QFDA(1130580001.101,C0QIEN_",",2)="@" ; DENOMINATOR PATIENT LIST
89 . ; ---
90 . ; I wasn't planning on emptying these out, but the IENs in desintation systems may be different
91 . ; so it is best to remove them for now. It's a pointer field, so IENs are important.
92 . ; Desination file is populated automatically, but only at the site, and only after config.
93 . ; So we can't really ship the pointers as part of the install.
94 . ; ---
95 . S C0QFDA(1130580001.101,C0QIEN_",",1.1)="@" ; ALTERNATIVE NUMERATOR LIST
96 . S C0QFDA(1130580001.101,C0QIEN_",",1.51)="@" ; ALTERNATE NEGATIVE NUM LIST
97 . S C0QFDA(1130580001.101,C0QIEN_",",2.1)="@" ; ALTERNATIVE DENOMINATOR LIST
98 N C0QERR ; Errors
99 D FILE^DIE("","C0QFDA","C0QERR") ; Do it!
100 I $D(C0QERR) D ; if there's an error, print it out
101 . D MES^XPDUTL("Couldn't fix data into C0Q QUALITY MEASURE file")
102 . S C0QERR=$Q(C0QERR)
103 . F S C0QERR=$Q(@C0QERR) Q:C0QERR="" D MES^XPDUTL(C0QERR_": "_@C0QERR)
104 QUIT
[1465]105 ;
106 ; Code below taken from PXRMP15I
107 ;===============================================================
Note: See TracBrowser for help on using the repository browser.