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

MAGGTAU.m

Go to the documentation of this file.
  1. MAGGTAU ;WOIFO/GEK/SG - RPC Calls to update the IMAGING WINDOWS WORKSTATION file ; 7/17/08 3:39pm
  1. ;;3.0;IMAGING;**7,16,8,59,93,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. ;
  1. ;***** UPDATES INFORMATIONS IN THE IMAGING WINDOWS WORKSTATION
  1. ; RPC: MAGG WRKS UPDATES
  1. ;
  1. ; .MAGRY Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; DATA Data that should be stored in the IMAGING WINDOWS
  1. ; WORKSTATION file (#2006.81):
  1. ; ^01: Workstation name
  1. ; ^02: Date/Time of Capture application (external)
  1. ; ^03: Date/Time of Display application (external)
  1. ; ^04: Location of the workstation
  1. ; ^05: Date/Time of the MAGSETUP (external)
  1. ; ^06: Version of the Display application
  1. ; ^07: Version of the Capture application
  1. ; ^08: Startup mode: 1 = Normal startup,
  1. ; 2 = Started by CPRS, 3 = Import API
  1. ; ^09: OS Version
  1. ; ^10: VistaRad version
  1. ; ---- Patch MAG*3*59 ----
  1. ; ^11: RPCBroker server
  1. ; ^12: RPCBroker port
  1. ; ---- Patch MAG*3*93 ----
  1. ; ^13: Clinical Utilities version
  1. ; ^14: TeleReader version
  1. ; ^15: Date/Time of the Clinical Utilities (external)
  1. ; ^16: Date/Time of the TeleReader (external)
  1. ; ^17: Date/Time of the VistaRad (external)
  1. ;
  1. ; Return Values
  1. ; =============
  1. ;
  1. ; Zero value of the first '^'-piece of the MAGRY indicates that
  1. ; an error occurred during the execution of the procedure. In this
  1. ; case, the MAGRY is formatted as follows:
  1. ;
  1. ; MAGRY Result descriptor
  1. ; ^01: 0
  1. ; ^02: Error message (optional)
  1. ;
  1. ; Otherwise, first '^'-piece of the MAGRY contains the session
  1. ; number (IEN in the IMAGING WINDOWS SESSIONS file (#2006.82)):
  1. ;
  1. ; MAGRY Result descriptor
  1. ; ^01: Session IEN (file #2006.82)
  1. ; ^02: Message
  1. ;
  1. ; Notes
  1. ; =====
  1. ;
  1. ; This remote procedure is called after user login (local and remote
  1. ; image view).
  1. ;
  1. UPD(MAGRY,DATA) ;RPC [MAGG WRKS UPDATES]
  1. N MAG0,MAGI,MAGIEN,MAGLOC,MAGMODE,MAGNAME,MAGOSVER,MAGPL
  1. N MAGSRV,MAGSTART,MAGVERVR,MAGVERX,X,Y,Z
  1. K MAGGFDA,MAGXERR,MAGXIEN
  1. ;
  1. S MAGNAME=$P(DATA,U,1)
  1. S MAGLOC=$P(DATA,U,4)
  1. S:$P(DATA,U,6) MAGJOB("DISPLAY")=""
  1. S:$P(DATA,U,7) MAGJOB("CAPTURE")=""
  1. S MAGMODE=$P(DATA,U,8)
  1. S MAGOSVER=$P(DATA,U,9)
  1. S MAGVERVR=$P(DATA,U,10)
  1. S:$P(DATA,U,11)]"" MAGJOB("RPCSERVER")=$P(DATA,U,11)
  1. S:$P(DATA,U,12)]"" MAGJOB("RPCPORT")=$P(DATA,U,12)
  1. ;
  1. S MAGIEN=$S($L(MAGNAME):$O(^MAG(2006.81,"B",MAGNAME,"")),1:0)
  1. I 'MAGIEN D NEWWRKS(MAGNAME,MAGLOC,.MAGIEN)
  1. I MAGIEN<1 S MAGRY="0^Workstation Not on file" Q
  1. ;
  1. S MAG0=^MAG(2006.81,MAGIEN,0) ; '0' node for use later.
  1. L +^MAG(2006.81,"LOCK",MAGIEN):0
  1. S MAGIEN=+MAGIEN_","
  1. S MAGGFDA(2006.81,MAGIEN,.01)=MAGNAME ; Computer name
  1. S MAGGFDA(2006.81,MAGIEN,3)="@" ; Delete logoff time for this job
  1. S MAGGFDA(2006.81,MAGIEN,6)=MAGLOC ; Location free text from .INI
  1. S MAGGFDA(2006.81,MAGIEN,8)=1 ; Active or not
  1. S MAGGFDA(2006.81,MAGIEN,10)="@" ; Delete session pointer
  1. S MAGGFDA(2006.81,MAGIEN,11)="@" ; Reset the session error count
  1. S MAGGFDA(2006.81,MAGIEN,13)=MAGOSVER ; Operating system version
  1. ;
  1. ;=== Process the client date/time values (MAG*3*93)
  1. F MAGI="2^5.5","3^5","5^7","15^5.9","16^5.3","17^5.7" D
  1. . ;--- Convert date/time into internal format
  1. . S %DT="T",X=$P(DATA,U,+MAGI) D ^%DT
  1. . S $P(DATA,U,+MAGI)=Y
  1. . ;--- Prepare the date/time for storage
  1. . S:Y>-1 MAGGFDA(2006.81,MAGIEN,$P(MAGI,U,2))=Y
  1. . Q
  1. ;
  1. ;=== Process the client version numbers (MAG*3*93)
  1. S MAGVERX=""
  1. F MAGI="6^9","7^9.5","10^9.7","13^9.9","14^9.3" D
  1. . S X=$P(DATA,U,+MAGI) Q:X=""
  1. . ;--- Prepare the version number for storage
  1. . S MAGGFDA(2006.81,MAGIEN,$P(MAGI,U,2))=X
  1. . ;--- Whatever application calls, we'll use that version (MAG*3*8)
  1. . S:MAGVERX="" MAGVERX=X
  1. . Q
  1. ;
  1. S X=$P(MAG0,U,12)
  1. S MAGGFDA(2006.81,MAGIEN,12)=X+1 ; Sess count for wrks.
  1. ; Keep PLACE that this wrks logged in.
  1. S MAGPL=$S($G(DUZ(2)):+$$PLACE^MAGBAPI(DUZ(2)),1:0) ; DBI
  1. S:MAGPL MAGGFDA(2006.81,MAGIEN,.04)=MAGPL ; DBI
  1. ;
  1. S MAGSTART=$E($$NOW^XLFDT,1,12)
  1. I $G(DUZ) D
  1. . S MAGGFDA(2006.81,MAGIEN,1)=DUZ
  1. . S MAGGFDA(2006.81,MAGIEN,2)=MAGSTART
  1. . Q
  1. ;
  1. D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
  1. I $D(DIERR) D RTRNERR(.MAGRY) Q
  1. ; The MAGJOB( array is used by Imaging routines that are
  1. ; called from the Delphi App.
  1. ;
  1. S MAGJOB("WRKSIEN")=+MAGIEN
  1. S MAGJOB("VERSION")=MAGVERX
  1. S MAGRY="1^"
  1. ;
  1. ; SESSION : Create new session entry
  1. D GETS^DIQ(200,DUZ_",","29","I","Z","") ; service/section
  1. S MAGSRV=$G(Z(200,DUZ_",",29,"I"))
  1. ;
  1. K MAGGFDA,MAGXERR,MAGXIEN
  1. S MAGGFDA(2006.82,"+1,",.01)=$P(^VA(200,DUZ,0),U,1) ; User
  1. S MAGGFDA(2006.82,"+1,",1)=DUZ ; USER
  1. S MAGGFDA(2006.82,"+1,",2)=MAGSTART ; Sess Start Time
  1. S MAGGFDA(2006.82,"+1,",4)=+MAGIEN ; Wrks
  1. S MAGGFDA(2006.82,"+1,",7)=+MAGSRV ; User's Service/Section
  1. S MAGGFDA(2006.82,"+1,",13)=MAGMODE ; 1=normal 2= started by CPRS
  1. ; DBI - save the logon PLACE in the Session file.
  1. I MAGPL S MAGGFDA(2006.82,"+1,",.04)=MAGPL ; User's Institution (Imaging site param entry)
  1. ;
  1. ; 3.0.8 new fields 9 Client Ver, 9.2 Host Version, 9.4 OS Version
  1. S MAGGFDA(2006.82,"+1,",9)=MAGVERX ;
  1. S MAGGFDA(2006.82,"+1,",9.2)=$$VERSION^XPDUTL("IMAGING") ;
  1. S MAGGFDA(2006.82,"+1,",9.4)=MAGOSVER ;
  1. ;
  1. D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
  1. I $D(DIERR) D RTRNERR(.MAGRY) Q
  1. S MAGRY="1^"
  1. I '+MAGXIEN(1) S MAGRY="0^" Q
  1. S MAGJOB("SESSION")=+MAGXIEN(1)
  1. S MAGRY=MAGJOB("SESSION")_"^Session # "_MAGJOB("SESSION")_" Started."
  1. S MAGGFDA(2006.81,+MAGIEN_",",10)=+MAGXIEN(1)
  1. D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
  1. D ACTION("LOGON^")
  1. Q
  1. LOGACT(MAGRY,ACTION) ;RPC [MAG3 LOGACTION]
  1. ; Call to log actions for Imaging Session from
  1. ; Delphi interface
  1. D ACTION(ACTION)
  1. S MAGRY="1^Action Logged"
  1. Q
  1. ACTION(TXT,LOGTM,MAGSESS) ;Call to log actions for Imaging Workstation Session from other M routines
  1. ; ACTIONS LOGGED
  1. ; LOGON - Session StartTime LOGOFF - Session End Time
  1. ; IMG - Image accessed PAT - Patient Accessed
  1. ; CAP - Image Captured
  1. ; DEL - Image Deleted MOD - Image entry modified
  1. ; NOIMAGE- Image Entry moved to Audit file. No Image existed. ; p140
  1. ; IMPORT - Import API has been called
  1. ; Data - a node of data passed to Import API
  1. ; Result - a node of the Result Array from Import API Processing.
  1. ; Image - one of the Images (full path of import directory) that was imported.
  1. ; PPACT - A Post processing Action has been processed.
  1. ; VR-VW - VistaRad Exam displayed
  1. ; VR-INT - VistaRad Exam interpreted
  1. ; API - parameters sent to CP API, and the API Call i.e. ITIU-MDAPI
  1. ; DFTINDX- If the index fields have no values, call to Patch 17 code to
  1. ; generate the values for the fields.
  1. ; MOD - This was intended to log Modifications to Image Entries, it is
  1. ; (for now) only called when a group entry has an image added to its multiple.
  1. ;
  1. ; TXT is "^" delimited string
  1. ; $P(1) is code ( see above ) $P(2) is DFN
  1. ; $P(3) is Image IEN $P(4) reserved for procedure
  1. ; $P(5) reserved for time-stamp $P(6) is Vrad Image Count
  1. ; $P(7) is Vrad Patient Count
  1. ; $P(8) is Vrad User Type (1/0 = Rad/Non-Rad)
  1. ; $P(9) is Vrad REMOTE Read flag (1/0; 1=REMOTE)
  1. ; $P(TXT,"$$",2) is Tracking ID from an Imported Image. From this we compute Session #, to log actions.
  1. ; LOGTM - [1|0] Flag to indicate whether or not to log the time of the Action. Default = 0
  1. ; MAGSESS - Session IEN where the action should be logged. Default to MAGJOB("SESSION")
  1. ;
  1. N NODE,SESSIEN,MAGGFDA,MAGXERR,MAGXIEN,MAGPROC,LOGX,TRKID
  1. S LOGTM=$G(LOGTM)
  1. I TXT["$$" S TRKID=$P(TXT,"$$",2),TXT=$P(TXT,"$$",1)
  1. S SESSIEN=$S($G(MAGSESS):MAGSESS,$D(MAGJOB("SESSION")):MAGJOB("SESSION"),$G(TRKID)'="":$O(^MAG(2006.82,"E",TRKID,""),-1),1:0)
  1. I 'SESSIEN Q
  1. S NODE="+1,"_SESSIEN_","
  1. I $P(TXT,U,3) S MAGPROC=$P($G(^MAG(2005,$P(TXT,U,3),0)),U,8)
  1. ;
  1. I $P(TXT,U)="PAT" D
  1. . S Z=+$G(^MAG(2006.82,SESSIEN,1))+1
  1. . S MAGGFDA(2006.82,SESSIEN_",",10)=Z
  1. I $P(TXT,U)="IMG" D
  1. . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,2)+1
  1. . S MAGGFDA(2006.82,SESSIEN_",",11)=Z
  1. . D ENTRY^MAGLOG("IMGVW",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
  1. . D ACCESS^MAGLOG($P(TXT,"^",3))
  1. I $E(TXT,1,3)="CAP" D
  1. . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,3)+1
  1. . S MAGGFDA(2006.82,SESSIEN_",",12)=Z
  1. . D ENTRY^MAGLOG("CAP",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
  1. I $P(TXT,U,2) D
  1. . S MAGGFDA(2006.82,SESSIEN_",",5)=$P(TXT,U,2)
  1. I LOGTM D
  1. . S X=$$NOW^XLFDT
  1. . S $P(TXT,U,4)=$G(MAGPROC),$P(TXT,U,5)=$E(X,1,12)
  1. S MAGGFDA(2006.821,NODE,.01)=$P(TXT,"|",1)
  1. I $L(TXT,"|")>1 S MAGGFDA(2006.821,NODE,13)=$P(TXT,"|",2,99)
  1. D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
  1. Q
  1. NEWWRKS(MAGNAME,MAGLOC,MAGIEN) ;
  1. I $G(MAGNAME)="" Q
  1. N Y,MAGNFDA,MAGNIEN
  1. S MAGNFDA(2006.81,"+1,",.01)=MAGNAME
  1. S MAGNFDA(2006.81,"+1,",6)=$G(MAGLOC)
  1. D UPDATE^DIE("","MAGNFDA","MAGNIEN")
  1. S MAGIEN=MAGNIEN(1)
  1. Q
  1. LOGOFF(MAGRY) ;RPC [MAGG LOGOFF] Call when session is over.
  1. ; This updates session file with logoff time
  1. ; and marks the session closed.
  1. ;
  1. S MAGRY=1
  1. N MAGGFDA,MAGXERR,MAGXIEN,MAGIEN,MAGSESS,MAGEND,MAGCON
  1. ; The Imaging Workstation file keeps time of login
  1. ; We'll enter the logoff time ($$now^xlfdt) here.
  1. S X=$$NOW^XLFDT
  1. S MAGEND=$E(X,1,12)
  1. Q:'+$G(MAGJOB("WRKSIEN"))
  1. L -^MAG(2006.81,"LOCK",MAGJOB("WRKSIEN"))
  1. S MAGIEN=+MAGJOB("WRKSIEN")_","
  1. S MAGGFDA(2006.81,MAGIEN,3)=MAGEND ; logoff dttm
  1. S MAGGFDA(2006.81,MAGIEN,8)=0 ; Set job number to 0
  1. D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
  1. ;MAGJOB("WRKSIEN")
  1. Q:(+$G(MAGJOB("SESSION"))=0)
  1. S MAGSESS=+MAGJOB("SESSION")_","
  1. K MAGGFDA,MAGXERR,MAGXIEN
  1. S MAGGFDA(2006.82,MAGSESS,3)=MAGEND
  1. ; calculate the length of the session
  1. S MAGCON=""
  1. S MAGGFDA(2006.82,MAGSESS,14)=MAGCON
  1. D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
  1. D ACTION("LOGOFF^")
  1. ;
  1. Q
  1. RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
  1. S ETXT="0^ERROR "_MAGXERR("DIERR",1,"TEXT",1)
  1. Q