Difference between revisions of "VistA Imaging Issues"

From VistApedia
Jump to: navigation, search
(Added a glossary link to Clinical Procedures~)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
Back to [[Programming VistA Issues]]
 +
 +
[[VistA Imaging Issues/RPC Calls]]
 +
 
Here are some points I have learned about VistA imaging.
 
Here are some points I have learned about VistA imaging.
  
Line 8: Line 12:
 
   field .01 will point to a specific TIU document
 
   field .01 will point to a specific TIU document
 
   field .02 can link to an entry in the IMAGE file
 
   field .02 can link to an entry in the IMAGE file
   field 1 can hold the path to a fileserver (e.g. i:\images\jr042696.bmp, etc.)
+
   field 1 can hold the path to a fileserver (e.g. i:\images\jr042696.bmp, etc.)  
 +
        But note: this is not where the filename is stored.  It is in the IMAGE file record.
  
 
  IMAGE (file 2005)  
 
  IMAGE (file 2005)  
Line 14: Line 19:
  
 
If there in an entry in TIU EXTERNAL DATA LINK (file #8925.91), then the corresponding document in CPRS will show a picture icon beside it.
 
If there in an entry in TIU EXTERNAL DATA LINK (file #8925.91), then the corresponding document in CPRS will show a picture icon beside it.
 +
 +
Entry in IMAGE file will point to TIU EXTERNAL DATA LINK file, like this:
 +
  Here are NOTES about IMAGE file:
 +
  PARENT GLOBAL ROOT D0 <-- contain IEN of TIU document this links to (E.G. 14321)
 +
  PARENT DATA FILE#  <-- 8925 (for images linked to notes)
 +
  PARENT DATA FILE IMAGE POINTER <-- should hold IEN of entry in TIU EXTERNAL DATA LINK
 +
    used to check existence of ^TIU(8925.91,IEN,0)
 +
 +
Here is a sample successful [[record~|Record]] in the IMAGE file
 +
  NUMBER: 1                           
 +
  OBJECT NAME: test1
 +
  FILEREF: triplegears.jpg             
 +
  DISK & VOLUME, MAGNETIC: TMGImageServer  <-- link to [[record~|Record]] in NETWORK LOCATION
 +
  DISK & VOLUME, ABSTRACT: TMGImageServer
 +
  OBJECT TYPE: STILL IMAGE             
 +
  PATIENT: TEST,KILLME DON'T
 +
  PROCEDURE: testproc
 +
  DATE/TIME IMAGE SAVED: AUG 17, 2005 
 +
  IMAGE SAVE BY: TOPPENBERG,KEVIN S
 +
  SHORT DESCRIPTION: Here is a short description
 +
  PROCEDURE/EXAM DATE/TIME: AUG 16, 2005
 +
  PARENT DATA FILE#: TIU               
 +
  PARENT GLOBAL ROOT D0: 14321  <-- TIU IEN# for document linked to image
 +
  PARENT DATA FILE IMAGE POINTER: 1 <--- matches IEN of [[record~|Record]] below
 +
  LONG DESCRIPTION:  This is an entry for the long entry field
 +
  TYPE INDEX: IMAGE                   
 +
  PROC/EVENT INDEX: HOLTER
 +
  SPEC/SUBSPEC INDEX: MEDICINE         
 +
  ORIGIN INDEX: NON-VA
 +
  CLINIC: Laughlin_Office
 +
  ACQUISITION SITE: Medical Group of Greeneville
 +
 +
  Here is a corresponding entry in the TIU EXTERNAL DATA LINK file
 +
  NUMBER: 1 
 +
  DOCUMENT: PRESCRIPTION CALL IN
 +
  IMAGE: test1                         
 +
  LINKED DATA OBJECT: c:\somepic.jpg
 +
 +
Here is [[record~|Record]] in file NETWORK LOCATION
 +
  NUMBER: 1                             
 +
  NETWORK LOCATION: TMGImageServer
 +
  PHYSICAL REFERENCE: /
 +
  TOTAL SPACE: 9999999                 
 +
  SPACE USED: 0
 +
  FREE SPACE: 9999999                 
 +
  OPERATIONAL STATUS: On-Line
 +
  STORAGE TYPE: MAGNETIC               
 +
  ABSTRACT: Yes
 +
  FULL: Yes                           
 +
  BIG: Yes
 +
  TEXT: Yes                           
 +
  DICOM: No
 +
  MAINTAINCONNECTION: NO               
 +
  RETENTION PERIOD: 365
 +
  MAX # RETRY ON CONNECT: 8           
 +
  MAX # RETRY ON TRANSMIT: 8
 +
  LAST PURGE DATE: SEP 17, 2005@14:01:54
 +
  SITE: TMG                           
 +
  USER: MANAGER,SYSTEM
 +
 +
With the above setup, here is the results of a call to get images for document 14321
 +
  GTM>d IMAGES^MAGGNTI(.REF,14321)
 +
  GTM>ZWR REF(*)
 +
  REF(0)="1^1 Images for the selected TIU NOTE^14321^TEST,KILLME DON'T  PRESCRIPTI
 +
          ON CALL IN  13 Jul 05@09:47:34^1"
 +
  REF(1)="B2^1^/triplegears.jpg^/triplegears.ABS^Here is a short description^30508
 +
          16^1^testproc^08/16/2005^1^M^A^^^1^^^^^^^^^^^"
 +
  
 
Kevin Toppenberg
 
Kevin Toppenberg
Line 23: Line 96:
 
It is locked with key: MAG SYSTEM
 
It is locked with key: MAG SYSTEM
  
 +
 +
Note: the file IMAGING SITE PARAMETERS (2006.1) should be set up.
  
 
Here are some potentially relevant RPC calls
 
Here are some potentially relevant RPC calls
  
  
  MAG3 CPRS TIU NOTE            Returns a list of all images for a TIU document
+
  [[MAGGADDIMAGE]]                  This is the RPC call used by VistA Imaging to add an image.
  MAG3 TIU DATA FROM DA          Get TIU data from the TIUDA.
+
[[MAG3 CPRS TIU NOTE]]             Returns a list of all images for a TIU document
 +
  [[MAG3 TIU DATA FROM DA]]         Get TIU data from the TIUDA.
 
                                 Returns Document Type, and Document Date/Time
 
                                 Returns Document Type, and Document Date/Time
  MAG3 TIU IMAGE                Files the TIU pointer in Imaging and the Imaging Pointer in TIU.
+
  [[MAG3 TIU IMAGE]]                 Files the TIU pointer in Imaging and the Imaging Pointer in TIU.
  MAG4 ADD IMAGE                Adds a new entry to the IMAGE File ^MAG(2005
+
  [[MAG4 ADD IMAGE]]                 Adds a new entry to the IMAGE File ^MAG(2005
  MAG4 CP CONSULT TO TIUDA      Imaging Capture workstation calls this RPC to get a TIU IEN  
+
  [[MAG4 CP CONSULT TO TIUDA]]       Imaging Capture workstation calls this RPC to get a TIU IEN  
 
                                 to attach images to.
 
                                 to attach images to.
 
                                 This call simply calls a CP API, which accepts DFN, Consult #,  
 
                                 This call simply calls a CP API, which accepts DFN, Consult #,  
 
                                 Visit String (optional), Complete|Do not Complete the |transaction.
 
                                 Visit String (optional), Complete|Do not Complete the |transaction.
  MAG4 CP GET VISITS            This RPC call simply call a CP Routine that lists visits for a patient.
+
  [[MAG4 CP GET VISITS]]             This RPC call simply call a CP Routine that lists visits for a patient.
 
                                 Imaging prompts the user with this list when a Visit String
 
                                 Imaging prompts the user with this list when a Visit String
 
                                 is needed by CP to create a Note.
 
                                 is needed by CP to create a Note.
  MAG4 DATA FROM IMPORT QUEUE    This call returns the Array of Data from the Import Queue,  
+
  [[MAG4 DATA FROM IMPORT QUEUE]]   This call returns the Array of Data from the Import Queue,  
 
                                 given a QUEUE Number Called from Delphi and 'M'
 
                                 given a QUEUE Number Called from Delphi and 'M'
  MAG4 REMOTE IMPORT            Called from MS Windows Application.
+
  [[MAG4 REMOTE IMPORT]]             Called from MS Windows [[Application~|Application]].
  MAG4 STATUS CALLBACK          This RPC is called from the Imaging Delphi component when
+
  [[MAG4 STATUS CALLBACK]]           This RPC is called from the Imaging Delphi component when
 
                                 an image/images have been imported via the Imaging Import API
 
                                 an image/images have been imported via the Imaging Import API
                                 being developed for use by Clinical Procedures.
+
                                 being developed for use by [[Clinical Procedures~|Clinical Procedures]].
 
                                 This call is used in the test version of Import API, it will be
 
                                 This call is used in the test version of Import API, it will be
 
                                 replaced in the released version.  In the released version the
 
                                 replaced in the released version.  In the released version the
 
                                 Imaging BackGround Processor will be calling the Status Callback  
 
                                 Imaging BackGround Processor will be calling the Status Callback  
 
                                 routine of CP.
 
                                 routine of CP.
 
  
 
From the VistA Imaging technical manual (edited)...
 
From the VistA Imaging technical manual (edited)...
Line 71: Line 146:
 
  • Image Histologic Stain file, and a Microscopic Objective file used by anatomic pathology.
 
  • Image Histologic Stain file, and a Microscopic Objective file used by anatomic pathology.
 
  • Imaging Site Parameters file.
 
  • Imaging Site Parameters file.
 
 
9-15-05
 
Information about the RPC Call:
 
  MAG3 CPRS TIU NOTE -- Returns a list of all images for a TIU document
 
  -->IMAGES^MAGGNTI(.result,TIUIEN)
 
    calls GETILST^TIUSRVPL(.MAGARR,TIUDA) to get a list of all documents for document
 
    -->  This gets list from "ADI" index in file 8925.91 (TIU EXTERNAL DATA LINK)
 
    for each image in list,
 
      checks ^MAG(2005.1,MAGIEN,  (file 2005.1 = IMAGE AUDIT) to see if deleted.
 
      checks ^MAG(2005,MAGIEN    (file 2005 = IMAGE) to see if it exists.
 
 
      checks if field PATIENT (field #5) in file IMAGE to see if proper link to patient
 
      checks if field PARENT GLOBAL ROOT D0 (field #17) in IMAGE file to see if proper link to document
 
            should = TIUIEN
 
      checks INFO^MAGGTII  //Get info for an Image File entry
 
        -->FINDFILE^MAGFILEB
 
          ;  The call to FINDFILE returns:
 
          ; MAGFILE1=LA100066.ABS  filename
 
          ;          if no Network Location pointer or INVALID Pointer
 
          ;          then MAGFILE1=-1~NO NETWORK LOCATION POINTER 
 
          ;          or -1~INVALID NETWORK LOCATION POINTER
 
          ; MAGFILE1(.01)=KIRIN,B  202524404 image desc
 
          ; MAGJBOL=    desc of Offline server
 
          ; MAGOFFLN=    if JB is offline
 
          ; MAGPREF=C:\TEMP\LA\10\00\  path
 
          ; MAGTYPE=MAG    MAG or WORM
 
 
 
FINDFILE ;
 
N MAG0,MAGERR,MAGREF,MAGSTORE
 
K MAGPREF S (MAGJBOL,MAGERR,MAGTYPE,MAGOFFLN)=""
 
S MAG0=^MAG(2005,+MAGXX,0)
 
      S MAGFILE1=$P(MAG0,"^",2)  //0;2 = field FILEREF (#1) =
 
                    This field contains the unique image filename of the image
 
                    stored on the magnetic server (and the jukebox if you have
 
                    one). It is always eight characters in length, starting
 
                    with the facility's 2 character Imaging
 
                    namespace, with the remaining six characters ranging from
 
                    000001 to 999999.
 
S MAGFILE1(.01)=$P(MAG0,"^") ; for MAILMAN interface  //field .01 (0;1) OBJECT NAME
 
                    Each object has a natural language name; this usually
 
                    consists of the patient name, social security number, and
 
                    object description.
 
S MAGFILE1=$P(MAGFILE1,"\",$L(MAGFILE1,"\"),999)
 
; GEK 4/17/97, if DOCUMENT, send full as the abstract
 
I FILETYPE'="BIG" D  ; code for full size image and abstract
 
. I (FILETYPE="ABSTRACT"),($P(MAG0,"^",6)=15) S FILETYPE="FULL"
 
. I FILETYPE="ABSTRACT" S $P(MAGFILE1,".",2)="ABS"
 
. S MAGREF=$S(FILETYPE="ABSTRACT":$P(MAG0,"^",4),1:$P(MAG0,"^",3))
 
. I MAGREF="" S MAGJB=1,MAGREF=$P(MAG0,"^",5) ; get file from jukebox
 
. Q
 
E  D  Q:MAGERR  ; code for big file
 
. N FBIG
 
. S FBIG=$G(^MAG(2005,MAGXX,"FBIG"))
 
. I FBIG="" D  Q  ; no big file exists
 
. . I $G(MAGWRITE) D  ; output message to screen
 
. . . W !," *** NO ""BIG"" FILE EXISTS FOR IMAGE #",MAGXX," ***"
 
. . . Q
 
. . S MAGPREF="",MAGFILE1="-1~BIG File Does NOT Exist",MAGERR=1
 
. . Q
 
. S $P(MAGFILE1,".",2)="BIG"
 
. S MAGREF=$P(FBIG,"^") ; get file from magnetic disk, if possible
 
. I MAGREF="" S MAGREF=$P(FBIG,"^",2) ; get file from jukebox
 
. Q
 
;
 
I MAGREF="" D  Q  ;NO NETWORK LOCATION
 
. I $G(MAGWRITE) D  ; output message to screen
 
. . W !," *** NO NETWORK LOCATION DEFINED FOR IMAGE #",MAGXX," ***"
 
. . Q
 
. ;S MAGREF="-1~NO NETWORK LOCATION DEFINED"
 
. S MAGFILE1="-1~NO NETWORK LOCATION DEFINED"
 
. Q
 
;
 
I '$D(^MAG(2005.2,MAGREF,0)) D  Q  ; BAD POINTER
 
. ;S MAGREF="-1~INVALID NETWORK LOCATION POINTER ->"_MAGREF
 
. S MAGFILE1="-1~INVALID NETWORK LOCATION POINTER ->"_MAGREF
 
;
 
S MAGSTORE=^MAG(2005.2,MAGREF,0),MAGTYPE=$P(MAGSTORE,"^",7)
 
I MAGTYPE="" S MAGTYPE=$E(MAGSTORE,1,4) ; in case the type is null
 
;
 
S MAGERR=""
 
I '$P(MAGSTORE,"^",6) D  Q:MAGERR  ; the network device is off-line
 
. I MAGTYPE["MAG" D  Q:MAGERR  ; get the jukebox device
 
. . S MAGSTORE=$P(MAG0,"^",5)
 
. . I 'MAGSTORE D NOWHERE S MAGERR=1 Q  ;big trouble:nowhere on jbox
 
. . S MAGSTORE=^MAG(2005.2,MAGSTORE,0) ; get the file from the jbox
 
. . Q
 
. I '$P(MAGSTORE,"^",6) D OFFLINE S MAGERR=1 Q  ;jbox cartridge offline
 
. S MAGREF=$P(MAG0,"^",5)
 
. Q
 
;
 
S MAGPREF=""
 
I MAGTYPE["MAG" S MAGPREF=$P(MAGSTORE,"^",2)
 
;
 
I MAGTYPE?1"WORM".E D  ; code for Jukeboxes
 
. I MAGTYPE=("WORM-OTG") S MAGPREF=$P(MAGSTORE,"^",2)
 
. E  I MAGTYPE="WORM-PDT" S MAGPREF=$P(MAGSTORE,"^",2)
 
. E  I MAGTYPE["WORM-DG" D  ; this code is for DG/SONY jukebox
 
. . N SUBDIR ; the subdirectory is the last two digits of the file name
 
. . S SUBDIR=$P(MAGFILE1,".")
 
. . S SUBDIR=$E(100+$E(SUBDIR,$L(SUBDIR)-1,999),2,3)_"\"
 
. . S MAGPREF=$P(MAGSTORE,"^",2)_SUBDIR
 
. . Q
 
. ; The following is for tracking offline images
 
. I $$IMOFFLN(MAGFILE1) D
 
. . S MAGOFFLN=1
 
. . ;GEK D MAIL(MAGFILE1,MAGPREF)
 
. . I +$G(MAGJOB("VERSION"))<2.4 D
 
. . . S MAGFILE1=$S(MAGFILE1[".ABS":"JBOFFLN.ABS",1:"JBOFFLN.TGA")
 
. . . S MAGPREF=$P(^MAG(2005.2,1,0),"^",2),MAGJBCP=0
 
. ; End of offline image check
 
. I MAGJBCP D  ; add the image to the JukeBox TO Hard Disk copy queue
 
. . S X=$$JBTOHD^MAGBAPI(MAGXX_"^"_FILETYPE)
 
. . Q
 
. Q
 
;
 
S MAGPREF=MAGPREF_$$DIRHASH^MAGFILEB(MAGFILE1,MAGREF)
 
;
 
Q
 

Latest revision as of 01:59, 5 September 2012

Back to Programming VistA Issues

VistA Imaging Issues/RPC Calls

Here are some points I have learned about VistA imaging.

TIU EXTERNAL DATA LINK (file 8925.91)
 1  0;1                .01  DOCUMENT                        <-Pntr  [RP8925']
 2  0;2                .02  IMAGE                            <-Pntr  [P2005']
 3  1;1                  1  LINKED DATA OBJECT                            [F]

 field .01 will point to a specific TIU document
 field .02 can link to an entry in the IMAGE file
 field 1 can hold the path to a fileserver (e.g. i:\images\jr042696.bmp, etc.) 
       But note: this is not where the filename is stored.  It is in the IMAGE file record.
IMAGE (file 2005) 
 Holds metadata about stored images

If there in an entry in TIU EXTERNAL DATA LINK (file #8925.91), then the corresponding document in CPRS will show a picture icon beside it.

Entry in IMAGE file will point to TIU EXTERNAL DATA LINK file, like this:

 Here are NOTES about IMAGE file:
 PARENT GLOBAL ROOT D0 <-- contain IEN of TIU document this links to (E.G. 14321)
 PARENT DATA FILE#  <-- 8925 (for images linked to notes)
 PARENT DATA FILE IMAGE POINTER <-- should hold IEN of entry in TIU EXTERNAL DATA LINK
   used to check existence of ^TIU(8925.91,IEN,0)
Here is a sample successful Record in the IMAGE file
 NUMBER: 1                             
 OBJECT NAME: test1
 FILEREF: triplegears.jpg              
 DISK & VOLUME, MAGNETIC: TMGImageServer  <-- link to Record in NETWORK LOCATION
 DISK & VOLUME, ABSTRACT: TMGImageServer
 OBJECT TYPE: STILL IMAGE              
 PATIENT: TEST,KILLME DON'T
 PROCEDURE: testproc
 DATE/TIME IMAGE SAVED: AUG 17, 2005   
 IMAGE SAVE BY: TOPPENBERG,KEVIN S
 SHORT DESCRIPTION: Here is a short description
 PROCEDURE/EXAM DATE/TIME: AUG 16, 2005
 PARENT DATA FILE#: TIU                
 PARENT GLOBAL ROOT D0: 14321  <-- TIU IEN# for document linked to image
 PARENT DATA FILE IMAGE POINTER: 1 <--- matches IEN of Record below
 LONG DESCRIPTION:   This is an entry for the long entry field
 TYPE INDEX: IMAGE                     
 PROC/EVENT INDEX: HOLTER
 SPEC/SUBSPEC INDEX: MEDICINE          
 ORIGIN INDEX: NON-VA
 CLINIC: Laughlin_Office
 ACQUISITION SITE: Medical Group of Greeneville
 Here is a corresponding entry in the TIU EXTERNAL DATA LINK file
 NUMBER: 1  
 DOCUMENT: PRESCRIPTION CALL IN
 IMAGE: test1                          
 LINKED DATA OBJECT: c:\somepic.jpg
Here is Record in file NETWORK LOCATION
 NUMBER: 1                               
 NETWORK LOCATION: TMGImageServer
 PHYSICAL REFERENCE: /
 TOTAL SPACE: 9999999                  
 SPACE USED: 0
 FREE SPACE: 9999999                   
 OPERATIONAL STATUS: On-Line
 STORAGE TYPE: MAGNETIC                
 ABSTRACT: Yes
 FULL: Yes                             
 BIG: Yes
 TEXT: Yes                             
 DICOM: No
 MAINTAINCONNECTION: NO                
 RETENTION PERIOD: 365
 MAX # RETRY ON CONNECT: 8             
 MAX # RETRY ON TRANSMIT: 8
 LAST PURGE DATE: SEP 17, 2005@14:01:54
 SITE: TMG                             
 USER: MANAGER,SYSTEM
With the above setup, here is the results of a call to get images for document 14321
 GTM>d IMAGES^MAGGNTI(.REF,14321)
 GTM>ZWR REF(*)
 REF(0)="1^1 Images for the selected TIU NOTE^14321^TEST,KILLME DON'T  PRESCRIPTI
         ON CALL IN  13 Jul 05@09:47:34^1"
 REF(1)="B2^1^/triplegears.jpg^/triplegears.ABS^Here is a short description^30508
         16^1^testproc^08/16/2005^1^M^A^^^1^^^^^^^^^^^"


Kevin Toppenberg


9-12-05

The main, top-level imaging menu option is: MAG SYS MENU It is locked with key: MAG SYSTEM


Note: the file IMAGING SITE PARAMETERS (2006.1) should be set up.

Here are some potentially relevant RPC calls


MAGGADDIMAGE                   This is the RPC call used by VistA Imaging to add an image.
MAG3 CPRS TIU NOTE             Returns a list of all images for a TIU document
MAG3 TIU DATA FROM DA          Get TIU data from the TIUDA.
                               Returns Document Type, and Document Date/Time
MAG3 TIU IMAGE                 Files the TIU pointer in Imaging and the Imaging Pointer in TIU.
MAG4 ADD IMAGE                 Adds a new entry to the IMAGE File ^MAG(2005
MAG4 CP CONSULT TO TIUDA       Imaging Capture workstation calls this RPC to get a TIU IEN 
                               to attach images to.
                               This call simply calls a CP API, which accepts DFN, Consult #, 
                               Visit String (optional), Complete|Do not Complete the |transaction.
MAG4 CP GET VISITS             This RPC call simply call a CP Routine that lists visits for a patient.
                               Imaging prompts the user with this list when a Visit String
                               is needed by CP to create a Note.
MAG4 DATA FROM IMPORT QUEUE    This call returns the Array of Data from the Import Queue, 
                               given a QUEUE Number Called from Delphi and 'M'
MAG4 REMOTE IMPORT             Called from MS Windows Application.
MAG4 STATUS CALLBACK           This RPC is called from the Imaging Delphi component when
                               an image/images have been imported via the Imaging Import API
                               being developed for use by Clinical Procedures.
                               This call is used in the test version of Import API, it will be
                               replaced in the released version.  In the released version the
                               Imaging BackGround Processor will be calling the Status Callback 
                               routine of CP.

From the VistA Imaging technical manual (edited)...

7.2.4 Further Information
Every individual object (i.e., an image, audio clip, waveform, or scanned document) 
is an entry in the Image file (2005), where the object's attributes are managed. In
addition, three auxiliary files are used:
• Object Type (2005.02)
• Network Location (2005.2)
• Parent Data (? 2005.03--PARENT DATA FILE ?)
The objects are then related to the patient's VISTA text data (medicine, surgery, 
laboratory, radiology reports or progress notes) through the use of pointers, both 
forward from the VISTA package file to the Image file, and backwards from the Image
file to the VISTA package file.
Software allows new objects to be added and displayed.
Several additional files are used by the system. These include:
• Imaging Workstations file that contains information about every workstation on the network.
• Image Histologic Stain file, and a Microscopic Objective file used by anatomic pathology.
• Imaging Site Parameters file.