source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTUX3.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1MAGGTUX3 ;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 ; VALTUX1 and VALTUX2 :
21 ; Copied VALINDEX from MAGGSIV1 and modified for use with IEN's as input
22 ; for the TYPE SPEC PROC parameters. Running time of utility is
23 ; reduced 10 fold.
24 ; VALTUX2 called from CHECK and FIX in MAGGTUX.
25 ; it sets ^XTMP global for later review.
26 ; VALTUX1 called From REVIEW, to produce the Readable Output.
27 ;
28VALTUX1(MAGRY,TYPE,SPEC,PROC) ; Validate the interdependency of Index Terms.
29 ; MAGRY is the return array
30 ; MAGRY(0)="1^Okay" or "0^error message"
31 ; MAGRY(1..n) Information about the Type,Spec and Proc
32 ;
33 ; - Validate the Procedure/Event <-> Specialty/SubSpecialty interdependency
34 ; - Assure the TYPE is a Clinical TYPE.
35 ; - Assure all are Active.
36 ;
37 N CLS,ARR,TYX,PRX,SPX,OK
38 K MAGRY
39 S TYPE=$G(TYPE),PROC=$G(PROC),SPEC=$G(SPEC)
40 I ((PROC]"")!(SPEC]"")) I TYPE="" S MAGRY(0)="0^Type is required." Q 0
41 ;
42 I TYPE D I 'OK S MAGRY(0)=OK Q 0
43 . S OK=1,TYX=TYPE_","
44 . K ARR D GETS^DIQ(2005.83,TYX,".01;1;2","EI","ARR")
45 . S MAGRY(1)="Type - Class : "_ARR(2005.83,TYX,.01,"E")_" - "_ARR(2005.83,TYX,1,"E")
46 . I $L(ARR(2005.83,TYX,2,"E")) S MAGRY(1)=MAGRY(1)_" - "_ARR(2005.83,TYX,2,"E")
47 . I ARR(2005.83,TYX,2,"I")="I" S OK="0^Type is Inactive"
48 . Q
49 ;
50 I SPEC D I 'OK S MAGRY(0)=OK Q 0
51 . S OK=1,SPX=SPEC_","
52 . K ARR D GETS^DIQ(2005.84,SPX,".01;2;4","EI","ARR")
53 . S MAGRY(2)="Specialty/SubSpecialty: "_ARR(2005.84,SPX,.01,"E")
54 . I $L(ARR(2005.84,SPX,4,"E")) S MAGRY(2)=MAGRY(2)_" - "_ARR(2005.84,SPX,4,"E")
55 . I $L(ARR(2005.84,SPX,2,"E")) S MAGRY(2)=MAGRY(2)_" <"_ARR(2005.84,SPX,2,"E")_">"
56 . I ARR(2005.84,SPX,4,"I")="I" S OK="0^Specialty is Inactive"
57 . Q
58 ;
59 I PROC D I 'OK S MAGRY(0)=OK Q 0
60 . S OK=1,PRX=PROC_","
61 . K ARR D GETS^DIQ(2005.85,PRX,".01;4","EI","ARR")
62 . S MAGRY(4)="Procedure/Event : "_$$GET1^DIQ(2005.85,PROC,.01)
63 . I $L(ARR(2005.85,PRX,4,"E")) S MAGRY(4)=MAGRY(4)_" - "_ARR(2005.85,PRX,4,"E")
64 . I ARR(2005.85,PRX,4,"I")="I" S OK="0^Procedure is Inactive"
65 . Q
66 ;
67 ; If PROC and SPEC are "", then Quit, any TYPE by itself is valid
68 I (PROC=""),(SPEC="") S MAGRY(0)="1^Okay" Q 1
69 ; Here, TYPE has to be Clin.
70 S CLS=$$GET1^DIQ(2005.83,TYPE,1,"","MAGTAR") I $E(CLS,1,5)="ADMIN" D Q 0
71 . S MAGRY(0)="0^The Type Index is Administrative, it has to be Clinical."
72 I (PROC="")!(SPEC="") S MAGRY(0)="1^Okay" Q 1
73 ; we get here, we have to validate the interdependency of SPEC <-> PROC.
74 I '$O(^MAG(2005.85,PROC,1,0)) S MAGRY(0)="1^Okay" Q 1
75 I '$D(^MAG(2005.85,PROC,1,"B",SPEC)) D Q 0
76 . S MAGRY(0)="0^Invalid Association between Spec/SubSpec and Proc/Event"
77 . Q
78 S MAGRY(0)="1^Okay"
79 Q 1
80VALTUX2(MAGRY,TYPE,SPEC,PROC) ; Validate the interdependency of Index Terms.
81 ; MAGRY is the return array
82 ; MAGRY(0)="1^Okay" or "0^error message"
83 ; MAGRY(1..n) Information about the Type,Spec and Proc
84 ;
85 ; - Validate the Procedure/Event <-> Specialty/SubSpecialty interdependency
86 ; - Assure the TYPE is a Clinical TYPE.
87 ; - Assure all are Active.
88 K MAGRY
89 S TYPE=$G(TYPE),PROC=$G(PROC),SPEC=$G(SPEC)
90 I ((PROC]"")!(SPEC]"")) I TYPE="" S MAGRY(0)="0^Type is required." Q 0
91 ; TYPE is required, but not enforcing yet. All vendors are not sending
92 I TYPE I $P(^MAG(2005.83,TYPE,0),"^",3)="I" S MAGRY(0)="0^Type is Inactive" Q 0
93 ;
94 I SPEC I $P(^MAG(2005.84,SPEC,0),"^",4)="I" S MAGRY(0)="0^Specialty is Inactive" Q 0
95 ;
96 I PROC I $P(^MAG(2005.85,PROC,0),"^",3)="I" S MAGRY(0)="0^Procedure is Inactive" Q 0
97 ;
98 ; If PROC and SPEC are "", then Quit, any TYPE by itself is valid
99 I (PROC=""),(SPEC="") S MAGRY(0)="1^Okay" Q 1
100 ; Here, TYPE has to be Clin.
101 I $P(^MAG(2005.83,TYPE,0),"^",2)>7 S MAGRY(0)="0^The Type Index is Administrative, it has to be Clinical." Q 0
102 I (PROC="")!(SPEC="") S MAGRY(0)="1^Okay" Q 1
103 ; we get here, we have to validate the interdependency of SPEC <-> PROC.
104 ;
105 ; if PROC is not pointing to any SPEC's, then it is okay for all
106 I '$O(^MAG(2005.85,PROC,1,0)) S MAGRY(0)="1^Okay" Q 1
107 ; if PROC doesn't point to SPEC - it is Invalid.
108 I '$D(^MAG(2005.85,PROC,1,"B",SPEC)) D Q 0
109 . S MAGRY(0)="0^Invalid Association between Spec/SubSpec and Proc/Event"
110 . Q
111 S MAGRY(0)="1^Okay"
112 Q 1
Note: See TracBrowser for help on using the repository browser.