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

MAGVRS46.m

Go to the documentation of this file.
  1. MAGVRS46 ;WOIFO/DAC,MLH,NST - Utilities for RPC calls for DICOM file processing ; 29 Feb 2012 5:21 PM
  1. ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 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. ; Called by MAGVRS41
  1. ;
  1. ;+++++ Add multi-keys to KEYFLD array
  1. ; Input Parameters
  1. ; ================
  1. ;
  1. ; FILE - VA FileMan file number ( e.g. 2005.6)
  1. ; .ATTNAMS - Array with field names and values
  1. ; .KEYFLD - Array with key field and values
  1. ;
  1. ; Return values
  1. ; =============
  1. ;
  1. ; if error found during execution
  1. ; OUT(1) = Negative number ` Error message
  1. ; if success
  1. ; OUT(1) is not set
  1. ;
  1. ADDMKEYS(OUT,FILE,ATTNAMS,KEYFLD) ; Set multi-keys
  1. N FIELD,NAM,VAL
  1. N SSEP
  1. S SSEP=$$STATSEP^MAGVRS41
  1. ; Add multi-keys for Patient and Procedure reference
  1. I (FILE=2005.6)!(FILE=2005.61) D
  1. . S FIELD=.01
  1. . F S FIELD=$O(^DD(FILE,FIELD)) Q:(FIELD'>0)!(FIELD'<.05) D Q:$D(OUT(1)) ; Private IA (#5551)
  1. . . S NAM=$$GET1^DID(FILE,FIELD,,"LABEL")
  1. . . I '$D(ATTNAMS(NAM)) S OUT(1)="-61"_SSEP_"Expected attribute "_NAM_" not found" Q
  1. . . S KEYFLD(FIELD)=ATTNAMS(NAM)
  1. . . S KEYFLD(FIELD,"GSL")=$$GET1^DID(FILE,FIELD,,"GLOBAL SUBSCRIPT LOCATION")
  1. . . Q
  1. . Q:$D(OUT(1))
  1. . ; Resolve Creating Entity value
  1. . I '$D(ATTNAMS("CREATING ENTITY")) S OUT(1)="-62"_SSEP_"Expected attribute CREATING ENTITY not found" Q
  1. . D SERVINST^MAGVRS44(ATTNAMS("CREATING ENTITY"),.VAL)
  1. . I VAL'>0 S OUT(1)="-65"_SSEP_"Cannot resolve Creating Entity value: "_ATTNAMS("CREATING ENTITY") Q
  1. . S KEYFLD(.05)=VAL
  1. . S KEYFLD(.05,"GSL")=$$GET1^DID(FILE,.05,,"GLOBAL SUBSCRIPT LOCATION")
  1. . Q
  1. Q
  1. ;
  1. ;+++++ Find a record by .01 field and key fields
  1. ; Input Parameters
  1. ; ================
  1. ;
  1. ; FILE - VA FileMan file number ( e.g. 2005.6)
  1. ; UATT - Value to be found in "B" cross-reference
  1. ; PIEN - Parent IEN (.e.g. Patient reference is a parent of Procedure reference)
  1. ; .KEYFLD - Array with key field and values
  1. ;
  1. ; Return values
  1. ; =============
  1. ; If a record is not found it returns zero (0),
  1. ; If a record is found it returns IEN of the record
  1. ;
  1. MATCH(FILE,UATT,PIEN,KEYFLD) ; Find match by keys
  1. N POS,HIT,IEN,R,I
  1. ;
  1. S FILE=+$G(FILE)
  1. S UATT=$G(UATT)
  1. S PIEN=$G(PIEN)
  1. ;
  1. I UATT="" Q 0 ; no record found
  1. ;
  1. S HIT=0
  1. S IEN=0
  1. F S IEN=$O(^MAGV(FILE,"B",UATT,IEN)) Q:'IEN D Q:HIT
  1. . S R=$G(^MAGV(FILE,IEN,0)) ; The assumption is that all key fields are on "0" subscript
  1. . D:R'=""
  1. . . S HIT=1,I=0
  1. . . F S I=$O(KEYFLD(I)) Q:'I S POS=$P(KEYFLD(I,"GSL"),";",2) I $P(R,"^",POS)'=KEYFLD(I) S HIT=0 Q
  1. . . ; Check the parent for study and series
  1. . . I ((FILE=2005.62)!(FILE=2005.63)) D
  1. . . . I PIEN'=+$G(^MAGV(FILE,IEN,6)) S HIT=0
  1. . . . Q
  1. . . Q
  1. . Q
  1. Q IEN