- MAGUE001 ;WOIFO/MLH/BT/DAC - database encapsulation - study description for DICOM ; May 28, 2020@09:02:05
- ;;3.0;IMAGING;**54,118,263**;Mar 19, 2002;Build 17
- ;; Per VHA Directive 2004-038, this routine should not be modified.
- ;; +---------------------------------------------------------------+
- ;; | Property of the US Government. |
- ;; | No permission to copy or redistribute this software is given. |
- ;; | Use of unreleased versions of this software requires the user |
- ;; | to execute a written test agreement with the VistA Imaging |
- ;; | Development Office of the Department of Veterans Affairs, |
- ;; | telephone (301) 734-0100. |
- ;; | The Food and Drug Administration classifies this software as |
- ;; | a medical device. As such, it may not be changed in any way. |
- ;; | Modifications to this software may result in an adulterated |
- ;; | medical device under 21CFR820, the use of which is considered |
- ;; | to be a violation of US Federal Statutes. |
- ;; +---------------------------------------------------------------+
- ;;
- Q
- ;
- STYDESC(IMAGE,ERR) ;FUNCTION - return study description for an image
- ; input: IMAGE IEN of the image on ^MAG(2005)
- ; function return: p1 study description of the image
- ; (^-pieces) p2 descriptive error message if any
- ;
- N STYDESC ; -- study description
- N MAGR2 ; ---- 2 node of the image on ^MAG(2005)
- N MAGPKG ; --- name of package with which image is associated
- S ERR=""
- I '$D(^MAG(2005,IMAGE)) S ERR="13~Image record not defined" Q ""
- S MAGR2=$G(^MAG(2005,IMAGE,2))
- I MAGR2="" S ERR="11~2 node missing from image file" Q ""
- S MAGPKG=$P(MAGR2,"^",6)
- I MAGPKG="" S ERR="12~Image not associated with any known package" Q ""
- S STYDESC=""
- D ; radiology or consult procedure?
- . I MAGPKG=74 D Q ; radiology image
- . . N MAGRRPTI ; -- radiology report index
- . . N MAGRORDR ; -- radiology order record
- . . N MAGRPROC ; -- radiology procedure code
- . . S MAGRRPTI=$P(MAGR2,"^",7)
- . . I MAGRRPTI="" S ERR="15~Radiology report index missing from image record" Q
- . . S MAGRORDR=$$RORDRR^MAGUE002(MAGRRPTI,.ERR)
- . . I ERR'="" Q
- . . S MAGRPROC=$P(MAGRORDR,"^",2)
- . . I 'MAGRPROC S ERR="13~Procedure code missing from radiology order" Q
- . . S STYDESC=$$PROCDESC^MAGUE003(MAGRPROC,.ERR)
- . . Q
- . I (MAGPKG=8925)!(MAGPKG=2006.5839) D Q ; consult image
- . . S STYDESC=$P(MAGR2,"^",4)
- . . Q
- . S ERR="14~Study description access method not defined"
- . Q
- Q STYDESC
- ;
- STYDESC2(TYPE,IMAGE,ERR,IENTYPE) ; UPDATED FUNCTION - return study description for an image
- ; input: TYPE R or C (old database) or N (new database)
- ; IMAGE IEN of the image on ^MAG(2005)
- ; IENTYPE P263 DAC - Default/Null for SOP (#2005.64) file, "IMAGE" for Image (#2005.65) file
- ; function return: p1 study description of the image
- ; (^-pieces) p2 descriptive error message if any
- ;
- N STYDESC ; ------- study description
- I TYPE="N" D
- . N STUDYIX ; study index
- . ; P263 DAC - Added parameter so that STUDYIX function can accept SOP or IMAGE IENs
- . S STUDYIX=$$STUDYIX^MAGUE004(IMAGE,$G(IENTYPE)) Q:'STUDYIX
- . S STYDESC=$P($G(^MAGV(2005.62,STUDYIX,3)),"^",1)
- . Q
- I (TYPE="R")!(TYPE="C") D
- . S STYDESC=$$STYDESC(IMAGE)
- . Q
- Q $G(STYDESC)
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGUE001 3427 printed Feb 18, 2025@23:35:16 Page 2
- 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
- +2 ;; Per VHA Directive 2004-038, this routine should not be modified.
- +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 ;; | The Food and Drug Administration classifies this software as |
- +11 ;; | a medical device. As such, it may not be changed in any way. |
- +12 ;; | Modifications to this software may result in an adulterated |
- +13 ;; | medical device under 21CFR820, the use of which is considered |
- +14 ;; | to be a violation of US Federal Statutes. |
- +15 ;; +---------------------------------------------------------------+
- +16 ;;
- +17 QUIT
- +18 ;
- STYDESC(IMAGE,ERR) ;FUNCTION - return study description for an image
- +1 ; input: IMAGE IEN of the image on ^MAG(2005)
- +2 ; function return: p1 study description of the image
- +3 ; (^-pieces) p2 descriptive error message if any
- +4 ;
- +5 ; -- study description
- NEW STYDESC
- +6 ; ---- 2 node of the image on ^MAG(2005)
- NEW MAGR2
- +7 ; --- name of package with which image is associated
- NEW MAGPKG
- +8 SET ERR=""
- +9 IF '$DATA(^MAG(2005,IMAGE))
- SET ERR="13~Image record not defined"
- QUIT ""
- +10 SET MAGR2=$GET(^MAG(2005,IMAGE,2))
- +11 IF MAGR2=""
- SET ERR="11~2 node missing from image file"
- QUIT ""
- +12 SET MAGPKG=$PIECE(MAGR2,"^",6)
- +13 IF MAGPKG=""
- SET ERR="12~Image not associated with any known package"
- QUIT ""
- +14 SET STYDESC=""
- +15 ; radiology or consult procedure?
- Begin DoDot:1
- +16 ; radiology image
- IF MAGPKG=74
- Begin DoDot:2
- +17 ; -- radiology report index
- NEW MAGRRPTI
- +18 ; -- radiology order record
- NEW MAGRORDR
- +19 ; -- radiology procedure code
- NEW MAGRPROC
- +20 SET MAGRRPTI=$PIECE(MAGR2,"^",7)
- +21 IF MAGRRPTI=""
- SET ERR="15~Radiology report index missing from image record"
- QUIT
- +22 SET MAGRORDR=$$RORDRR^MAGUE002(MAGRRPTI,.ERR)
- +23 IF ERR'=""
- QUIT
- +24 SET MAGRPROC=$PIECE(MAGRORDR,"^",2)
- +25 IF 'MAGRPROC
- SET ERR="13~Procedure code missing from radiology order"
- QUIT
- +26 SET STYDESC=$$PROCDESC^MAGUE003(MAGRPROC,.ERR)
- +27 QUIT
- End DoDot:2
- QUIT
- +28 ; consult image
- IF (MAGPKG=8925)!(MAGPKG=2006.5839)
- Begin DoDot:2
- +29 SET STYDESC=$PIECE(MAGR2,"^",4)
- +30 QUIT
- End DoDot:2
- QUIT
- +31 SET ERR="14~Study description access method not defined"
- +32 QUIT
- End DoDot:1
- +33 QUIT STYDESC
- +34 ;
- 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)
- +2 ; IMAGE IEN of the image on ^MAG(2005)
- +3 ; IENTYPE P263 DAC - Default/Null for SOP (#2005.64) file, "IMAGE" for Image (#2005.65) file
- +4 ; function return: p1 study description of the image
- +5 ; (^-pieces) p2 descriptive error message if any
- +6 ;
- +7 ; ------- study description
- NEW STYDESC
- +8 IF TYPE="N"
- Begin DoDot:1
- +9 ; study index
- NEW STUDYIX
- +10 ; P263 DAC - Added parameter so that STUDYIX function can accept SOP or IMAGE IENs
- +11 SET STUDYIX=$$STUDYIX^MAGUE004(IMAGE,$GET(IENTYPE))
- if 'STUDYIX
- QUIT
- +12 SET STYDESC=$PIECE($GET(^MAGV(2005.62,STUDYIX,3)),"^",1)
- +13 QUIT
- End DoDot:1
- +14 IF (TYPE="R")!(TYPE="C")
- Begin DoDot:1
- +15 SET STYDESC=$$STYDESC(IMAGE)
- +16 QUIT
- End DoDot:1
- +17 QUIT $GET(STYDESC)