Skip to main content

MLLP/HTTP

PyPI

Overview

Convert MLLP to HTTP and vice versa.

http2mllp is an HTTP server that converts HTTP requests to MLLP messages and MLLP messages to HTTP responses.

mllp2http is an MLLP server that converts MLLP messages to HTTP requests and HTTP responses to MLLP messages.

Keywords: MLLP, HTTP, HL7, HL7 over HTTP

Description

MLLP (Minimum Lower Layer Protocol) is the traditional session protocol for HL7 messages.

Many modern tools (load balancers, application frameworks, API monitoring) are designed around HTTP. This observation is the foundation for the HL7 over HTTP specification.

This project, MLLP/HTTP, bridges these two protocols, allowing network engineers and application developers to work with familiar HTTP technlogy while interfacing with MLLP-based programs.

Implements MLLP release 1 and HTTP/1.1. Each MLLP message is assumed to have a corresponding response content (e.g. HL7 acknoledgment).

Note that this project deals only with the MLLP layer; it does not process HL7 messages themselves. Notably, the HTTP participant must be able to intepret HL7 messages and generate acknowledgements. This separation imposes no requirements for HL7 usage and leaves application developers with full access to the features of the HL7 protocol.

Install

Pip

pip install mllp-http

Run as

http2mllp mllp://localhost:2575

mllp2http http://localhost:8000

Docker

docker pull rivethealth/mllp-http

Run as

docker run -it -p 2575:2575 rivethealth/mllp-http http2mllp mllp://localhost:2575

docker run -it -p 2575:2575 rivethealth/mllp-http mllp2http http://localhost:8000

Usage

http2mllp

usage: http2mllp [-h] [-H HOST] [-p PORT] [--keep-alive KEEP_ALIVE] [--log-level {error,warn,info}] [--mllp-max-messages MLLP_MAX_MESSAGES] [--mllp-release {1}]
                 [--timeout TIMEOUT] [-v]
                 mllp_url

            HTTP server that proxies an MLLP server.
            Expects an MLLP response message and uses it as the HTTP response.


positional arguments:
  mllp_url              MLLP URL, e.g. mllp://hostname:port

optional arguments:
  -h, --help            show this help message and exit
  -H HOST, --host HOST  HTTP host (default: 0.0.0.0)
  -p PORT, --port PORT  HTTP port (default: 8000)
  --keep-alive KEEP_ALIVE
                        keep-alive in milliseconds, or unlimited if -1. (default: 0)
  --log-level {error,warn,info}
  --mllp-max-messages MLLP_MAX_MESSAGES
                        maximum number of messages per connection, or unlimited if -1. (default: -1)
  --mllp-release {1}    MLLP release version (default: 1)
  --timeout TIMEOUT     socket timeout, in milliseconds, or unlimited if 0. (default: 0)
  -v, --version         show program's version number and exit

mllp2http

usage: mllp2http [-h] [-H HOST] [-p PORT] [--content-type CONTENT_TYPE] [--log-level {error,warn,info}] [--mllp-release {1}]
                 [--timeout TIMEOUT] [-v]
                 http_url

MLLP server that proxies an HTTP server. Sends back the HTTP response.

positional arguments:
  http_url              HTTP URL

optional arguments:
  -h, --help            show this help message and exit
  -H HOST, --host HOST  MLLP host (default: 0.0.0.0)
  -p PORT, --port PORT  MLLP port (default: 2575)
  --content-type CONTENT_TYPE
                        HTTP Content-Type header (default: x-application/hl7-v2+er7)
  --log-level {error,warn,info}
  --mllp-release {1}    MLLP release version (default: 1)
  --timeout TIMEOUT     timeout in milliseconds (default: 0)
  -v, --version         show program's version number and exit

environment variables:
    HTTP_AUTHORIZATION - HTTP Authorization header
    API_KEY - HTTP X-API-KEY header

Examples

mllp2http

Run an HTTP debugging server:

docker run -p 8000:80 kennethreitz/httpbin

Run the MLLP connector:

mllp2http http://localhost:8000/post

Send an MLLP message:

printf '\x0bMESSAGE\x1c\x0d' | socat - TCP:localhost:2575

and see the HTTP server's response (which describes the HTTP request that the connector made):

{
  "args": {},
  "data": "MESSAGE",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate",
    "Connection": "keep-alive",
    "Content-Length": "7",
    "Content-Type": "x-application/hl7-v2+er7",
    "Forwarded": "by=127.0.0.1:2575;for=127.0.0.1:54572;proto=mllp",
    "Host": "localhost:8000",
    "User-Agent": "mllp2http/1.0.2"
  },
  "json": null,
  "origin": "127.0.0.1:54572",
  "url": "mllp://localhost:8000/post"
}

Developing

To install:

make install

Before committing, format:

make format

Metadata

Release files for mllp-http 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mllp-http 1.1.4
File Size Uploaded
mllp-http-1.1.4.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mllp-http 1.1.4
File Interpreter ABI Platform
mllp_http-1.1.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 19.9 kB

Release files / mllp-http-1.1.4.tar.gz

Download URL mllp-http-1.1.4.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b75bc0c13f6406fb29d60a519f3351183d65f9901e1cedda9ee0d3521e878d1
BLAKE2b-256 checksum
How to use checksums
7ea6f24f2989181837eff5d24896eb31cc04f07df9fb3067a993c0d6e3ff7178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.10

Release files / mllp_http-1.1.4-py2.py3-none-any.whl

Download URL mllp_http-1.1.4-py2.py3-none-any.whl
Size 9.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
40ad561f5185c21eab0d9090e3e294920c4fef2d0ced28e711c5a5777ad5305a
BLAKE2b-256 checksum
How to use checksums
b6972c66502971185539a22ae165006f46b3f2fb057b70537e8941482b6b107d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page