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

BRADRAHL.m

Go to the documentation of this file.
  1. BRADRAHL ;CMI/BJI/DAY - IHS Mods to MAGDRAHL Program to read a DICOM file [ 12/22/2011 1:31 PM ]
  1. ;;5.0;IHS Mods to VA radiology;**1004**;December 01, 2011
  1. ;
  1. ;IHS Modifications to the MAGDRAHL routine
  1. ;
  1. ; This routine is called from the RAAPI routine. MAGDRAHL does not
  1. ; exist unless the site is running Vista Imaging and has the most
  1. ; recent MAG patches. This routine allows for non Vista sites
  1. ; to obtain a unique Study ID.
  1. ;
  1. ; This routine is invoked by RAHLR to create the HL7 ZDS segment with
  1. ; the Study Instance UID
  1. ;
  1. ; The following code creates a DICOM Study Instance UID from three
  1. ; Radiology Package variables: RADTI, RACNI, and ACNUMB
  1. ;
  1. ; Input:
  1. ; RADTI -- internal subscript for the study in RADPT - reverse date/time
  1. ; RACNI -- internal subscript for the study in RADPT - counter
  1. ; ACNUMB - external identifier for the study - [site number -] date-case number
  1. ;
  1. ;
  1. STUDYUID(RADTI,RACNI,ACNUMB) ; return the Study Instance UID
  1. ;
  1. N FLAG ;----- Flag to prevent multiple dots in a row or leading zeroes
  1. N I ;-------- Loop counter
  1. N RAW ;----- "Raw" STUDYUID
  1. N STATNUMB ;- Station number
  1. N STUDYUID ;- Resulting unique identifier
  1. ;
  1. ;Get the Station Number
  1. S STATNUMB=$E($P($$NS^XUAF4($$KSP^XUPARAM("INST")),U,2),1,3)
  1. ;
  1. ;We will use the VA's UID Root
  1. ;S RAW=^MAGD(2006.15,1,"UID ROOT")_".1.4."_STATNUMB_"."_RADTI_"."_RACNI_"."_ACNUMB
  1. S RAW="1.2.840.113754"_".1.4."_STATNUMB_"."_RADTI_"."_RACNI_"."_ACNUMB
  1. ;
  1. S STUDYUID="",FLAG=0 F I=1:1:$L(RAW) D
  1. . N E
  1. . S E=$E(RAW,I)
  1. . S:E'?1AN E="."
  1. . I "123456789"[E S STUDYUID=STUDYUID_E,FLAG=1 Q
  1. . I E="0" S:$E(RAW,I+1)'?1AN FLAG=1 S:FLAG STUDYUID=STUDYUID_E Q
  1. . I E?1U S STUDYUID=STUDYUID_($A(E)),FLAG=1 Q
  1. . I E?1L S STUDYUID=STUDYUID_($A(E)-32),FLAG=1 Q
  1. . I E="." S:FLAG STUDYUID=STUDYUID_E S FLAG=0 Q
  1. . Q
  1. ;
  1. ; No trailing dots either
  1. F Q:$E(STUDYUID,$L(STUDYUID))'="." S STUDYUID=$E(STUDYUID,1,$L(STUDYUID)-1)
  1. I $L(STUDYUID)>64 S $EC=",U13-STUDY UID too long,"
  1. ;
  1. Q STUDYUID
  1. ;
  1. ;
  1. ZDS(STUDYUID) ; returns the ZDS segment
  1. ;
  1. N HLECH1 ;--- HL7 component separator
  1. S HLECH1=$E(HLECH) ; HL7 component separator
  1. I $L(STUDYUID)>64 S $EC=",U13-STUDY UID too long,"
  1. Q "ZDS"_HLFS_STUDYUID_HLECH1_"VISTA"_HLECH1_"Application"_HLECH1_"DICOM"
  1. ;