Skip to content

bkutasi/hl7sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HL7 PDF Sender

A Rust-based utility for sending HL7 messages over TCP/IP with HL7 MDM^T02 message type.

Features

  • HL7 v2.5 message formatting
  • TCP/IP transmission with timeout handling
  • File size validation (max 10MB)
  • Proper HL7 control characters
  • Configurable network settings

Installation

  1. Clone the repository:
git clone https://github.com/bkutasi/hl7sender
cd hl7sender
  1. Run tests:
cargo  test
  1. Build the project:
cargo build --release

Usage

./target/release/hl7sender --host <host> --port <port> --message <message> --timeout <timeout>

Arguments:

  • --host: The target HL7 server hostname or IP address
  • --port: The port number of the HL7 server
  • --message: Path to the PDF file to be sent
  • --timeout: The maximum number of seconds to wait for a response

Example:

./target/release/hl7sender --host localhost --port 2525 --message message.hl7 --timeout 60

Message Format

The program takes HL7 messages with the following structure:

  • Message type: MDM^T02
  • Base64 encoded PDF in OBX segment
  • ASCII character encoding
  • Standard HL7 v2.5 delimiters

Error Handling

The program includes error handling for:

  • File size limitations (10MB max)
  • Network timeouts (30 seconds)
  • Connection failures
  • Invalid responses

Technical Details

The implementation consists of a main function which send the prepared HL7 message:

  • send_hl7_message: Handles TCP/IP communication

For detailed implementation, see the source code:

src/main.rs

Testing coverage:

2024-12-01T11:58:09.827358Z  INFO cargo_tarpaulin::report: Coverage Results:
|| Uncovered Lines:
|| src/main.rs: 65, 97, 106, 110-114
|| Tested/Total Lines:
|| src/main.rs: 35/43 +0.00%
|| 
81.40% coverage, 35/43 lines covered, +0.00% change in coverage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages