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

MAGDIR82.m

Go to the documentation of this file.
  1. MAGDIR82 ;WOIFO/PMK - Read a DICOM image file ; 10/30/2008 09:20
  1. ;;3.0;IMAGING;**11,30,51,20,54**;03-July-2009;;Build 1424
  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. ; M2MB server
  1. ;
  1. ; This routine is invoked by the ^MAGDIR8 to update statistics & add
  1. ; an image to the background processor and auto-router queues.
  1. ;
  1. ; There are two entry points, one for the "ACQUIRED" RESULT item, and
  1. ; the other (POSTPROC) for the "PROCESSED" RESULT item.
  1. ;
  1. ACQUIRED ; update image acquisition statistics
  1. N INSTNAME,LOCATION,STATUS
  1. S STATUS=$P(ARGS,"|",1)
  1. S LOCATION=$P(ARGS,"|",2)
  1. S INSTNAME=$P(ARGS,"|",3)
  1. D COUNT("ACQUIRED")
  1. Q
  1. ;
  1. POSTPROC ; update image processing statistics and add to BP & AR queues
  1. N COUNTFLG,ERRCODE,EVAL,I,IMAGEPTR,INSTNAME,LOCATION,MACHID,MSG,STATUS
  1. S STATUS=$P(ARGS,"|",1)
  1. S LOCATION=$P(ARGS,"|",2)
  1. S INSTNAME=$P(ARGS,"|",3)
  1. S IMAGEPTR=$P(ARGS,"|",4)
  1. S COUNTFLG=$P(ARGS,"|",5) ; zero for multiframe images
  1. S EVAL=$P(ARGS,"|",6)
  1. S MACHID=$P(ARGS,"|",7)
  1. I COUNTFLG D
  1. . D COUNT("PROCESSED") ; update the count
  1. . Q:$T(SAVEUID^MAGDIR81)=""
  1. . D SAVEUID^MAGDIR81(MACHID,"") ; clear the last image UID
  1. . Q
  1. ;
  1. S ERRCODE=""
  1. ;
  1. I $$CONSOLID^MAGDFCNV D
  1. . D POSTPRO2 ; consolidation code
  1. . Q
  1. E D
  1. . D POSTPRO1 ; non-consolidation code
  1. . Q
  1. I ERRCODE="" D
  1. . D RESULT^MAGDIR8(OPCODE,"|"_$P(ARGS,"|",2,999))
  1. . Q
  1. E D
  1. . D ERROR^MAGDIR8(OPCODE,ERRCODE,.MSG,$T(+0))
  1. . Q
  1. Q
  1. ;
  1. POSTPRO1 ; non-consolidation code version of post processing
  1. Q:IMAGEPTR<0
  1. ; add the image to the jukebox queue
  1. D:'$$JUKEBOX^MAGBAPI(IMAGEPTR)
  1. . S I=$O(MSG(" "),-1)
  1. . S:I I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="JUKEBOX QUEUE CREATION ERROR:"
  1. . S I=I+1,MSG(I)="An image has not been entered into the jukebox queue."
  1. . S I=I+1,MSG(I)="Image pointer: "_IMAGEPTR
  1. . D ERROR^MAGDIRVE($T(+0),"DICOM IMAGE PROCESSING ERROR",.MSG)
  1. . S ERRCODE=-401
  1. . Q
  1. ;
  1. D:EVAL ; Add the image to the routing evaluator queue
  1. . D WARNROUT(0)
  1. . D:$$EVAL^MAGBAPI(IMAGEPTR)<0
  1. . . S I=$O(MSG(" "),-1)
  1. . . S:I I=I+1,MSG(I)=" "
  1. . . S I=I+1,MSG(I)="AUTOROUTER EVALUATION QUEUE CREATION ERROR:"
  1. . . S I=I+1,MSG(I)="An image could not be evaluated for autorouting purposes."
  1. . . S I=I+1,MSG(I)="Image pointer: "_IMAGEPTR
  1. . . S I=I+1,MSG(I)="Error code is """_Z_"""."
  1. . . D ERROR^MAGDIRVE($T(+0),"DICOM IMAGE PROCESSING ERROR",.MSG)
  1. . . S ERRCODE=ERRCODE_"-402"
  1. . . Q
  1. . Q
  1. Q
  1. ;
  1. POSTPRO2 ; consolidation code version of post processing
  1. N PLACE
  1. Q:IMAGEPTR<0
  1. S PLACE=$O(^MAG(2006.1,"B",LOCATION,""))
  1. ;
  1. ; add the image to the jukebox queue
  1. D:'$$JUKEBOX^MAGBAPI(IMAGEPTR,PLACE)
  1. . S I=$O(MSG(" "),-1)
  1. . S:I I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="JUKEBOX QUEUE CREATION ERROR:"
  1. . S I=I+1,MSG(I)="An image has not been entered into the jukebox queue."
  1. . S I=I+1,MSG(I)="Image pointer: "_IMAGEPTR_" Location: "_LOCATION
  1. . D ERROR^MAGDIRVE($T(+0),"DICOM IMAGE PROCESSING ERROR",.MSG)
  1. . S ERRCODE=-403
  1. . Q
  1. ;
  1. D:EVAL ; Add the image to the routing evaluator queue
  1. . D WARNROUT(PLACE)
  1. . D:$$EVAL^MAGBAPI(IMAGEPTR,PLACE)<0
  1. . . S I=$O(MSG(" "),-1)
  1. . . S:I I=I+1,MSG(I)=" "
  1. . . S I=I+1,MSG(I)="AUTOROUTER EVALUATION QUEUE CREATION ERROR:"
  1. . . S I=I+1,MSG(I)="An image could not be evaluated for autorouting purposes."
  1. . . S I=I+1,MSG(I)="Image pointer: "_IMAGEPTR_" Place: "_PLACE
  1. . . S I=I+1,MSG(I)="Error code is """_Z_"""."
  1. . . D ERROR^MAGDIRVE($T(+0),"DICOM IMAGE PROCESSING ERROR",.MSG)
  1. . . S ERRCODE=ERRCODE_"-404"
  1. . . Q
  1. . Q
  1. Q
  1. ;
  1. COUNT(STEP) ; update today's count
  1. N D2,NOW,PC,TODAY,X
  1. S NOW=$$NOW^XLFDT,TODAY=NOW\1
  1. L +^MAGDAUDT(2006.5762,TODAY):1E9 ; Background job MUST wait
  1. D:'$D(^MAGDAUDT(2006.5762,TODAY))
  1. . S X=$G(^MAGDAUDT(2006.5762,0))
  1. . S $P(X,"^",1,2)="DICOM INSTRUMENT STATISTICS^2006.5762"
  1. . S $P(X,"^",3)=TODAY
  1. . S $P(X,"^",4)=$P(X,"^",4)+1
  1. . S ^MAGDAUDT(2006.5762,0)=X
  1. . S ^MAGDAUDT(2006.5762,TODAY,0)=TODAY
  1. . S ^MAGDAUDT(2006.5762,"B",TODAY,TODAY)=""
  1. . Q
  1. S D2=$O(^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,"B",INSTNAME,""))
  1. D:'D2
  1. . S D2=$O(^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1," "),-1)+1
  1. . S X=$G(^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,0))
  1. . S $P(X,"^",2)="2006.576211"
  1. . S $P(X,"^",3)=D2
  1. . S $P(X,"^",4)=$P(X,"^",4)+1
  1. . S ^MAGDAUDT(2006.5762,TODAY,1,LOCATION,0)=LOCATION
  1. . S ^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,0)=X
  1. . S ^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,D2,0)=INSTNAME
  1. . S ^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,"B",INSTNAME,D2)=""
  1. . Q
  1. S X=$G(^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,D2,0))
  1. S PC=$S(STEP="ACQUIRED":2,STEP="PROCESSED":4,1:6)
  1. S $P(X,"^",PC)=$P(X,"^",PC)+1
  1. S $P(X,"^",PC+1)=NOW
  1. S ^MAGDAUDT(2006.5762,TODAY,1,LOCATION,1,D2,0)=X
  1. L -^MAGDAUDT(2006.5762,TODAY)
  1. Q
  1. ;
  1. WARNROUT(PLACE) N LAST,X2,X3
  1. D:'PLACE
  1. . S PLACE=$$PLACE^MAGDRPC2(LOCATION)
  1. . Q
  1. S LAST=$G(^MAG(2006.1,+PLACE,"LASTROUTE"))
  1. S (X2,X3)=LAST\1 D:X3
  1. . N DEST,E,I,PRI,T
  1. . Q:$$FMDIFF^XLFDT(DT,X2,1)<7
  1. . S X2=$P(LAST,"^",2) Q:X2'<DT ; Only send one message per day
  1. . S (E,T,I)=0 F S I=$O(^MAGQUEUE(2006.03,"C",PLACE,"EVAL",I)) Q:I="" S E=E+1
  1. . S PRI="" F S PRI=$O(^MAGQUEUE(2006.035,"STS",LOCATION,"WAITING",PRI)) Q:PRI="" D
  1. . . S DEST="" F S DEST=$O(^MAGQUEUE(2006.035,"STS",LOCATION,"WAITING",PRI,DEST)) Q:DEST="" D
  1. . . . S I="" F S I=$O(^MAGQUEUE(2006.035,"STS",LOCATION,"WAITING",PRI,DEST,I)) Q:I="" S T=T+1
  1. . . . Q
  1. . . Q
  1. . S I=$O(MSG(" "),-1)
  1. . S:I I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="More than a week has elapsed since "_(X3#100)_"-"_$P("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"," ",X3\100#100)_"-"_(X3\10000+1700)
  1. . S I=I+1,MSG(I)="when the last activity occurred that is related"
  1. . S I=I+1,MSG(I)="to the processing of Routed Image files."
  1. . S I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="The site parameter for ""This is a Routing Site"" is"
  1. . S I=I+1,MSG(I)="currently turned ON."
  1. . S I=I+1,MSG(I)="If this site is no longer actively routing image files"
  1. . S I=I+1,MSG(I)="this site parameter must be turned OFF."
  1. . S I=I+1,MSG(I)="This parameter needs to be turned OFF on each VistA"
  1. . S I=I+1,MSG(I)="DICOM Gateway that processes incoming images."
  1. . S I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="There are currently "_E_" entr"_$S(E=1:"y",1:"ies")
  1. . S I=I+1,MSG(I)="waiting to be processed in the evaluation queue."
  1. . S I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="There are currently "_T_" entr"_$S(T=1:"y",1:"ies")
  1. . S I=I+1,MSG(I)="waiting to be processed in the transmission queue."
  1. . S I=I+1,MSG(I)=" "
  1. . S I=I+1,MSG(I)="If this site is still a routing site, then both the"
  1. . S I=I+1,MSG(I)="Routing Rule Evaluator and the Routing Transmitter"
  1. . S I=I+1,MSG(I)="must be restarted."
  1. . D ERROR^MAGDIRVE($T(+0),"DICOM IMAGE PROCESSING ERROR",.MSG)
  1. . S ERRCODE=ERRCODE_"-405"
  1. . S $P(^MAG(2006.1,PLACE,"LASTROUTE"),"^",2)=DT
  1. . Q
  1. Q
  1. ;