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

MAGUE001.m

Go to the documentation of this file.
  1. MAGUE001 ;WOIFO/MLH/BT/DAC - database encapsulation - study description for DICOM ; May 28, 2020@09:02:05
  1. ;;3.0;IMAGING;**54,118,263**;Mar 19, 2002;Build 17
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  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. ;; | 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. STYDESC(IMAGE,ERR) ;FUNCTION - return study description for an image
  1. ; input: IMAGE IEN of the image on ^MAG(2005)
  1. ; function return: p1 study description of the image
  1. ; (^-pieces) p2 descriptive error message if any
  1. ;
  1. N STYDESC ; -- study description
  1. N MAGR2 ; ---- 2 node of the image on ^MAG(2005)
  1. N MAGPKG ; --- name of package with which image is associated
  1. S ERR=""
  1. I '$D(^MAG(2005,IMAGE)) S ERR="13~Image record not defined" Q ""
  1. S MAGR2=$G(^MAG(2005,IMAGE,2))
  1. I MAGR2="" S ERR="11~2 node missing from image file" Q ""
  1. S MAGPKG=$P(MAGR2,"^",6)
  1. I MAGPKG="" S ERR="12~Image not associated with any known package" Q ""
  1. S STYDESC=""
  1. D ; radiology or consult procedure?
  1. . I MAGPKG=74 D Q ; radiology image
  1. . . N MAGRRPTI ; -- radiology report index
  1. . . N MAGRORDR ; -- radiology order record
  1. . . N MAGRPROC ; -- radiology procedure code
  1. . . S MAGRRPTI=$P(MAGR2,"^",7)
  1. . . I MAGRRPTI="" S ERR="15~Radiology report index missing from image record" Q
  1. . . S MAGRORDR=$$RORDRR^MAGUE002(MAGRRPTI,.ERR)
  1. . . I ERR'="" Q
  1. . . S MAGRPROC=$P(MAGRORDR,"^",2)
  1. . . I 'MAGRPROC S ERR="13~Procedure code missing from radiology order" Q
  1. . . S STYDESC=$$PROCDESC^MAGUE003(MAGRPROC,.ERR)
  1. . . Q
  1. . I (MAGPKG=8925)!(MAGPKG=2006.5839) D Q ; consult image
  1. . . S STYDESC=$P(MAGR2,"^",4)
  1. . . Q
  1. . S ERR="14~Study description access method not defined"
  1. . Q
  1. Q STYDESC
  1. ;
  1. STYDESC2(TYPE,IMAGE,ERR,IENTYPE) ; UPDATED FUNCTION - return study description for an image
  1. ; input: TYPE R or C (old database) or N (new database)
  1. ; IMAGE IEN of the image on ^MAG(2005)
  1. ; IENTYPE P263 DAC - Default/Null for SOP (#2005.64) file, "IMAGE" for Image (#2005.65) file
  1. ; function return: p1 study description of the image
  1. ; (^-pieces) p2 descriptive error message if any
  1. ;
  1. N STYDESC ; ------- study description
  1. I TYPE="N" D
  1. . N STUDYIX ; study index
  1. . ; P263 DAC - Added parameter so that STUDYIX function can accept SOP or IMAGE IENs
  1. . S STUDYIX=$$STUDYIX^MAGUE004(IMAGE,$G(IENTYPE)) Q:'STUDYIX
  1. . S STYDESC=$P($G(^MAGV(2005.62,STUDYIX,3)),"^",1)
  1. . Q
  1. I (TYPE="R")!(TYPE="C") D
  1. . S STYDESC=$$STYDESC(IMAGE)
  1. . Q
  1. Q $G(STYDESC)