Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGXCVX

MAGXCVX.m

Go to the documentation of this file.
  1. MAGXCVX ;WOIFO/SEB,MLH - Image File Conversion Export ; 24 Mar 2005 11:00 AM
  1. ;;3.0;IMAGING;**17,25,31**;Mar 31, 2005
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. ; Entry point for the Export Results option (MAG IMAGE INDEX EXPORT)
  1. EXPORT N FNAME,COUNT,MAGDATA,MAGFLD,MAGID,CT,DR,DIE,DA,%ZIS,CLEAR
  1. N MAGIEN,GRPIEN,CHILD1,UTYPE,MAGTMP,MAGVALS,FLDNUM,START,END
  1. N MAGNOD ; --- nodes of the current image record, for fast lookup
  1. N I ; -------- scratch loop index
  1. N INT ; ------ internal code value
  1. N EXT ; ------ array for return of external code value from VAL^DIE
  1. ;
  1. S COUNT=0
  1. EX1 R !!,"Please enter the filename of the output file: ",FNAME:DTIME
  1. I $E(FNAME)="?" D G EX1
  1. . W !!,"Enter a file name, including the path, of the file to export."
  1. . Q
  1. I $TR(FNAME,"^")="" W !!,"No filename entered. Goodbye!" Q
  1. S %ZIS="",%ZIS("HFSNAME")=FNAME,%ZIS("HFSMODE")="W",IOP="HFS"
  1. S X="ERR^"_$T(+0),@^%ZOSF("TRAP")
  1. D ^%ZIS I POP=1 W !,"Unable to open "_FNAME_" for output. Please try again." G EX1
  1. W ! D BOUNDS^MAGXCVP(.START,.END) I START="^" S COUNT=-1 G ERR
  1. S START=+$G(START),END=+$G(END) I END=0 S END=+$P($G(^MAG(2005,0)),U,3)
  1. S MAGIEN=START-1 I MAGIEN=-1 S MAGIEN=0
  1. W ! U IO W "Image IEN",$C(9),"Short Description",$C(9),"Procedure",$C(9),"Parent Data File",$C(9)
  1. W "Document Category",$C(9),"Object Type",$C(9),"Save By Group",$C(9)
  1. W "Package",$C(9),"Class",$C(9),"Type",$C(9),"Specialty",$C(9),"Proc/Event",$C(9),"Origin",!
  1. F CT=0:1 S MAGIEN=$O(^XTMP("MAGIXCVGEN",MAGIEN)) Q:MAGIEN>END!(+MAGIEN'=MAGIEN) D
  1. . U IO(0) W:CT#100=0 MAGIEN W:CT#10=0 "."
  1. . S GRPIEN=$P($G(^MAG(2005,MAGIEN,0)),U,10) I GRPIEN="" S GRPIEN=MAGIEN
  1. . F I=0,2,100 S MAGNOD(I)=$G(^MAG(2005,GRPIEN,I))
  1. . K MAGVALS,UTYPE
  1. . ; get internal values
  1. . S MAGVALS(3,"I")=$P(MAGNOD(0),U,6) ; object type
  1. . S CHILD1=$P($G(^MAG(2005,GRPIEN,1,1,0)),U)
  1. . I CHILD1]"" S MAGVALS(3,"I")=$P($G(^MAG(2005,CHILD1,0)),U,6)
  1. . S MAGVALS(6,"I")=$P(MAGNOD(0),U,8) ; procedure
  1. . S MAGVALS(8,"I")=$P(MAGNOD(2),U,2) ; image save by
  1. . S MAGVALS(10,"I")=$P(MAGNOD(2),U,4) ; short description
  1. . S MAGVALS(16,"I")=$P(MAGNOD(2),U,6) ; parent data file
  1. . S MAGVALS(100,"I")=$P(MAGNOD(100),U) ; descriptive category
  1. . ; get external values
  1. . I MAGVALS(3,"I") D
  1. . . S MAGVALS(3,"E")=$P($G(^MAG(2005.02,MAGVALS(3,"I"),0)),U)
  1. . . Q
  1. . S MAGVALS(6,"E")=MAGVALS(6,"I")
  1. . I MAGVALS(8,"I") S UTYPE=$$GET1^DIQ(200,MAGVALS(8,"I")_",",29,"E")
  1. . S MAGVALS(10,"E")=MAGVALS(10,"I")
  1. . I MAGVALS(16,"I") D
  1. . . S MAGVALS(16,"E")=$P($G(^MAG(2005.03,MAGVALS(16,"I"),0)),U)
  1. . . Q
  1. . I MAGVALS(100,"I") D
  1. . . S MAGVALS(100,"E")=$P($G(^MAG(2005.81,MAGVALS(100,"I"),0)),U)
  1. . . Q
  1. . U IO W MAGIEN F FLDNUM=10,6,16,100,3 W $C(9),$G(MAGVALS(FLDNUM,"E"))
  1. . W $C(9),$G(UTYPE)
  1. . S MAGDATA=$G(^XTMP("MAGIXCVGEN",MAGIEN))
  1. . W $C(9),$P(MAGDATA,U,2)
  1. . W $C(9) I $P(MAGDATA,U,3)'="" W $P(MAGDATA,U,3),"-",$P($G(^MAG(2005.82,$P(MAGDATA,U,3),0)),U)
  1. . W $C(9) I $P(MAGDATA,U,4)'="" W $P(MAGDATA,U,4),"-",$P($G(^MAG(2005.83,$P(MAGDATA,U,4),0)),U)
  1. . W $C(9) I $P(MAGDATA,U,6)'="" W $P(MAGDATA,U,6),"-",$P($G(^MAG(2005.84,$P(MAGDATA,U,6),0)),U)
  1. . W $C(9) I $P(MAGDATA,U,5)'="" W $P(MAGDATA,U,5),"-",$P($G(^MAG(2005.85,$P(MAGDATA,U,5),0)),U)
  1. . W $C(9) I $P(MAGDATA,U,7)'="" D ; convert set-of-codes to external value
  1. . . S INT=$P(MAGDATA,U,7)
  1. . . D VAL^DIE(2005,"",45,"E",INT,.EXT)
  1. . . W INT_"-"_$G(EXT(0))
  1. . . Q
  1. . W !
  1. . Q
  1. U IO W "***end***",!
  1. U IO(0)
  1. D ^%ZISC G EXDONE
  1. ;
  1. ERR ; Reached when an error (including end-of-file) occurs.
  1. D ^%ZISC
  1. EXDONE S COUNT=COUNT+1
  1. I COUNT=1 W !,"Done exporting generated index values."
  1. Q