source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLERCHK.m@ 1318

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

initial load of FOIAVistA 6/30/08 version

File size: 5.7 KB
Line 
1HLERCHK ;SFCIOFO/JC - Interface Debugger ;02/25/2004 14:25
2 ;;1.6;HEALTH LEVEL SEVEN;**57,96,108**;Oct 13, 1995
3 ;This routine requires the following to work:
4 ;EVENT DRIVER PROTOCOL TYPE
5 ;It will report inconsistencies with the event driver, susbscribers,
6 ;applications and logical links (if defined)
7 W !,"This routine searches for HL7 protocols with possible errors."
8 S DIR(0)="FAOU"
9 S DIR("A")="Select an EVENT DRIVER Protocol: "
10 S DIR("B")="All"
11 S DIR("?")="^D DICQ^HLERCHK"
12 D ^DIR
13 K DIC,DA,DR I Y="All" S HLANS=0 G ASKDEV
14 S X=Y S DIC="^ORD(101,",DIC(0)="EMQZ"
15 S DIC("S")="I $P(^(0),U,4)=""E"""
16 D ^DIC
17 Q:$D(DTOUT)!($D(DUOUT))
18 Q:+Y=-1
19 S HLANS=+Y
20ASKDEV ;
21 S %ZIS="MQ"
22 D ^%ZIS
23 G:POP EXIT
24 I $D(IO("Q")) D G EXIT
25 .S ZTDESC="HL7 Interface Debugger",ZTRTN="EN^HLERCHK",ZTSAVE("*")=""
26 .S ZTDTH=$H D ^%ZTLOAD
27 .D HOME^%ZIS
28 .W !,$S($D(ZTSK):"Queued to task number: "_ZTSK,1:"NOT QUEUED")
29EN ;
30 U IO
31 I $D(ZTQUEUED) S ZTREQ="@"
32 W !," ** HL7 INTERFACE DEBUGGER **"
33 S HL57=0 I $D(^ORD(101,"AHL21")) S HL57=1
34 ;patch HL*1.6*96 start: add application ack for HL7 v2.4, and others.
35 S HLACK="ACK,ADR,ARD,EDR,ERP,MCF,MFK,MFR,ORF,ORG,ORR,OSR,RAR,RCI,RCL,"
36 S HLACK=HLACK_"RDR,RDY,RER,RGR,ROR,RRA,RRD,RRE,RRG,RRI,RSP,RTB,SQR,"
37 S HLACK=HLACK_"TBR,VXR,VXX"
38 ;patch HL*1.6*96 end
39 ;patch HL*1.6*108 start: add application ack for HL7 v2.5.
40 S HLACK=HLACK_",BRP,BRT,ORB,ORI"
41 ;patch HL*1.6*108 end
42 I 'HLANS S HLPIEN=0 F S HLPIEN=$O(^ORD(101,HLPIEN)) Q:HLPIEN<1 D
43 .Q:$P(^ORD(101,HLPIEN,0),U,4)'="E"
44 .D CHKED(HLPIEN)
45 I +HLANS D CHKED(+HLANS)
46 D EXIT
47 Q
48DICQ ;
49 N X,Y,DIC
50 S X="??"
51 S DIC="^ORD(101,",DIC(0)="EQ"
52 S DIC("S")="I $P(^(0),U,4)=""E"""
53 D ^DIC
54 Q
55CHKED(PP) ;Check Event Driver Protocols
56 K ERR,HLPN,HL770,HLVSP,HLVSN,HLSAPP,HLSAPN,HLMTPP,HLMTPN,HLETPP,HLETPN S ERR=0
57 S HLPN=$P($G(^ORD(101,PP,0)),U)
58 I HLPN="" S ERR=ERR+1,ERR(ERR)="Protocol is UNDEFINED." Q
59 I $P(^ORD(101,PP,0),U,3)]"" S ERR=ERR+1,ERR(ERR)="**PROTOCOL DISABLED**" Q
60 S HL770=$G(^ORD(101,PP,770))
61 I HL770="" S ERR=ERR+1,ERR(ERR)="Missing data for all key fields." Q
62VSN ;Version
63 S HLVSP=$P(HL770,U,10)
64 I HLVSP<1 S ERR=ERR+1,ERR(ERR)="Version ID is required."
65 S HLVSN="" I HLVSP S HLVSN=$P($G(^HL(771.5,HLVSP,0)),U)
66APP ;Sending App
67 S HLSAPP=$P(HL770,U),HLSAPN=""
68 I 'HLSAPP S ERR=ERR+1,ERR(ERR)="Missing Required Sending Application."
69 I HLSAPP S HLSAPN=$P($G(^HL(771,HLSAPP,0)),U)
70 I HLSAPP,HLSAPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to App Param (file 771)."
71 I HLSAPP D CHKAPP(HLSAPP)
72MT ;Message Type
73 S HLMTPP=$P(HL770,U,3),HLMTPN=""
74 I 'HLMTPP S ERR=ERR+1,ERR(ERR)="Missing required Message Type."
75 I HLMTPP S HLMTPN=$P($G(^HL(771.2,HLMTPP,0)),U)
76 I HLMTPP,HLMTPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to Msg Type (file 771.2)."
77 I HLMTPN]"",HLACK[HLMTPN S ERR=ERR+1,ERR(ERR)="For Event Driver-Message Type cannot be an acknowledgement."
78ET ;Event Type
79 S HLETPP=$P(HL770,U,4),HLETPN=""
80 S HLETPN="" I HLETPP S HLETPN=$P($G(^HL(779.001,HLETPP,0)),U)
81 I HLETPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to Event Type (file 779.001)."
82 I 'HLETPP,$G(HLVSN)>2.1 S ERR=ERR+1,ERR(ERR)="Event type is required for versions greater than 2.1."
83OUT1 S $P(LINE,"_",75)=""
84 W !,LINE
85 W !,"Event Driver: ",HLPN
86 W !!,"Sending Application: ",HLSAPN
87 W !,"Version: ",$G(HLVSN)," ","Message Type(770.3): ",$G(HLMTPN)," ","Event Type: ",$G(HLETPN)
88 W !!,"Event Driver Error Summary:",!
89 I $G(ERR)<1 W !,"No Event Driver Errors Found."
90 I $G(ERR) S N=0 F S N=$O(ERR(N)) Q:N<1 W !,N,". ",ERR(N)
91SUB ;Check Subscribers
92 S HL770=$G(^ORD(101,PP,770))
93 I HL770="" S ERR=ERR+1,ERR(ERR)="Missing data for all key fields." Q
94 S HLNODE="^ORD(101,PP,10)"
95 I HL57 S HLNODE="^ORD(101,PP,775)"
96 I '$D(@HLNODE) W !,"No Subscribers Found."
97 S HLX=0 F S HLX=$O(@HLNODE@(HLX)) Q:HLX<1 S HLSUBP=$P(@HLNODE@(HLX,0),U) D CHKSUB(HLSUBP)
98 Q
99CHKSUB(PP) ;Scan Subscribers
100 K ERR,HLPN,HL770,HLVSP,HLVSN,HLRAPP,HLRAPN,HLMTPP,HLMTPN,HLETPP,HLETPN S ERR=0
101 S HLPN=$P($G(^ORD(101,PP,0)),U)
102 I HLPN="" S ERR=ERR+1,ERR(ERR)="Subscriber Protocol is UNDEFINED." Q
103 I $P(^ORD(101,PP,0),U,3)]"" S ERR=ERR+1,ERR(ERR)="**SUBSCRIBER PROTOCOL DISABLED**" Q
104 S HL770=$G(^ORD(101,PP,770))
105 I HL770="" S ERR=ERR+1,ERR(ERR)="Missing data for all key fields." Q
106 S HLRAPP=$P(HL770,U,2),HLRAPN=""
107 I 'HLRAPP S ERR=ERR+1,ERR(ERR)="Missing Required Receiving Application."
108 I HLRAPP S HLRAPN=$P($G(^HL(771,HLRAPP,0)),U)
109 I HLRAPP,HLRAPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to App Param (file 771)."
110 I HLRAPP D CHKAPP(HLRAPP)
111 S HLMTPN="",HLMTPP=$P(HL770,U,11) I HLMTPP D ;Response Message Type
112 .I HLMTPP S HLMTPN=$P($G(^HL(771.2,HLMTPP,0)),U)
113 .I HLMTPP,HLMTPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to Msg Type (file 771.2)."
114 .I HLMTPN]"",HLACK'[HLMTPN S ERR=ERR+1,ERR(ERR)="Message Type must be an appropriate response/acknowledgement."
115 S HLETPP=$P(HL770,U,4),HLETPN=""
116 I HLETPP S HLETPN=$P($G(^HL(779.001,HLETPP,0)),U)
117 I HLETPP,HLETPN="" S ERR=ERR+1,ERR(ERR)="Broken pointer to Event Type (file 779.001)."
118 I $G(^ORD(101,PP,774))=""&($G(^ORD(101,PP,771)))="" S ERR=ERR+1,ERR(ERR)="Missing Processing Routine and Routing Logic."
119 I $G(^ORD(101,PP,774))=""&($P(HL770,U,7))="" S ERR=ERR+1,ERR(ERR)="WARNING-Missing both Logical Link and Routing Logic. Will be local only."
120OUT2 ;Print Subscriber Errors
121 S $P(STAR,"*",40)=""
122 W !,?10,STAR
123 W !,?10,"For Subscriber: ",$G(HLPN)
124 W !!,?10,"Receiving Application: ",$G(HLRAPN)
125 W !,?10,"Message Type (770.11): ",$G(HLMTPN)," ","Event Type: ",$G(HLETPN),!
126 I 'ERR W !,?10,"No Subscriber Errors Found."
127 F ERR=1:1:ERR W !,?10,ERR,". ",ERR(ERR)
128 Q
129CHKAPP(APP) ;Check Application parameters
130 Q:'$D(^HL(771,APP))
131 I $P(^HL(771,APP,0),U,2)="I" S ERR=ERR+1,ERR(ERR)="Application is INACTIVE."
132 Q
133EXIT ;
134 K ZTSK,HL57,HL770,HLACK,HLETPN,HLETPP,HLMTPN,HLMTPP,HLNODE,HLPIEN,HLPN,HLRAPP,HLSAPN,HLSAPP,HLSUBP,HLVSN,HLVSP,HLX,LINE,STAR,SAPP,ERR
135 Q
Note: See TracBrowser for help on using the repository browser.