7view
is a simple and fast hl7 viewer that can be used on Windows, MacOS
and Linux. The main features of the viewer are:
All sources are freely available and licensed under the LGPL. Report issues on gitlab.com/wunderlins/hl7parse.
This project also contains a collection of hl7 utilities written in C and C++. All tools are available and tested on Debian, Windows and MacOS. The packaged tools provide the following functionality:
7view
- a gui viewer for HL7 files7pdf
- extract a base64 encoded string from a field and open it in a pdf viewer7parse
- create a command line grep-able tree representation of a hl7 file7search
- fast hl7 content search utility that knows the structurelib7
- the C implementation of the hl7 parser (API Documentation)pylib7
- python bindings for the C parser (API Documentation)System | Download | System Requirements |
---|---|---|
Windows | Installer, ZIP, Source | Windows 7/10 (maybe Vista, 64 bit only) |
MacOS | Disk Image (dmg), Source | MacOS 10.15 (Catalina) |
Debian | Debian Package (deb), Source | Debian Buster or equivalent Ubuntu |
Linux | x64 binary, Source | |
Python3 | pip package | Tested with Python 3.8+ (no python2 support) |
All work product by the team is provided “AS IS”. Other than as provided in this agreement, the team makes no other warranties, express or implied, and hereby disclaims all implied warranties, including any warranty of merchantability and warranty of fitness for a particular purpose.
The 0.4.1 Release is a maintanance release. with a few new features.
A lot of infrastructure has been changed
hl7_meta_t
is now a member of message_t
. Hl7 metadata is now always part of a message object.Some older releases are available here.
me@there:~$ git clone https://gitlab.com/wunderlins/hl7parse.git
me@there:~$ git submodule init # optional for doxygen theme
me@there:~$ git submodule update # optional for doxygen theme
You can find instructions of setting up the build environment in README.md. The command line utilites have minimal dependencies (glibc), the gui utilities require Qt5 and additional tools are optionally required (for testing and documentation).
Install
pip install --user lib7-X.X.X.tar.gz
Uninstall
pip uninstall -y "$(pip freeze --user | grep lib7)"
Usage
Example from the API Documentation:
import lib7
msg = lib7.open("path/to/some/file.hl7")
# check what sort of message type this is, defined in MsH-9.1
msh91 = None
msh92 = None
try:
msh91 = msg.get("MSH-9.1")
print(msh91) # should print the content of the FIELD
except Hl7StructureException:
print("MSH-9.1 Not found)
try:
msh92 = msh91.next_sibling
except Hl7StructureException:
print("MSH-9.2 Not found)
root = msh92
while root.parent:
root = root.parent
# we have now found the top most node which is of type MESSAGE
# This node contains N segments in children
print(root.type) # prints: Type.MESSAGE
print("%r" % root) # prints: <MESSAGE (children: 2)>
print(root.num_children) # prints: 2
assert(root == msg) # same same but different (variable name)
# every node in the structure is an iterator which will
# iterate over all child nodes.
#
# This is the preferred way, because it is faster than first
# fetching all nodes via `n.children` and then looping over them.
for seg in root:
print("%r" % seg)
# prints: <SEGMENT MSH(1) (children: 18), MSH>
# <SEGMENT PID(1) (children: 1), PID>
print(seg.addr)
# prints: MSH(1)
# PID(1)
# or you may fetch a list of child ndoes like this:
children = root.children
# print the segment names
for c in children:
print(c.data) # prints: MSH, PID, ...