| 1 | MAGGTUX2 ;WIOFO/GEK Imaging utility to validate INDEX values. | 
|---|
| 2 | ;;3.0;IMAGING;**59**;Nov 27, 2007;Build 20 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ;; +---------------------------------------------------------------+ | 
|---|
| 5 | ;; | Property of the US Government.                                | | 
|---|
| 6 | ;; | No permission to copy or redistribute this software is given. | | 
|---|
| 7 | ;; | Use of unreleased versions of this software requires the user | | 
|---|
| 8 | ;; | to execute a written test agreement with the VistA Imaging    | | 
|---|
| 9 | ;; | Development Office of the Department of Veterans Affairs,     | | 
|---|
| 10 | ;; | telephone (301) 734-0100.                                     | | 
|---|
| 11 | ;; |                                                               | | 
|---|
| 12 | ;; | The Food and Drug Administration classifies this software as  | | 
|---|
| 13 | ;; | a medical device.  As such, it may not be changed in any way. | | 
|---|
| 14 | ;; | Modifications to this software may result in an adulterated   | | 
|---|
| 15 | ;; | medical device under 21CFR820, the use of which is considered | | 
|---|
| 16 | ;; | to be a violation of US Federal Statutes.                     | | 
|---|
| 17 | ;; +---------------------------------------------------------------+ | 
|---|
| 18 | ;; | 
|---|
| 19 | Q | 
|---|
| 20 | INIT ; If this is a continuation, initialize the variables. | 
|---|
| 21 | ;W !,"MAGN ",MAGN | 
|---|
| 22 | I $P(^MAG(2005,0),"^",3)>$P(^XTMP(MAGN,0),"^",4) D | 
|---|
| 23 | . W !,"There are new images since this utility was last run." | 
|---|
| 24 | S IEN=$P($G(^XTMP(MAGN,0)),"^",3)+1 I IEN=1 D  Q  ; Already run, so start over. | 
|---|
| 25 | . S IEN="A" | 
|---|
| 26 | . W !!,"All Images were checked as of "_$$FMTE^XLFDT($P(^XTMP(MAGN,0),"^",2)) | 
|---|
| 27 | . W ! | 
|---|
| 28 | . W !,"For a summary of the last Check or Fix process use the menu option: " | 
|---|
| 29 | . W !,"     ""REV    Review a Summary of the last Fix or Check process.""" | 
|---|
| 30 | . W !,"  or continue to Re-Check the Image file." | 
|---|
| 31 | W !,"Continue: where you left off, at IEN : ",IEN,"   Y/N   //N  :" R X:30 | 
|---|
| 32 | I "Nn"[$E(X) W !,"Starting over..." S IEN="A" Q | 
|---|
| 33 | W !,"Continuing from IEN: ",IEN,! | 
|---|
| 34 | S NT=$G(^XTMP(MAGN,"AANT")) | 
|---|
| 35 | S NI=$G(^XTMP(MAGN,"AANI")) | 
|---|
| 36 | S GRINT=$G(^XTMP(MAGN,"AAGRINT")) | 
|---|
| 37 | S GRINI=$G(^XTMP(MAGN,"AAGRINI")) | 
|---|
| 38 | S GO1=$G(^XTMP(MAGN,"AAGO1")) | 
|---|
| 39 | S OFX=$G(^XTMP(MAGN,"AAOFX")) | 
|---|
| 40 | S INVG=$G(^XTMP(MAGN,"AAINVG")) | 
|---|
| 41 | S INVO=$G(^XTMP(MAGN,"AAINVO")) | 
|---|
| 42 | S NOMERG=$G(^XTMP(MAGN,"AANOMERG")) | 
|---|
| 43 | S OKMERG=$G(^XTMP(MAGN,"AAOKMERG")) | 
|---|
| 44 | S FIX=$G(^XTMP(MAGN,"AAFIX")) | 
|---|
| 45 | S CRCT=$G(^XTMP(MAGN,"AACRCT")) | 
|---|
| 46 | Q | 
|---|
| 47 | TRK2 ; Keep a Count of Short Desc, transpose to compact the list. | 
|---|
| 48 | S SD=$P(N2,"^",4) | 
|---|
| 49 | S SD=$TR(SD,"0123456789+-/\.,~`!@#$%^&*()_-={}[]|:;""'<>?","") | 
|---|
| 50 | S SD=$TR(SD,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") | 
|---|
| 51 | F  Q:SD'["  "  S SD=$P(SD,"  ",1)_" "_$P(SD,"  ",2,999) | 
|---|
| 52 | S SD=$$TRIM^XLFSTR(SD,"LR") | 
|---|
| 53 | S:SD="" SD="[NO SHORT DESC]" | 
|---|
| 54 | S ^XTMP(MAGN,"MAIDSD",+IXT,+IXS,+IXP,"SD",SD)=$G(^XTMP(MAGN,"MAIDSD",+IXT,+IXS,+IXP,"SD",SD))+1 | 
|---|
| 55 | Q | 
|---|
| 56 | CHKCR(N40,IEN) ; Image has Procedure/Event CR, see if it should be CT. | 
|---|
| 57 | N INDXD | 
|---|
| 58 | D GENIEN^MAGXCVI(IEN,.INDXD) | 
|---|
| 59 | I $P(INDXD,"^",4)'=RADCT Q | 
|---|
| 60 | S CRCT=CRCT+1 | 
|---|
| 61 | I COMMIT D | 
|---|
| 62 | . S FIX=FIX+1 | 
|---|
| 63 | . S $P(^MAG(2005,IEN,40),"^",4)=RADCT | 
|---|
| 64 | . D ENTRY^MAGLOG("INDEX-CR",DUZ,IEN,"TUX59",MDFN,1) | 
|---|
| 65 | . Q | 
|---|
| 66 | Q | 
|---|
| 67 | CHK45(N40,IEN) ;  Check the Origin Set of Codes. | 
|---|
| 68 | ; N40 passed by Ref, it may be changed in here. | 
|---|
| 69 | N ORG,NORG | 
|---|
| 70 | S ORG=$P(N40,"^",6) | 
|---|
| 71 | I "VNFD"[ORG Q  ; Valid | 
|---|
| 72 | ; get it's first Char. | 
|---|
| 73 | S $P(N40,"^",6)=$S("VNFD"[$E(ORG):$E(ORG),1:"") | 
|---|
| 74 | S OFX=OFX+1 | 
|---|
| 75 | I COMMIT D | 
|---|
| 76 | . S FIX=FIX+1 | 
|---|
| 77 | . S ^MAG(2005,IEN,40)=N40 | 
|---|
| 78 | . D ENTRY^MAGLOG("INDEX-45",DUZ,IEN,"TUX59",MDFN,1) | 
|---|
| 79 | . Q | 
|---|
| 80 | Q | 
|---|
| 81 | VALIND ;Validate the interdependency between Type, Spec, Proc/Event for Entries that have a TYpe. | 
|---|
| 82 | K MRY I $$VALTUX2^MAGGTUX3(.MRY,IXT,IXS,IXP) Q  ; Valid Type <-> Spec <-> Proc | 
|---|
| 83 | ; Keep list of Generated or User entered invalid Type<->Spec<->Proc | 
|---|
| 84 | I $D(^MAGIXCVT(2006.96,IEN)) S ^XTMP(MAGN,"MAIDXG",+IXT,+IXS,+IXP)=$G(^XTMP(MAGN,"MAIDXG",+IXT,+IXS,+IXP))+1,INVG=INVG+1 | 
|---|
| 85 | E  S ^XTMP(MAGN,"MAIDXO",+IXT,+IXS,+IXP)=$G(^XTMP(MAGN,"MAIDXO",+IXT,+IXS,+IXP))+1,INVO=INVO+1 | 
|---|
| 86 | D TRK2 | 
|---|
| 87 | Q | 
|---|
| 88 | VALMERG(O40,N40) ; N40 Passed by Ref. | 
|---|
| 89 | ; if the merged Proc-Spec in New 40 Node (N40) are not valid, | 
|---|
| 90 | ; Then just take the TYPE, and revert back to old O40 Spec and Proc | 
|---|
| 91 | K MRY | 
|---|
| 92 | I $$VALTUX2^MAGGTUX3(.MRY,$P(N40,"^",3),$P(N40,"^",5),$P(N40,"^",4)) S OKMERG=OKMERG+1 Q  ; Merged values are valid | 
|---|
| 93 | S NOMERG=NOMERG+1 | 
|---|
| 94 | S $P(N40,"^",4,5)=$P(O40,"^",4,5) ; Put the Spec and Proc back to original way. | 
|---|
| 95 | Q | 
|---|