source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGXCVL.m@ 1504

Last change on this file since 1504 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1MAGXCVL ;WOIFO/SEB,MLH - Image File Conversion Utilities & Misc. options ; 15 Jul 2004 10:54 AM
2 ;;3.0;IMAGING;**17,25,31**;Mar 31, 2005
3 ;; +---------------------------------------------------------------+
4 ;; | Property of the US Government. |
5 ;; | No permission to copy or redistribute this software is given. |
6 ;; | Use of unreleased versions of this software requires the user |
7 ;; | to execute a written test agreement with the VistA Imaging |
8 ;; | Development Office of the Department of Veterans Affairs, |
9 ;; | telephone (301) 734-0100. |
10 ;; | |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19 ;
20 ; Entry point for the File Setup option (MAG IMAGE INDEX FILE SETUP)
21EN N FNAME,COUNT,MAGDATA,MAGFLD,MAGID,CT,DR,DIE,DA,%ZIS
22 N IX ; --------- scratch subscript var
23 ;
24 S COUNT=0
25EN1 ; get the name of the conversion file
26 K DIR S DIR(0)="FOU^3:60"
27 S DIR("A")="Please enter the filename of the conversion file"
28 S DIR("?",1)="Enter a filename (including the path) of a text file"
29 S DIR("?")="containing mapping data."
30 D ^DIR
31 I $G(Y)]"",'$D(DUOUT),'$D(DTOUT)
32 E S COUNT=-1 G DONE
33 S %ZIS="",%ZIS("HFSNAME")=Y,%ZIS("HFSMODE")="R",IOP="HFS"
34 S X="ERR^"_$T(+0),@^%ZOSF("TRAP")
35 D ^%ZIS I POP=1 W !,"Invalid filename. Please try again." G EN1
36 U IO(0)
37CLEAR ; confirm it's OK to clear before proceeding
38 K DIR S DIR(0)="YU"
39 S DIR("A")="Clear mapping file",DIR("B")="NO"
40 D ^DIR
41 I $D(DUOUT)!$D(DTOUT) G CLOSE
42 I Y K ^XTMP("MAG30P25","MAPPING") W " File cleared!"
43 U IO(0) W !
44 F CT=1:1 U IO(0) W:CT#10=0 "." U IO R MAGDATA:DTIME Q:$E(MAGDATA,1,7)="$$EOF$$" D
45 . S MAGDATA=$TR(MAGDATA,$C(9),U),MAGDATA=$TR(MAGDATA,$C(34),"")
46 . I $E(MAGDATA,1,2)="ID"!(MAGDATA="") Q
47 . I $E(MAGDATA,1,7)="Field #" S MAGFLD=$P($E(MAGDATA,8,$L(MAGDATA)),"-") Q
48 . I MAGFLD="" Q
49 . ; To prevent mismatching of IEN keys, do not overwrite the values in the
50 . ; MAG DESCRIPTIVE CATEGORIES File (#2005.81). Instead, we will later
51 . ; load the values from that (merged-into) file into the mapping file.
52 . I MAGFLD=100 Q
53 . S MAGID=$P(MAGDATA,U)
54 . I MAGFLD=6!(MAGFLD=8)!(MAGFLD=10) S MAGID=$P(MAGDATA,U,2)
55 . I MAGID="" Q
56 . S ^XTMP("MAG30P25","MAPPING",MAGFLD,MAGID)=$P(MAGDATA,U,2,999)
57 . I MAGFLD=16 D DIE(MAGFLD,MAGID,MAGDATA)
58 . Q
59 U IO(0) W !,"Mapping text file load complete.",!
60 ;
61 ; Here is where we will load FROM the MAG DESCRIPTIVE CATEGORIES File
62 ; (#2005.81) INTO the mapping file. (We used to do it the other way around.)
63 W !,"Loading values from MAG DESCRIPTIVE CATEGORIES..."
64 S IX=0
65 F S IX=$O(^MAG(2005.81,IX)) Q:'IX S MAGDATA=$G(^(IX,2)) I MAGDATA]"" D
66 . S ^XTMP("MAG30P25","MAPPING",100,IX)=$P($G(^MAG(2005.81,IX,0)),U)_U_MAGDATA
67 . Q
68 W "done.",!
69 ;
70 ; Now, re-apply local edits from the audit subtree.
71 W !,"Re-applying local edits..."
72 S AUDIX=0
73 F S AUDIX=$O(^XTMP("MAG30P25","MAPEDITAUD",AUDIX)) Q:'AUDIX S AUDDTA=$G(^(AUDIX,0)) I AUDDTA]"" D
74 . S ^XTMP("MAG30P25","MAPPING",$P(AUDDTA,U,3),$P(AUDDTA,U,4))=$P(AUDDTA,U,5,999)
75 . Q
76 W "done.",!
77 G CLOSE
78 ;
79DIE(MAGFLD,MAGID,MAGDATA) ;
80 ; File mapping data for field 16 into file #2005.03 (Parent Data File)
81 ; or mapping data for field 100 into file #2005.81 (MAG Descriptive Categories)
82 ; Called from CLEAR and from END^MAGXCVE
83 N DR ; --- FileMan field string
84 N DIE ; -- FileMan file number
85 N DA ; --- FileMan internal entry number
86 N I ; ---- scratch index
87 ;
88 F I=3:1:8 S $P(MAGDATA,U,I)=$S($P(MAGDATA,U,I)="":"@",1:$P($P(MAGDATA,U,I),"-"))
89 S DR="40////"_$P(MAGDATA,U,3)_";41////"_$P(MAGDATA,U,4)
90 S DR=DR_";42////"_$P(MAGDATA,U,5)_";43////"_$P(MAGDATA,U,6)
91 S DR=DR_";44////"_$P(MAGDATA,U,7)_";45////"_$P(MAGDATA,U,8)
92 S DIE=$S(MAGFLD=16:2005.03,MAGFLD=100:2005.81),DA=MAGID U IO D ^DIE
93 Q
94 ;
95 ; Reached when an error (including end-of-file) occurs.
96ERR ;
97 U IO(0) X "W !,$ZE,!"
98CLOSE ; normal file close logic
99 D ^%ZISC
100DONE S COUNT=COUNT+1
101 I COUNT=1 W !,"Done importing conversion values."
102 Q
Note: See TracBrowser for help on using the repository browser.