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

MAGDIR8.m

Go to the documentation of this file.
  1. MAGDIR8 ;WOIFO/PMK - Read a DICOM image file ; 21 Apr 2011 2:47 PM
  1. ;;3.0;IMAGING;**11,51,54,138**;Mar 19, 2002;Build 5380;Sep 03, 2013
  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. ; M2MB server
  1. ;
  1. ; This routine is invoked by the M2M Broker RPC to process an image.
  1. ; It extracts each item from the REQUEST list and transfers control
  1. ; to the appropriate routine to process it. These routines, in turn,
  1. ; add items to the RESULT list for processing back on the gateway.
  1. ;
  1. ENTRY(RESULT,REQUEST) ; RPC = MAG DICOM IMAGE PROCESSING
  1. N ARGS ; ---- argument string of the REQUEST item
  1. N DATETIME ;- fileman date/time of the study
  1. N DCMPID ;--- DICOM patient id
  1. N DFN ;------ VistA's internal patient identifier
  1. N ERRCODE ;-- code for an error, if encountered
  1. N IREQUEST ;- pointer to item in REQUEST array
  1. N MSG ; ----- error message array
  1. N OPCODE ;--- operation code of the REQUEST item
  1. N RETURN ;--- intermediate return code
  1. ;
  1. ; pass the request list and determine what has to be done
  1. F IREQUEST=2:1:$G(REQUEST(1)) D
  1. . S OPCODE=$P(REQUEST(IREQUEST),"|")
  1. . S ARGS=$P(REQUEST(IREQUEST),"|",2,999)
  1. . I OPCODE="STORE1" D ENTRY^MAGDIR81 Q
  1. . I OPCODE="ACQUIRED" D ACQUIRED^MAGDIR82 Q
  1. . I OPCODE="PROCESSED" D POSTPROC^MAGDIR82 Q
  1. . I OPCODE="CORRECT" D ENTRY^MAGDIR83 Q
  1. . I OPCODE="PATIENT SAFETY" D ENTRY^MAGDIR84 Q
  1. . I OPCODE="ROLLBACK" D ENTRY^MAGDIR85 Q
  1. . I OPCODE="CRASH" D Q
  1. . . S I=1/0 ; generate an error on the server to test error trapping
  1. . . Q
  1. . Q
  1. Q
  1. ;
  1. ERROR(OPCODE,ERRCODE,MSG,ROUTINE) ; build the RESULT array for the error
  1. ; this must be called after ^MAGDIRVE is invoked to put the message
  1. ; into the RESULT array - otherwise the message will be lost
  1. N I,OK,X
  1. S X=ERRCODE_"|"_$G(MSG("TITLE"))_"|"_ROUTINE_"|"_$G(MSG("CRITICAL"))
  1. D RESULT^MAGDIR8(OPCODE,X)
  1. S OK=0,I="" F S I=$O(MSG(I)) Q:'I D
  1. . I MSG(I)?1"Problem detected by routine".E D
  1. . . ; add error code to the message
  1. . . S MSG(I)=MSG(I)_" Error Code: """_ERRCODE_""""
  1. . . Q
  1. . S OK=1 D RESULT^MAGDIR8("MSG","|"_MSG(I))
  1. . Q
  1. D:'OK RESULT^MAGDIR8("MSG","|Error Code: """_ERRCODE_""" (no further information is available)")
  1. S $P(RESULT(RESULT(1)),"|",2)="END"
  1. Q
  1. ;
  1. RESULT(OPCODE,ARGS) ; add an item to the RESULT list
  1. S RESULT(1)=$G(RESULT(1),1)+1 ; first element in array is counter
  1. S RESULT(RESULT(1))=OPCODE_"|"_ARGS
  1. Q