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

MAGCFIX.m

Go to the documentation of this file.
  1. MAGCFIX ;OIT/ZEB - CVIX Image Ingest Data Fix ; DEC 3, 2024@9:34AM
  1. ;;3.0;IMAGING;**376**;Dec 03, 2024;Build 5
  1. ;;Per VA Directive 6402, 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. ;; | |
  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. ;For IPO2 testing, start with 7/29/24
  1. INGSTFIX(INTER,DEVNAME,STDT) ;Fix Image file (#2005) entries
  1. ;INTER (default: ""): whether process is interactive
  1. ;DEVNAME (default: "CVIX INGEST"): name of entry to fill into ACQUISITION DEVICE field (#107); if @, field will be cleared
  1. ;STDT (default: "3241113"): start date for search (internal FM format)
  1. S INTER=$G(INTER)
  1. S DEVNAME=$G(DEVNAME,"CVIX INGEST")
  1. S STDT=$G(STDT,"3241113")
  1. N DEVIEN,MAGDT,CNT,MAGIEN,MAG100,DIC,X,Y,DIE,DA,DR
  1. ;find or create device
  1. S DEVIEN=""
  1. S DEVIEN=$S(DEVNAME="@":"@",1:$O(^MAG(2006.04,"B",DEVNAME,DEVIEN)))
  1. D:DEVIEN=""
  1. . K DO ;FILE^DICN assumes this and we need to prevent a leak from something that didn't clean it up
  1. . S DIC="^MAG(2006.04,",DIC(0)="F",X=DEVNAME,DIC("DR")="1///`"_$P($$SITE^VASITE(),U,1)
  1. . D FILE^DICN
  1. . S DEVIEN=Y
  1. I DEVIEN=-1 D Q
  1. . I INTER=1 D
  1. .. W !,"Unable to find/create "_DEVNAME_" device. Aborting."
  1. ;find effected records, set ACQUISITION DEVICE (#107), then delete TRACKING ID (#108); we're deferring setting it until P365
  1. I INTER=1 D
  1. . W !,"Searching for effected records.",!
  1. S CNT=0
  1. S MAGDT=$$FMADD^XLFDT(STDT,-1)
  1. F S MAGDT=$O(^MAG(2005,"AD",MAGDT)) Q:MAGDT="" D
  1. . S MAGIEN=""
  1. . F S MAGIEN=$O(^MAG(2005,"AD",MAGDT,MAGIEN)) Q:MAGIEN="" D
  1. .. S MAG100=^MAG(2005,MAGIEN,100)
  1. .. I $P(MAG100,U,4)="",$P(MAG100,U,5)]"" D
  1. ... S CNT=CNT+1
  1. ... I INTER=1 D
  1. .... W:CNT#10=0 "."
  1. ... S DIE="^MAG(2005,",DA=MAGIEN,DR="107///"_$S(DEVIEN="@":"",1:"`")_DEVIEN_";108///@"
  1. ... D ^DIE
  1. I INTER=1 D
  1. . W !,"Fixed "_CNT_" records."
  1. Q