Skip to content

Latest commit

 

History

History
85 lines (56 loc) · 2.46 KB

File metadata and controls

85 lines (56 loc) · 2.46 KB

HL7 Collect from ASCOM DAS3 Driver Logs

A command-line utility for extracting HL7 messages from ASCOM DAS3 driver log files.

Description

This tool parses ASCOM DAS3 driver log files to identify and extract HL7 messages, saving them to a separate output file for analysis or processing. It specifically looks for lines containing HL7 message headers (MSH|) and related message segments.

Features

  • Extracts HL7 messages from ASCOM DAS3 driver log files
  • Automatically creates output file with .hl7 extension
  • Console output shows extracted messages in real-time
  • Provides statistics on processed lines and extracted messages
  • Handles multiple HL7 messages with proper separation

Requirements

  • .NET Framework or .NET Core runtime
  • Windows operating system (designed for ASCOM driver logs)

Usage

HL7CollectFromLogs.exe "C:\Path\To\LogFile.log"

Example

HL7CollectFromLogs.exe "C:\Test\20230307_NHSWalesLaboratory__43101.log"

This will create an output file: C:\Test\20230307_NHSWalesLaboratory__43101.log.hl7

Command Line Arguments

  • Log File Path: The full path to the ASCOM DAS3 driver log file to process

Output

The program generates:

  • A .hl7 file containing the extracted HL7 messages
  • Console output showing:
    • Each extracted HL7 message as it's processed
    • Total number of source file lines read
    • Total number of HL7 messages found

How It Works

The tool processes log files line by line and:

  1. Identifies lines containing HL7 message headers (MSH|)
  2. Extracts the HL7 message portion from the log line
  3. Identifies subsequent HL7 message segments (lines where the pipe character | appears at position 3)
  4. Separates multiple HL7 messages with blank lines in the output

Error Handling

  • Validates that a log file path is provided as a command-line argument
  • Checks if the specified file exists before processing
  • Provides clear error messages for invalid inputs

Example Output Format

The extracted HL7 messages are saved in standard HL7 format:

MSH|^~\&|SYSTEM|SENDER|RECEIVER|DESTINATION|20230307120000||ORU^R01|12345|P|2.4
PID|1||123456789^^^MRN||DOE^JOHN^MIDDLE||19800101|M
OBR|1||LAB123|CBC^Complete Blood Count

MSH|^~\&|SYSTEM|SENDER|RECEIVER|DESTINATION|20230307120100||ORU^R01|12346|P|2.4
PID|1||987654321^^^MRN||SMITH^JANE^||19750615|F
OBR|1||LAB124|CHEM^Basic Metabolic Panel

License

©2023 ASCOM UMS srl unip. - Gabriele PANCANI

Author

Gabriele PANCANI
ASCOM UMS srl unip.