Library that transforms HL7 messages using mapping schemes
Project description
Introduction
hl7_transform
is a Python package that allows for transformation of HL7 messages
using a field mapping dictionary.
As a standard, HL7 permits different ways of implementing message interfaces between systems. For example two systems that exchange ADT or SIU messages often pass the same information in different fields. In a hospital, an integration engine would map one type of HL7 messages to another, transforming the messages on the fly as they are passed through the interfaces. This Python package allows you to test message transformation without having an integration engine in place. You can modify your HL7 message structure freely, by using a JSON-encoded mapping of fields, then evaluate the conformance of the newly created transformed messages to the target software.
A live example of this package at work can be found in hl7_transform_web repository and online.
How to use
The easiest way to use this library is to install it from Pypi:
pip install hl7_transform
Alternatively, you can download and build this package from source:
git clone https://github.com/pdyban/hl7_transform.git
python setup.py build
python setup.py install
After installation, you can use the Python library in your own projects as well as call standalone script hl7_transform in the shell console of your choice.
hl7_transform --help
You can also build your own projects or experiment in Jupyter notebooks by importing the library in your Python code:
from hl7_transform.mapping import HL7Mapping
from hl7_transform.transform import HL7Transform
from hl7_transform.message import HL7Message
mapping = HL7Mapping.from_json('test_transform.json')
message = HL7Message.from_file('test_msg.hl7')
transform = HL7Transform(mapping)
transformed_message = transform(message)
For example code, see inside test module, in particular test_transform.py.
Documentation
This project is documented using sphinx. The documentation pages can be found in ReadTheDocs.
To understand how the package works, we suggest to start by reading the Mapping rules documentation page.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.