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

Last change on this file since 1457 was 1438, checked in by Sam Habiel, 13 years ago

Updated routines after many small fixes; added C0QKIDS as well

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