MAGXMA ;WOIFO/MLH - Index mapping API routine ; 14 Jan 2004 2:19 PM
;;3.0;IMAGING;**11**;14-April-2004
;; +---------------------------------------------------------------+
;; | 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
;
FIELD43(XMOD,XSPEC,XPROC) ; API - Determine proc/event based on modality, specialty
;
; Input parameters:
; XMOD Abbreviation for the modality in use (required)
; XSPEC Specialty index in the IMAGE INDEX FOR SPEC/SUBSPEC File
; (#2005.84). This is what will be populated into the
; SPEC/SUBSPEC Field (#44) of the IMAGE File (#2005).
;
; Output parameter:
; .XPROC Associated procedure/event index in the IMAGE INDEX FOR
; PROC/EVENT File (#2005.85). This can be populated into
; the PROC/EVENT Field (#43) of the IMAGE File (#2005).
; If no procedure/event is associated, null is returned unless
; the function returns an exception code < 0.
;
; Function return:
; 0 Executed normally, found a match
; 1 Modality XMOD non-null but is not indexed
; -1 Missing XMOD
; -2 XSPEC non-null, not found in File #2005.84
;
I $G(XMOD)="" Q -1
I $G(XSPEC),'$D(^MAG(2005.84,XSPEC)) Q -2
;
N IMOD ; ---- modality pointer in 2005.872
N ISPEC ; --- specialty multiple pointer in 2005.872
S XPROC=""
;
S IMOD=$O(^MAG(2005.872,"B",XMOD,""))
I 'IMOD Q 1
I XSPEC]"" S ISPEC=$O(^MAG(2005.872,IMOD,1,"B",XSPEC,"")) I ISPEC S XPROC=$P(^MAG(2005.872,IMOD,1,ISPEC,0),U,2)
E S XPROC=$P(^MAG(2005.872,IMOD,0),U,2)
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGXMA 2503 printed Nov 22, 2024@17:20:53 Page 2
MAGXMA ;WOIFO/MLH - Index mapping API routine ; 14 Jan 2004 2:19 PM
+1 ;;3.0;IMAGING;**11**;14-April-2004
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+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 ;
FIELD43(XMOD,XSPEC,XPROC) ; API - Determine proc/event based on modality, specialty
+1 ;
+2 ; Input parameters:
+3 ; XMOD Abbreviation for the modality in use (required)
+4 ; XSPEC Specialty index in the IMAGE INDEX FOR SPEC/SUBSPEC File
+5 ; (#2005.84). This is what will be populated into the
+6 ; SPEC/SUBSPEC Field (#44) of the IMAGE File (#2005).
+7 ;
+8 ; Output parameter:
+9 ; .XPROC Associated procedure/event index in the IMAGE INDEX FOR
+10 ; PROC/EVENT File (#2005.85). This can be populated into
+11 ; the PROC/EVENT Field (#43) of the IMAGE File (#2005).
+12 ; If no procedure/event is associated, null is returned unless
+13 ; the function returns an exception code < 0.
+14 ;
+15 ; Function return:
+16 ; 0 Executed normally, found a match
+17 ; 1 Modality XMOD non-null but is not indexed
+18 ; -1 Missing XMOD
+19 ; -2 XSPEC non-null, not found in File #2005.84
+20 ;
+21 IF $GET(XMOD)=""
QUIT -1
+22 IF $GET(XSPEC)
IF '$DATA(^MAG(2005.84,XSPEC))
QUIT -2
+23 ;
+24 ; ---- modality pointer in 2005.872
NEW IMOD
+25 ; --- specialty multiple pointer in 2005.872
NEW ISPEC
+26 SET XPROC=""
+27 ;
+28 SET IMOD=$ORDER(^MAG(2005.872,"B",XMOD,""))
+29 IF 'IMOD
QUIT 1
+30 IF XSPEC]""
SET ISPEC=$ORDER(^MAG(2005.872,IMOD,1,"B",XSPEC,""))
IF ISPEC
SET XPROC=$PIECE(^MAG(2005.872,IMOD,1,ISPEC,0),U,2)
+31 IF '$TEST
SET XPROC=$PIECE(^MAG(2005.872,IMOD,0),U,2)
+32 QUIT 0