| 1 | MAGXMA ;WOIFO/MLH - Index mapping API routine ; 14 Jan 2004  2:19 PM
 | 
|---|
| 2 |  ;;3.0;IMAGING;**11**;14-April-2004
 | 
|---|
| 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 |  ;; |                                                               |
 | 
|---|
| 11 |  ;; | The Food and Drug Administration classifies this software as  |
 | 
|---|
| 12 |  ;; | a medical device.  As such, it may not be changed in any way. |
 | 
|---|
| 13 |  ;; | Modifications to this software may result in an adulterated   |
 | 
|---|
| 14 |  ;; | medical device under 21CFR820, the use of which is considered |
 | 
|---|
| 15 |  ;; | to be a violation of US Federal Statutes.                     |
 | 
|---|
| 16 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 17 |  ;;
 | 
|---|
| 18 |  Q
 | 
|---|
| 19 |  ;
 | 
|---|
| 20 | FIELD43(XMOD,XSPEC,XPROC) ; API - Determine proc/event based on modality, specialty
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 |  ; Input parameters:
 | 
|---|
| 23 |  ;   XMOD      Abbreviation for the modality in use (required)
 | 
|---|
| 24 |  ;   XSPEC     Specialty index in the IMAGE INDEX FOR SPEC/SUBSPEC File
 | 
|---|
| 25 |  ;             (#2005.84).  This is what will be populated into the
 | 
|---|
| 26 |  ;             SPEC/SUBSPEC Field (#44) of the IMAGE File (#2005).
 | 
|---|
| 27 |  ;
 | 
|---|
| 28 |  ; Output parameter:
 | 
|---|
| 29 |  ;   .XPROC    Associated procedure/event index in the IMAGE INDEX FOR
 | 
|---|
| 30 |  ;             PROC/EVENT File (#2005.85).  This can be populated into
 | 
|---|
| 31 |  ;             the PROC/EVENT Field (#43) of the IMAGE File (#2005).
 | 
|---|
| 32 |  ;             If no procedure/event is associated, null is returned unless
 | 
|---|
| 33 |  ;             the function returns an exception code < 0.
 | 
|---|
| 34 |  ;
 | 
|---|
| 35 |  ; Function return:
 | 
|---|
| 36 |  ;    0        Executed normally, found a match
 | 
|---|
| 37 |  ;    1        Modality XMOD non-null but is not indexed
 | 
|---|
| 38 |  ;   -1        Missing XMOD
 | 
|---|
| 39 |  ;   -2        XSPEC non-null, not found in File #2005.84
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  I $G(XMOD)="" Q -1
 | 
|---|
| 42 |  I $G(XSPEC),'$D(^MAG(2005.84,XSPEC)) Q -2
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  N IMOD ; ---- modality pointer in 2005.872
 | 
|---|
| 45 |  N ISPEC ; --- specialty multiple pointer in 2005.872
 | 
|---|
| 46 |  S XPROC=""
 | 
|---|
| 47 |  ;
 | 
|---|
| 48 |  S IMOD=$O(^MAG(2005.872,"B",XMOD,""))
 | 
|---|
| 49 |  I 'IMOD Q 1
 | 
|---|
| 50 |  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)
 | 
|---|
| 51 |  E  S XPROC=$P(^MAG(2005.872,IMOD,0),U,2)
 | 
|---|
| 52 |  Q 0
 | 
|---|