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

MAGVD010.m

Go to the documentation of this file.
  1. MAGVD010 ;WOIFO/BT,NST,MLH,PML,PMK - Delete Study By Accession Number - display outputs ; Feb 15, 2022@10:24:32
  1. ;;3.0;IMAGING;**118,231,305**;Mar 19, 2002;Build 3
  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. STYSERKT(KT,SUBARY) ; count all the studies & series referenced by a subarray node
  1. Q:SUBARY=""
  1. N STYARY
  1. D ; process matching image indices
  1. . N MAGIX,STYIX
  1. . S MAGIX=0 F S MAGIX=$O(@SUBARY@(MAGIX)) Q:'MAGIX D
  1. . . S STYIX=@SUBARY@(MAGIX)
  1. . . ; old or new structure?
  1. . . I STYIX="" D OLD(MAGIX,.KT) Q ; old
  1. . . I STYIX'="" S STYARY(STYIX)="" Q ; new
  1. . . Q
  1. . Q
  1. D ; do counts from new structure
  1. . S STYIX="" F S STYIX=$O(STYARY(STYIX)) Q:'STYIX D NEW(STYIX,.KT)
  1. . Q
  1. D ; do counts from old structure
  1. . N STYUID,SERUID,MAGIX
  1. . S STYUID="" F KT=0:1 S STYUID=$O(KT("STUDY",STYUID)) Q:STYUID=""
  1. . S KT("STUDY")=$G(KT("STUDY"))+KT
  1. . S SERUID="" F KT=0:1 S SERUID=$O(KT("SERIES",SERUID)) Q:SERUID=""
  1. . S KT("SERIES")=$G(KT("SERIES"))+KT
  1. . S MAGIX="" F KT=0:1 S MAGIX=$O(KT("IMAGE",MAGIX)) Q:MAGIX=""
  1. . S KT("IMAGE")=$G(KT("IMAGE"))+KT
  1. . Q
  1. Q
  1. NEW(STYIX,KT) ; new structure - can build counts directly from structure
  1. Q:'STYIX
  1. ; the PROBLEM6n functions were added in P305 - PMK 12/01/2021
  1. N SERIX
  1. S KT("STUDY")=$G(KT("STUDY"))+1
  1. S SERIX=""
  1. F S SERIX=$O(^MAGV(2005.63,"C",STYIX,SERIX)) Q:'SERIX D
  1. . I $$PROBLEM63^MAGDSTA8(SERIX) Q ; if the series is not available, don't count it - quit
  1. . N SOPIX
  1. . ; If Series deleted don't count - quit
  1. . ; Q:$G(^MAGV(2005.63,SERIX,9))'="A"
  1. . S KT("SERIES")=$G(KT("SERIES"))+1
  1. . S SOPIX=""
  1. . F S SOPIX=$O(^MAGV(2005.64,"C",SERIX,SOPIX)) Q:'SOPIX D
  1. . . ; If SOP deleted don't count - quit
  1. . . ; Q:$G(^MAGV(2005.64,SOPIX,11))'="A"
  1. . . I $$PROBLEM64^MAGDSTA8(SOPIX) Q ; if the sop instance is not available, don't count it - quit"
  1. . . N IMAGEIX
  1. . . S IMAGEIX=""
  1. . . F S IMAGEIX=$O(^MAGV(2005.65,"C",SOPIX,IMAGEIX)) Q:'IMAGEIX D
  1. . . . I $$PROBLEM65^MAGDSTA8(IMAGEIX) Q ; if the original image is not available, don't count it - quit
  1. . . . S KT("IMAGE")=$G(KT("IMAGE"))+1
  1. . . . Q
  1. . . Q
  1. . Q
  1. Q
  1. OLD(MAGIX,KT) ; old structure - must build counts from instances
  1. Q:'$G(MAGIX)
  1. I '$D(^MAG(2005,MAGIX)) S KT("DELETED")="" Q ; deleted study - P231 PMK 12.09/2021
  1. N PARENT,UID,CHILD,CHILDIX
  1. I '$D(^MAG(2005,MAGIX,1)) D Q ; child
  1. . S KT("IMAGE",MAGIX)=""
  1. . S UID=$P($G(^MAG(2005,MAGIX,"SERIESUID")),"^",1) ; series instance UID
  1. . S:UID'="" KT("SERIES",UID)=""
  1. . S PARENT=$P($G(^MAG(2005,MAGIX,0)),"^",10) Q:PARENT="" ; P231 PMK 4/3/2020
  1. . S UID=$P($G(^MAG(2005,PARENT,"PACS")),"^",1) ; study instance UID
  1. . S:UID'="" KT("STUDY",UID)=""
  1. . Q
  1. I $D(^MAG(2005,MAGIX,1)) D Q ; parent
  1. . S UID=$P($G(^MAG(2005,MAGIX,"PACS")),"^",1)
  1. . S:UID'="" KT("STUDY",UID)="" ; study instance UID
  1. . S CHILD=0
  1. . F S CHILD=$O(^MAG(2005,MAGIX,1,CHILD)) Q:'CHILD D
  1. . . S CHILDIX=$P($G(^MAG(2005,MAGIX,1,CHILD,0)),"^",1)
  1. . . S KT("IMAGE",CHILDIX)=""
  1. . . S UID=$P($G(^MAG(2005,CHILDIX,"SERIESUID")),"^",1) ; series instance UID
  1. . . S:UID'="" KT("SERIES",UID)=""
  1. . . Q
  1. . Q
  1. Q