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

INHMGD.m

Go to the documentation of this file.
  1. INHMGD ;CAR; 1 Aug 97 10:23;HL7 MESSAGING - MANAGEMENT OF DATA SOURCES
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME: HL7 Message Data Sources utility (INHMGD)
  1. ;
  1. ; PURPOSE:
  1. ; Module INHMGD is used to extract information describing the
  1. ; source file and field for HL7 Messages, or to list all Messages
  1. ; that reference a specific field.
  1. ;
  1. ;DESCRIPTION:
  1. ;This routine prompts the user for a HL7 Message Name, then displays
  1. ;the associated Segments and for each segment, display the Fields
  1. ;and the data address for each Field. Alternatively, the user can
  1. ;request that a listing for all messages be sent to a file. Or, the
  1. ;user can request a sensitivity analysis where the user supplies a
  1. ;data address, and the routine lists all of the messages that
  1. ;reference that address.
  1. ;
  1. ;ENTRY POINTS:
  1. ; EN = Extract source data addresses for specific messages.
  1. ; EN1 = List messages referencing a specific data address.
  1. ;
  1. ; Return: None
  1. ; Parameters: None
  1. ;
  1. EN ; Entry point for the HL7 Message Data Sources utility
  1. K INSENS N INSENS S INSENS=0
  1. ;
  1. EN1 ; Entry point for the HL7/CHCS Field Sensitivity Analysis
  1. I '$D(INSENS) N INSENS S INSENS=1
  1. N DIC,INALL,INAM,INCSG,INDA,POP,INQUIT
  1. K DUOUT,POP,DIC
  1. ;
  1. ;new leftover variables
  1. N %,%Y,%DT,DA,DICOMPX,DIJC,DIRCP,DIRI,DIRMAX,DOY,DQI,DUOUT,INEXIT,INFIN,INFLD,J,X,Y,INPERR,INEOR
  1. S (INEXIT,INQUIT)=0,INCSG=1 ;INCSG=flag for Print common segments?
  1. ;
  1. ;All fields/messages?
  1. S INALL=$$INALL($S(INSENS:"mapped fields",1:"messages")) Q:INEXIT
  1. ;
  1. ;Else Ask for field/message names
  1. I 'INALL D Q:$G(DUOUT)!INQUIT
  1. .;query user for fields to lookup in sensitivity analysis
  1. .I INSENS D SENSINP^INHMGD5(.INSENS) Q
  1. .;OR, for message name, then DIC lookup for the IEN
  1. .S DIWF="",DIC="^INTHL7M(",DIC(0)="AEQ"
  1. .S DIC("A")="SELECT SCRIPT GENERATOR MESSAGE: "
  1. .D ^DIC I Y>0 S INAM=$P(Y,U,2),INDA=+Y Q
  1. .S INQUIT=1
  1. ;
  1. ;If not sensitivity analysis, ask: include the common segments?
  1. I 'INSENS S INCSG=$$COMMON Q:INEXIT
  1. ;
  1. ;Print lookup errors?
  1. S INPERR=$$INPERR Q:$G(DUOUT)
  1. I 'INALL,'INPERR,INSENS,'$O(INSENS(0)) Q ;nothing to do
  1. ;
  1. ;set up Device handling:
  1. N %ZIS,INHDR,INP,ZTDESC,ZTIO,ZTRTN,ZTDTH,ZTSAVE
  1. K IOP S %ZIS("A")="QUEUE ON DEVICE: ",%ZIS("B")="",%ZIS="NQ"
  1. D ^%ZIS I POP S IOP="",%ZIS="" D ^%ZIS U IO K IO("Q"),IOP,POP Q
  1. S IOP=ION_";"_IOST_";"_IOM_";"_IOSL
  1. ;
  1. ;Ask user, "Write an abbreviated copy of the output to a file?"
  1. S INP=0 I 'INSENS,'INPERR,ION[".DAT" S INP=$$TABOUT Q:INEXIT
  1. ;
  1. ;queue job up for a printer or send to a file:
  1. I IO'=IO(0) D S IOP="",%ZIS="" D ^%ZIS U IO K IO("Q"),IOP,POP Q
  1. .S ZTDESC="HL7 Data Source Management"
  1. .S ZTRTN="ENQUE^INHMGD"
  1. .S ZTIO=IOP
  1. .;S ZTDTH=$H,$P(ZTDTH,",",2)=$P(ZTDTH,",",2)+5
  1. .F X="INALL","INAM","INDA","INCSG","INP","INSENS","INSENS(","INPERR" S ZTSAVE(X)=""
  1. .D ^%ZTLOAD
  1. ;
  1. ;else, fall through to Taskman entry point and send output to user
  1. I IO=IO(0) S %ZIS="" D ^%ZIS I POP D S IOP="" D ^%ZIS U IO K POP Q
  1. .W *7,!,"Sorry, unable to find device..."
  1. ;
  1. ENQUE ;Taskman entry point
  1. ;where INAM [ Message Name and INDA [ IEN of that message.
  1. K ^UTILITY("INHMGD",$J) ;just in case we did ^C out last time.
  1. N INDATA,INDT,INOFF,INEXIT,INDHT,INERN,INJ,INHDR
  1. N INMODE,INPAGE,INPARS,INTRP,DATA,INX,J,K,INQ,FILE,FLVL,INS2,ING
  1. ;
  1. S (ING,INERN)=0
  1. I IOM=132 S ING=IOM-12 N IOM S IOM=ING,ING=8
  1. ;setup for field column (see INHMGD4 for remainder of columns)
  1. S INS2=$S(IOM>90:58,1:47)+ING ;start of column2
  1. ;
  1. S INDA=$G(INDA,0),INAM=$G(INAM),INALL=$G(INALL,0)
  1. S INP=$G(INP),IOP=$G(IOP),INSENS=$G(INSENS),INPAGE=""
  1. ;
  1. S INEXIT=0
  1. S INDT=$$CDATASC^UTDT($H,1,1)
  1. S INOFF=$S(IOM>80:IOM-80,1:0) ;printing offsets based on width IOM
  1. ;
  1. ;if we are printing all (INALL>0) messages, then:
  1. I 'INSENS,INALL N INDA S INAM="" D Q:INEXIT
  1. .F S INAM=$O(^INTHL7M("B",INAM)) Q:INAM=""!INEXIT D
  1. ..S INDA=0 F S INDA=$O(^INTHL7M("B",INAM,INDA)) Q:'INDA D
  1. ...I "TESTPROTO"[$P(^INTHL7M(INDA,0)," ") Q
  1. ...D IN^INHMGD1(INDA,.INP)
  1. ;
  1. ;we are not printing all messages, just one.
  1. I 'INSENS,'INALL D IN^INHMGD1(INDA,.INP) Q:INEXIT
  1. ;
  1. ;is this a SENSITIVITY ANALYSIS?
  1. I INSENS D
  1. .D INSUPDT^INHMGD6
  1. .D INSPRNT^INHMGD8(.INSENS,INALL)
  1. ;
  1. ;Print *****End of Report***** and pause to let user read last page
  1. S INEOR="*****End of Report*****"
  1. I INPAGE,'INP,'INEXIT D
  1. .S (INHDR(4),INDATA)="$C(32)" F INJ=1:1:3 D INW^INHMGD8(INJ=1)
  1. .S INDATA="$$DASH^INHMGD1(IOM-$L(INEOR)\2,"" "")_INEOR" D INW^INHMGD8(0)
  1. .;pause to let user read last page
  1. .I $E(IOST)="C",'$D(IO("Q")),IO=IO(0) S DUOUT=$$CR^UTSRD
  1. ;
  1. ;Print Errors?
  1. I INPERR,'INEXIT D INPERR^INHMGD9
  1. K ^UTILITY("INHMGD",$J)
  1. ;
  1. D ^%ZISC
  1. Q
  1. ;
  1. INALL(UNITS) ;do you want all (fields/messages)?
  1. N INHLP,X
  1. S INHLP="Answer ""Y"" to display all "_UNITS
  1. S INHLP=INHLP_", ""N"" to select individual "_UNITS_"."
  1. S X=$$YN^UTSRD("Do you wish to print ALL "_UNITS_"? ;0",INHLP)
  1. I $P(X,U,2)]"" S INEXIT=1
  1. Q X
  1. ;
  1. COMMON() ;do you want the common segments?
  1. N INHLP,X
  1. S INHLP="Do you want to include the Message Header segment (MSH) "
  1. S INHLP=INHLP_"and the Patient ID segment (PID)?"
  1. S X=$$YN^UTSRD("Include the COMMON SEGMENTS (MSH and PID)? ;0",INHLP)
  1. I $P(X,U,2)]"" S INEXIT=1
  1. Q X
  1. ;
  1. INPERR() ;do you want to print any lookup errors?
  1. N INHLP
  1. S INHLP="Lists non-existant CHCS fields and multiply defined HL7 Message Segments"
  1. S X=$$YN^UTSRD("Print ""Lookup Errors"" listing? ;0",INHLP)
  1. I $P(X,U,2)]"" S INEXIT=1
  1. Q X
  1. ;
  1. TABOUT() ;set up the output for exporting as a tab-delimited file?
  1. N INHLP,X
  1. S INHLP="A tab-delimited VMS file can be easily imported into desk-top applications."
  1. S X=$$YN^UTSRD("Do you want this file to be tab-delimited? ;0",INHLP)
  1. I $P(X,U,2)]"" S INEXIT=1
  1. Q X
  1. ;