MAGGSIV ;WOIFO/GEK/NST - Imaging RPC Broker calls. Validate Image data array ; [ 12/27/2000 10:49 ]
;;3.0;IMAGING;**7,8,20,59,108,121**;Mar 19, 2002;Build 2340;Oct 20, 2011
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | 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
VAL(MAGRY,MAGARRAY,ALL) ;RPC [MAG4 VALIDATE DATA]
;Call to Validate the Image Data Array before a new image/modified entry is attempted.
; Called from MAGGSIA, MAGGSIUI and Capture GUI.
; Parameters :
; MAGARRAY - array of 'Field numbers'|'Action codes' and their Values
; MAGARRAY(1)="5^38" Field#: 5 Value: 38
; an example of an action code is the Code for File Extension
; MAGARRAY(2)="EXT^JPG" Action: EXT Value: JPG
; ALL - "1" = Validate ALL fields, returning an array of error messages.
; "0" = Stop validating if an error occurs, return
; the error message in (0) node.
; Return Variable
; MAGRY() - Array
; Successful MAGRY(0) = 1^Image Data is Valid.
; UNsuccessful MAGRY(0) = 0^Error desc
; IF ALL then MAGRY(1..N) =0^Error desc of all errors
N MAGGFLD,MAGGDAT,MAGFSPEC,CHKOK,MAGETXT,MAGRET,MAGRES
N Y,AITEM,CT,MAGERR,DFNFLAG,DAT1,X,MAX
N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
S ALL=$G(ALL)
S MAGRY(0)="0^Validating the Data Array..."
S MAGERR="",DFNFLAG=0,CT=0
; Do we have any data ?
I ($D(MAGARRAY)<10) S MAGRY(0)="0^No input data, Operation CANCELED" Q
; Flag if from Maximus
S MAX=0
S X="" F S X=$O(MAGARRAY(X)) Q:X="" I $P(MAGARRAY(X),U,1)="TRKID"!($P(MAGARRAY(X),U,1)="108") I $P($P(MAGARRAY(X),U,2),";",1)="MAX" S MAX=1
; Loop through Input Array
S AITEM="" F S AITEM=$O(MAGARRAY(AITEM)) Q:AITEM="" D I $L(MAGERR) Q:'ALL S CT=CT+1,MAGRY(CT)=MAGERR,MAGERR=""
. S MAGERR=""
. S MAGGFLD=$P(MAGARRAY(AITEM),U,1),MAGGDAT=$P(MAGARRAY(AITEM),U,2,99)
. I MAGGFLD="" S MAGERR="0^A Field Number/Action Code is required: "_" Item: "_MAGARRAY(AITEM) Q
. I MAGGDAT="" S MAGERR="0^A Value is required."_" Item: "_MAGARRAY(AITEM) Q
. I MAGGFLD=5 S DFNFLAG=1
. ; This inadvertently disallowed Tracking ID's on Group Images.
. ;I MAGGFLD=108 I $D(^MAG(2005,"ATRKID",MAGGDAT)) S MAGERR="0^Tracking ID Must be Unique !" Q
. I MAGGFLD=108 I ($L(MAGGDAT,";")<2) S MAGRY(0)="0^Tracking ID Must have "";"" Delimiter" Q
. ; Check for possible action codes that could be in the array.
. I $$ACTCODE(MAGGFLD) D Q
. . S DAT1=MAGGDAT
. . S Y=$$VALCODE(MAGGFLD,.MAGGDAT) S:'Y MAGERR=Y_" Item: "_MAGARRAY(AITEM)
. . I DAT1'=MAGGDAT S MAGARRAY(AITEM)=MAGGFLD_"^"_MAGGDAT
. ; If we are adding Multiple Images to a Group, they must be Validated.
. ; we could have multiple "2005.04^IENs" in this array. Which means we are
. ; adding existing Images to a New/Existing Group.
. I MAGGFLD=2005.04 D Q ; 2005.04 isn't the field number, #4 is the field number
. . I $G(MAGGDAT,0)=0 Q ;Creating a new Group, with no group entries is the usual way
. . ; to do it. Then make successive calls to ADD, Adding each Image to the
. . ; Object Group multiple of the Group Parent (fld#14) as it is created.
. . I '$D(^MAG(2005,MAGGDAT,0)) S MAGERR="0^Group Object "_MAGGDAT_" doesn't exist"_" Item: "_MAGARRAY(AITEM)
. . ; We can't allow adding an image if it already has a group parent.
. . I $P(^MAG(2005,MAGGDAT,0),U,10) S MAGERR="0^The Image to be added to the Group, already has a Group Parent"_" Item: "_MAGARRAY(AITEM)
. ; if we are getting a WP line of text for Long Desc Field. Can't validate it.
. I MAGGFLD=11 Q ; this is a line of the WP Long Desc field.
. I (MAGGFLD=17),(MAGGDAT=0) Q ; Patch 108 BP work around don't check - a new TIU stub will be created
. I MAGGFLD="ACTION" Q ; Patch 121 new ACTION Field, we skip.
. ; NEW CALL TO VALIDATE FILE,FIELD,DATA
. S DAT1=MAGGDAT
. I '$$VALID^MAGGSIV1(2005,MAGGFLD,.MAGGDAT,.MAGRES) S MAGERR="0^"_MAGRES Q
. I DAT1'=MAGGDAT S MAGARRAY(AITEM)=MAGGFLD_"^"_MAGGDAT
. Q
;
; if there was an Error in data we'll quit now.
; If ALL is true, then MAGRY(1...N) will exist if there were errors.
I $O(MAGRY(0)) S MAGRY(0)="0^Errors were found in data." Q
; If ALL is false, then MAGERR will exist if there was an error.
I $L(MAGERR) S MAGRY(0)=MAGERR Q
;
; If all data is valid we get here.
; Last Test, see if a Patient was in array,
; (Patient is the only Required field check done in this routine).
I 'DFNFLAG S MAGRY(0)="0^A Patient DFN is required. " Q
S MAGRY(0)="1^Data is Valid."
Q
ACTCODE(CODE) ;Function that returns True (1) if this code is a valid Import API Action Code
; Patch 8. We're adding 107 as an action code, so it will pass validation even if the entry
; in the Acquisition Device File doesn't exist;
; it will be validated in PRE^MAGGSIA1 and a new Acquisition Device entry made if needed.
I $E(CODE,1,8)="PXTIUTXT" Q 1 ; P108
I ",107,PXSGNTYP,PXTIUTCNT,PXNEW,PXTIUTTL,ACQD,IEN,EXT,ABS,JB,WRITE,BIG,"[(","_CODE_",") Q 1
I ",DICOMSN,DICOMIN,ACQS,ACQL,STATUSCB,CALLMTH,USERNAME,PASSWORD,DELFLAG,TRNSTYP,"[(","_CODE_",") Q 1
I ",ACTION,"[(","_CODE_",") Q 1
Q 0
VALCODE(CODE,VALUE) ; We validate the values for the possible action codes
N MAGY
I VALUE="" Q "0^NO VALUE in Action Code string: """_X_""
; Patch 8, added 107
I ",ACQL,CALLMTH,USERNAME,PASSWORD,"[(","_CODE_",") Q 1 ; NO VALIDATION FOR THESE CODES
I ($E(CODE,1,8)="PXTIUTXT")!(CODE="PXTIUTCNT") Q 1 ; NO VALIDATION FOR TIU TEXT
D @CODE
Q MAGY
; Each Tag is a valid Action code
IEN I $D(^MAG(2005,VALUE)) S MAGY=1
E S MAGY="0^INVALID IMAGE IEN."
Q
ACTION ; Patch 121 ACTION = "RESCIND"
I VALUE="RESCIND" S MAGY=1 Q
S MAGY="0^Invalid ACTION: "_VALUE
Q
PXNEW ; New Package (TIU note)
I (PXNEW'=0),(PXNEW'=1),(PXNEW'="") D
. S MAGY="0^Invalid New Package Value."
. S CT=CT+1,MAGRY(CT)="Invalid PXNEW value - 0, 1, or blank only!"
E S MAGY=1
Q
PXSGNTYP ; Signature type
I (PXSGNTYP'=0),(PXSGNTYP'=1),(PXSGNTYP'="") D
. S MAGY="0^Invalid Signature type Value."
. S CT=CT+1,MAGRY(CT)="Invalid PXSGNTYP value - 0, 1, or blank only!"
E S MAGY=1
Q
PXTIUTTL ; Check for valid TIU title
N VALIEN
I $$GETTIUDA^MAGGSIV(.MAGY,VALUE,.VALIEN) S VALUE=VALIEN
Q
EXT ; code will go here to validate the extension type. i.e. we won't let types .exe .bat .com .zip ... etc.
; Maybe a modification to Object Type file, to have allowable extensions in the file, and a
; cross reference on a new field EXTENSION. The capture workstation wouldn't have to ask the
; user for the file type of each file, and we wouldn't get WORD .DOC files that the user called Color Images
ABS ; Meaning: Have the BP create the abstract
JB ; Meaning: Have the BP copy the image to the JukeBox
BIG ; Meaning: There is a big file also, set the Image File field ? to indicate there is a BIG File.
S MAGY=1
Q
WRITE ; Meaning: This is the Internal Entry (or "PACS") of the WRITE Directory. Images will be written
; here instead of the default WRITE Directory.
S MAGY=$$DRIVE^MAGGTU1(VALUE)
Q
DICOMSN ;Meaning: DICOM Series Number. This will be entered in the Group Object multiple, field #1
;We were validating this as an integer, but it can be anything, no way to validate.
S MAGY=1
Q
DICOMIN ;Meaning: DICOM Image Number. This will be entered in the Group Object multiple, field #2
; We were validating this as an integer, but it can be anything, no way to validate.
S MAGY=1
Q
DELFLAG ;Meaning: This flag tells the Delphi Import Component to Delete the Image files after successful processing
I ",TRUE,FALSE,0,1,"[(","_$$UPPER(VALUE)_",") S MAGY=1
E S MAGY="0^INVALID Value "
I VALUE="1" S VALUE="TRUE"
I VALUE="0" S VALUE="FALSE"
Q
TRNSTYP ;Meaning: This flag is for future use, for now it is ignored, defaults to "NEW"
S MAGY=1
Q
STATUSCB ; Meaning: This is the TAG^RTN that Imaging calls to report the
; status of the Import.
S MAGY="0^Error validating TAG^RTN: "_VALUE
I '$L($T(@VALUE)) S MAGY="0^Invalid Status CallBack "_VALUE
E S MAGY=1
Q
ACQS ; We need to make sure the ACQS (Acquisition Site) is a Valid entry in Imaging Site Params.
S VALUE=$P(VALUE,";") ; Stop error, when old OCX sends data.
; Next Block is for VIC (Maximus) that sends Station Number.
N ERR S ERR=0
I MAX D Q:ERR
. S X=$O(^DIC(4,"D",VALUE,""))
. I X="" S MAGY="0^Invalid STATION NUMBER: (ACQS): "_VALUE,ERR=1 Q
. S VALUE=X
. Q
I '$$CONSOLID^MAGBAPI S MAGY=1 Q
;Patch 20 will have this.
I '$D(^MAG(2006.1,"B",VALUE)) S MAGY="0^Acquisition Site ("_VALUE_") is Not in Site Param File." Q
S MAGY=1
Q
107 ; 107 and ACQD are the same. Calling 107 falls into validation for ACQD.
ACQD ; 107 and ACQD are ACQUISITION DEVICE FILE (2006.04) pointers or Values.
; If it is an integer, We assume the value is an IEN and validate it here.
I ((+VALUE)=VALUE),'$D(^MAG(2006.04,VALUE)) S MAGY="0^Invalid IEN ("_VALUE_") for ACQUISITION DEVICE File." Q
; if it is not an integer, it is either a new/existing entry for 2006.04 Result is Success,
; and it will be validated in PRE^MAGGSIA1 and added to File 2006.04 if needed.
S MAGY=1
Q
UPPER(X) ;
Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
;
ERR ; ERROR TRAP FOR Import API
N ERR S ERR=$$EC^%ZOSV
S MAGRY(0)="0^ETRAP: "_ERR
D @^%ZOSF("ERRTN")
Q
;
;***** Verify and return TIU Title IEN
;
; Input Parameters
; ================
; TITLE - an Integer (the IEN of file 8925.1) or Text value of the entry in 8925.1
;
; Return Values
; =============
; Returns 0 if TITLE is valid
; Returns 1 if TITLE is not valid
;
; if TITLE is not valid then MAGY = "0^error message"
; if TITLE is valid then MAGY = 1 and TIEN = TIU Title IEN
;
GETTIUDA(MAGY,TITLE,TIEN) ;
I TITLE="" S MAGY="0^Invalid data: Note TITLE is blank!" Q 0
; Is TITLE integer (IEN)
I TITLE?1.N D Q +MAGY
. I $D(^TIU(8925.1,"AT","DOC",TITLE)) S MAGY=1 S TIEN=TITLE Q
. S MAGY="0^Invalid data: Note TITLE ("_TITLE_") is invalid"
. Q
N DONE
S (DONE,TIEN)=""
S TITLE=$$UP^XLFSTR(TITLE) ; IA #10104
F Q:DONE S TIEN=$O(^TIU(8925.1,"B",TITLE,TIEN)) Q:TIEN="" D
. I $D(^TIU(8925.1,"AT","DOC",TIEN)) S DONE=1
. Q
I DONE S MAGY=1 ; TIEN is already set
E S MAGY="0^Invalid data: TITLE IEN ("_TITLE_") is invalid"
Q +MAGY
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGSIV 11377 printed Nov 22, 2024@17:12:58 Page 2
MAGGSIV ;WOIFO/GEK/NST - Imaging RPC Broker calls. Validate Image data array ; [ 12/27/2000 10:49 ]
+1 ;;3.0;IMAGING;**7,8,20,59,108,121**;Mar 19, 2002;Build 2340;Oct 20, 2011
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+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 ;; | 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
VAL(MAGRY,MAGARRAY,ALL) ;RPC [MAG4 VALIDATE DATA]
+1 ;Call to Validate the Image Data Array before a new image/modified entry is attempted.
+2 ; Called from MAGGSIA, MAGGSIUI and Capture GUI.
+3 ; Parameters :
+4 ; MAGARRAY - array of 'Field numbers'|'Action codes' and their Values
+5 ; MAGARRAY(1)="5^38" Field#: 5 Value: 38
+6 ; an example of an action code is the Code for File Extension
+7 ; MAGARRAY(2)="EXT^JPG" Action: EXT Value: JPG
+8 ; ALL - "1" = Validate ALL fields, returning an array of error messages.
+9 ; "0" = Stop validating if an error occurs, return
+10 ; the error message in (0) node.
+11 ; Return Variable
+12 ; MAGRY() - Array
+13 ; Successful MAGRY(0) = 1^Image Data is Valid.
+14 ; UNsuccessful MAGRY(0) = 0^Error desc
+15 ; IF ALL then MAGRY(1..N) =0^Error desc of all errors
+16 NEW MAGGFLD,MAGGDAT,MAGFSPEC,CHKOK,MAGETXT,MAGRET,MAGRES
+17 NEW Y,AITEM,CT,MAGERR,DFNFLAG,DAT1,X,MAX
+18 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^"_$TEXT(+0)
+19 SET ALL=$GET(ALL)
+20 SET MAGRY(0)="0^Validating the Data Array..."
+21 SET MAGERR=""
SET DFNFLAG=0
SET CT=0
+22 ; Do we have any data ?
+23 IF ($DATA(MAGARRAY)<10)
SET MAGRY(0)="0^No input data, Operation CANCELED"
QUIT
+24 ; Flag if from Maximus
+25 SET MAX=0
+26 SET X=""
FOR
SET X=$ORDER(MAGARRAY(X))
if X=""
QUIT
IF $PIECE(MAGARRAY(X),U,1)="TRKID"!($PIECE(MAGARRAY(X),U,1)="108")
IF $PIECE($PIECE(MAGARRAY(X),U,2),";",1)="MAX"
SET MAX=1
+27 ; Loop through Input Array
+28 SET AITEM=""
FOR
SET AITEM=$ORDER(MAGARRAY(AITEM))
if AITEM=""
QUIT
Begin DoDot:1
+29 SET MAGERR=""
+30 SET MAGGFLD=$PIECE(MAGARRAY(AITEM),U,1)
SET MAGGDAT=$PIECE(MAGARRAY(AITEM),U,2,99)
+31 IF MAGGFLD=""
SET MAGERR="0^A Field Number/Action Code is required: "_" Item: "_MAGARRAY(AITEM)
QUIT
+32 IF MAGGDAT=""
SET MAGERR="0^A Value is required."_" Item: "_MAGARRAY(AITEM)
QUIT
+33 IF MAGGFLD=5
SET DFNFLAG=1
+34 ; This inadvertently disallowed Tracking ID's on Group Images.
+35 ;I MAGGFLD=108 I $D(^MAG(2005,"ATRKID",MAGGDAT)) S MAGERR="0^Tracking ID Must be Unique !" Q
+36 IF MAGGFLD=108
IF ($LENGTH(MAGGDAT,";")<2)
SET MAGRY(0)="0^Tracking ID Must have "";"" Delimiter"
QUIT
+37 ; Check for possible action codes that could be in the array.
+38 IF $$ACTCODE(MAGGFLD)
Begin DoDot:2
+39 SET DAT1=MAGGDAT
+40 SET Y=$$VALCODE(MAGGFLD,.MAGGDAT)
if 'Y
SET MAGERR=Y_" Item: "_MAGARRAY(AITEM)
+41 IF DAT1'=MAGGDAT
SET MAGARRAY(AITEM)=MAGGFLD_"^"_MAGGDAT
End DoDot:2
QUIT
+42 ; If we are adding Multiple Images to a Group, they must be Validated.
+43 ; we could have multiple "2005.04^IENs" in this array. Which means we are
+44 ; adding existing Images to a New/Existing Group.
+45 ; 2005.04 isn't the field number, #4 is the field number
IF MAGGFLD=2005.04
Begin DoDot:2
+46 ;Creating a new Group, with no group entries is the usual way
IF $GET(MAGGDAT,0)=0
QUIT
+47 ; to do it. Then make successive calls to ADD, Adding each Image to the
+48 ; Object Group multiple of the Group Parent (fld#14) as it is created.
+49 IF '$DATA(^MAG(2005,MAGGDAT,0))
SET MAGERR="0^Group Object "_MAGGDAT_" doesn't exist"_" Item: "_MAGARRAY(AITEM)
+50 ; We can't allow adding an image if it already has a group parent.
+51 IF $PIECE(^MAG(2005,MAGGDAT,0),U,10)
SET MAGERR="0^The Image to be added to the Group, already has a Group Parent"_" Item: "_MAGARRAY(AITEM)
End DoDot:2
QUIT
+52 ; if we are getting a WP line of text for Long Desc Field. Can't validate it.
+53 ; this is a line of the WP Long Desc field.
IF MAGGFLD=11
QUIT
+54 ; Patch 108 BP work around don't check - a new TIU stub will be created
IF (MAGGFLD=17)
IF (MAGGDAT=0)
QUIT
+55 ; Patch 121 new ACTION Field, we skip.
IF MAGGFLD="ACTION"
QUIT
+56 ; NEW CALL TO VALIDATE FILE,FIELD,DATA
+57 SET DAT1=MAGGDAT
+58 IF '$$VALID^MAGGSIV1(2005,MAGGFLD,.MAGGDAT,.MAGRES)
SET MAGERR="0^"_MAGRES
QUIT
+59 IF DAT1'=MAGGDAT
SET MAGARRAY(AITEM)=MAGGFLD_"^"_MAGGDAT
+60 QUIT
End DoDot:1
IF $LENGTH(MAGERR)
if 'ALL
QUIT
SET CT=CT+1
SET MAGRY(CT)=MAGERR
SET MAGERR=""
+61 ;
+62 ; if there was an Error in data we'll quit now.
+63 ; If ALL is true, then MAGRY(1...N) will exist if there were errors.
+64 IF $ORDER(MAGRY(0))
SET MAGRY(0)="0^Errors were found in data."
QUIT
+65 ; If ALL is false, then MAGERR will exist if there was an error.
+66 IF $LENGTH(MAGERR)
SET MAGRY(0)=MAGERR
QUIT
+67 ;
+68 ; If all data is valid we get here.
+69 ; Last Test, see if a Patient was in array,
+70 ; (Patient is the only Required field check done in this routine).
+71 IF 'DFNFLAG
SET MAGRY(0)="0^A Patient DFN is required. "
QUIT
+72 SET MAGRY(0)="1^Data is Valid."
+73 QUIT
ACTCODE(CODE) ;Function that returns True (1) if this code is a valid Import API Action Code
+1 ; Patch 8. We're adding 107 as an action code, so it will pass validation even if the entry
+2 ; in the Acquisition Device File doesn't exist;
+3 ; it will be validated in PRE^MAGGSIA1 and a new Acquisition Device entry made if needed.
+4 ; P108
IF $EXTRACT(CODE,1,8)="PXTIUTXT"
QUIT 1
+5 IF ",107,PXSGNTYP,PXTIUTCNT,PXNEW,PXTIUTTL,ACQD,IEN,EXT,ABS,JB,WRITE,BIG,"[(","_CODE_",")
QUIT 1
+6 IF ",DICOMSN,DICOMIN,ACQS,ACQL,STATUSCB,CALLMTH,USERNAME,PASSWORD,DELFLAG,TRNSTYP,"[(","_CODE_",")
QUIT 1
+7 IF ",ACTION,"[(","_CODE_",")
QUIT 1
+8 QUIT 0
VALCODE(CODE,VALUE) ; We validate the values for the possible action codes
+1 NEW MAGY
+2 IF VALUE=""
QUIT "0^NO VALUE in Action Code string: """_X_""
+3 ; Patch 8, added 107
+4 ; NO VALIDATION FOR THESE CODES
IF ",ACQL,CALLMTH,USERNAME,PASSWORD,"[(","_CODE_",")
QUIT 1
+5 ; NO VALIDATION FOR TIU TEXT
IF ($EXTRACT(CODE,1,8)="PXTIUTXT")!(CODE="PXTIUTCNT")
QUIT 1
+6 DO @CODE
+7 QUIT MAGY
+8 ; Each Tag is a valid Action code
IEN IF $DATA(^MAG(2005,VALUE))
SET MAGY=1
+1 IF '$TEST
SET MAGY="0^INVALID IMAGE IEN."
+2 QUIT
ACTION ; Patch 121 ACTION = "RESCIND"
+1 IF VALUE="RESCIND"
SET MAGY=1
QUIT
+2 SET MAGY="0^Invalid ACTION: "_VALUE
+3 QUIT
PXNEW ; New Package (TIU note)
+1 IF (PXNEW'=0)
IF (PXNEW'=1)
IF (PXNEW'="")
Begin DoDot:1
+2 SET MAGY="0^Invalid New Package Value."
+3 SET CT=CT+1
SET MAGRY(CT)="Invalid PXNEW value - 0, 1, or blank only!"
End DoDot:1
+4 IF '$TEST
SET MAGY=1
+5 QUIT
PXSGNTYP ; Signature type
+1 IF (PXSGNTYP'=0)
IF (PXSGNTYP'=1)
IF (PXSGNTYP'="")
Begin DoDot:1
+2 SET MAGY="0^Invalid Signature type Value."
+3 SET CT=CT+1
SET MAGRY(CT)="Invalid PXSGNTYP value - 0, 1, or blank only!"
End DoDot:1
+4 IF '$TEST
SET MAGY=1
+5 QUIT
PXTIUTTL ; Check for valid TIU title
+1 NEW VALIEN
+2 IF $$GETTIUDA^MAGGSIV(.MAGY,VALUE,.VALIEN)
SET VALUE=VALIEN
+3 QUIT
EXT ; code will go here to validate the extension type. i.e. we won't let types .exe .bat .com .zip ... etc.
+1 ; Maybe a modification to Object Type file, to have allowable extensions in the file, and a
+2 ; cross reference on a new field EXTENSION. The capture workstation wouldn't have to ask the
+3 ; user for the file type of each file, and we wouldn't get WORD .DOC files that the user called Color Images
ABS ; Meaning: Have the BP create the abstract
JB ; Meaning: Have the BP copy the image to the JukeBox
BIG ; Meaning: There is a big file also, set the Image File field ? to indicate there is a BIG File.
+1 SET MAGY=1
+2 QUIT
WRITE ; Meaning: This is the Internal Entry (or "PACS") of the WRITE Directory. Images will be written
+1 ; here instead of the default WRITE Directory.
+2 SET MAGY=$$DRIVE^MAGGTU1(VALUE)
+3 QUIT
DICOMSN ;Meaning: DICOM Series Number. This will be entered in the Group Object multiple, field #1
+1 ;We were validating this as an integer, but it can be anything, no way to validate.
+2 SET MAGY=1
+3 QUIT
DICOMIN ;Meaning: DICOM Image Number. This will be entered in the Group Object multiple, field #2
+1 ; We were validating this as an integer, but it can be anything, no way to validate.
+2 SET MAGY=1
+3 QUIT
DELFLAG ;Meaning: This flag tells the Delphi Import Component to Delete the Image files after successful processing
+1 IF ",TRUE,FALSE,0,1,"[(","_$$UPPER(VALUE)_",")
SET MAGY=1
+2 IF '$TEST
SET MAGY="0^INVALID Value "
+3 IF VALUE="1"
SET VALUE="TRUE"
+4 IF VALUE="0"
SET VALUE="FALSE"
+5 QUIT
TRNSTYP ;Meaning: This flag is for future use, for now it is ignored, defaults to "NEW"
+1 SET MAGY=1
+2 QUIT
STATUSCB ; Meaning: This is the TAG^RTN that Imaging calls to report the
+1 ; status of the Import.
+2 SET MAGY="0^Error validating TAG^RTN: "_VALUE
+3 IF '$LENGTH($TEXT(@VALUE))
SET MAGY="0^Invalid Status CallBack "_VALUE
+4 IF '$TEST
SET MAGY=1
+5 QUIT
ACQS ; We need to make sure the ACQS (Acquisition Site) is a Valid entry in Imaging Site Params.
+1 ; Stop error, when old OCX sends data.
SET VALUE=$PIECE(VALUE,";")
+2 ; Next Block is for VIC (Maximus) that sends Station Number.
+3 NEW ERR
SET ERR=0
+4 IF MAX
Begin DoDot:1
+5 SET X=$ORDER(^DIC(4,"D",VALUE,""))
+6 IF X=""
SET MAGY="0^Invalid STATION NUMBER: (ACQS): "_VALUE
SET ERR=1
QUIT
+7 SET VALUE=X
+8 QUIT
End DoDot:1
if ERR
QUIT
+9 IF '$$CONSOLID^MAGBAPI
SET MAGY=1
QUIT
+10 ;Patch 20 will have this.
+11 IF '$DATA(^MAG(2006.1,"B",VALUE))
SET MAGY="0^Acquisition Site ("_VALUE_") is Not in Site Param File."
QUIT
+12 SET MAGY=1
+13 QUIT
107 ; 107 and ACQD are the same. Calling 107 falls into validation for ACQD.
ACQD ; 107 and ACQD are ACQUISITION DEVICE FILE (2006.04) pointers or Values.
+1 ; If it is an integer, We assume the value is an IEN and validate it here.
+2 IF ((+VALUE)=VALUE)
IF '$DATA(^MAG(2006.04,VALUE))
SET MAGY="0^Invalid IEN ("_VALUE_") for ACQUISITION DEVICE File."
QUIT
+3 ; if it is not an integer, it is either a new/existing entry for 2006.04 Result is Success,
+4 ; and it will be validated in PRE^MAGGSIA1 and added to File 2006.04 if needed.
+5 SET MAGY=1
+6 QUIT
UPPER(X) ;
+1 QUIT $TRANSLATE(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+2 ;
ERR ; ERROR TRAP FOR Import API
+1 NEW ERR
SET ERR=$$EC^%ZOSV
+2 SET MAGRY(0)="0^ETRAP: "_ERR
+3 DO @^%ZOSF("ERRTN")
+4 QUIT
+5 ;
+6 ;***** Verify and return TIU Title IEN
+7 ;
+8 ; Input Parameters
+9 ; ================
+10 ; TITLE - an Integer (the IEN of file 8925.1) or Text value of the entry in 8925.1
+11 ;
+12 ; Return Values
+13 ; =============
+14 ; Returns 0 if TITLE is valid
+15 ; Returns 1 if TITLE is not valid
+16 ;
+17 ; if TITLE is not valid then MAGY = "0^error message"
+18 ; if TITLE is valid then MAGY = 1 and TIEN = TIU Title IEN
+19 ;
GETTIUDA(MAGY,TITLE,TIEN) ;
+1 IF TITLE=""
SET MAGY="0^Invalid data: Note TITLE is blank!"
QUIT 0
+2 ; Is TITLE integer (IEN)
+3 IF TITLE?1.N
Begin DoDot:1
+4 IF $DATA(^TIU(8925.1,"AT","DOC",TITLE))
SET MAGY=1
SET TIEN=TITLE
QUIT
+5 SET MAGY="0^Invalid data: Note TITLE ("_TITLE_") is invalid"
+6 QUIT
End DoDot:1
QUIT +MAGY
+7 NEW DONE
+8 SET (DONE,TIEN)=""
+9 ; IA #10104
SET TITLE=$$UP^XLFSTR(TITLE)
+10 FOR
if DONE
QUIT
SET TIEN=$ORDER(^TIU(8925.1,"B",TITLE,TIEN))
if TIEN=""
QUIT
Begin DoDot:1
+11 IF $DATA(^TIU(8925.1,"AT","DOC",TIEN))
SET DONE=1
+12 QUIT
End DoDot:1
+13 ; TIEN is already set
IF DONE
SET MAGY=1
+14 IF '$TEST
SET MAGY="0^Invalid data: TITLE IEN ("_TITLE_") is invalid"
+15 QUIT +MAGY