Skip to main content

High-performance HL7v2 message parser powered by Rust

Project description

medforge 🔧

High-performance HL7v2 message parser for Python, powered by Rust.

Features

  • Fast — Rust core for 10-50× faster parsing vs pure-Python HL7 libraries
  • Complete — Full HL7v2 hierarchy: Message → Segment → Field → Component → Sub-component
  • Ergonomic — Pythonic API with terser-style path access (msg["PID-5-1"])
  • MLLP-aware — Automatic detection and stripping of MLLP framing
  • Escape-aware — Decodes HL7 escape sequences (\F\, \S\, \T\, \R\, \E\)
  • Serializable — Built-in .to_dict() and .to_json() methods

Installation

pip install medforge

From source (requires Rust)

git clone https://github.com/your-org/medforge.git
cd medforge
nix develop   # or install Rust + maturin manually
maturin develop

Quick Start

import medforge

msg = medforge.parse(
    "MSH|^~\\&|EPIC|HOSPITAL|RECV|FAC|20260318||ADT^A01^ADT_A01|MSG001|P|2.5.1\r"
    "PID|1||MRN12345^^^MRN||DOE^JANE^M^^DR||19850315|F\r"
    "PV1|1|I|4EAST^401^1^^^N||||1234^SMITH^ROBERT^J^^^MD\r"
    "DG1|1||I10^Essential Hypertension^ICD10||20260318|A"
)

# Segment access
pid = msg.segment("PID")
all_dg1 = msg.segments_by_name("DG1")

# Field access (1-indexed, per HL7 spec)
patient_name = pid.field(5)           # Field("DOE^JANE^M^^DR")
patient_name.component(1)            # "DOE"
patient_name.component(2)            # "JANE"

# Terser-style shorthand
msg["PID-5-1"]                       # "DOE"
msg["MSH-9-1"]                       # "ADT"

# MSH convenience properties
msg.message_type                     # ("ADT", "A01")
msg.control_id                       # "MSG001"
msg.version                          # "2.5.1"

# Serialization
msg.to_dict()                        # Python dict
msg.to_json()                        # JSON string

Development

nix develop                          # enter dev shell
maturin develop                      # build + install in dev mode
cargo test                           # Rust tests
python -m pytest tests/ -v           # Python tests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medforge-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

medforge-0.1.0-cp313-cp313-win_amd64.whl (170.3 kB view details)

Uploaded CPython 3.13Windows x86-64

medforge-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (318.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

medforge-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (312.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

medforge-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (276.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

medforge-0.1.0-cp312-cp312-win_amd64.whl (170.3 kB view details)

Uploaded CPython 3.12Windows x86-64

medforge-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (318.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

medforge-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (313.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

medforge-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (276.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

medforge-0.1.0-cp311-cp311-win_amd64.whl (170.4 kB view details)

Uploaded CPython 3.11Windows x86-64

medforge-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (318.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

medforge-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (311.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

medforge-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (278.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file medforge-0.1.0.tar.gz.

File metadata

  • Download URL: medforge-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medforge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19aa79da06b7f4dddbdaf3342f473f755df33e55ba6696dd5cbb7fddd0c051d9
MD5 342b80ed1fb706efc9a1325340057351
BLAKE2b-256 8014f87c11c5d98d352afb406a81605a81cd835e86592000fa1f2f48817b7a6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0.tar.gz:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: medforge-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 170.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medforge-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 621f951f30e5384fde154d82ef9a8f21d48280d17e0ac6a1d06f7ea94d419ad9
MD5 47d5d4ded377ad7a34aeadc3ee784692
BLAKE2b-256 a989b7919edbf10b9da12f1e57aae4d9b98c6a0793164311719fef7f16871e3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01f216ae0ae9559a7519b585f4d8f1255128793f5d61d2ed3faa39966a6c88b8
MD5 a5f24f863c7b2b91236545338d2bf800
BLAKE2b-256 25bea5fa9705bb32abf45a0356c097c7085bae454dfd6e9be16d8d2c22aa2775

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 de2633bdcf3666656e4bbe7a004674367e52ac6e119b2b0cf4667e3693766cf0
MD5 8637d03b7087b49d4b1c92d6bf74c87d
BLAKE2b-256 fc5cf5e1c482f0102b46d13c499c95f26705425f175f379dddee4fae96de2f25

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 baeda76e415398220d9a17e648324b94966ad83569d6e8ff5f9dbcdc8b20fa3c
MD5 8474d1b74eca4b5f5e82f576f6525fc9
BLAKE2b-256 e6d0cff3c1bdd033e4dc1c0a735d5261788fa44709baf1da2a87f136b17ebbf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: medforge-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 170.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medforge-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 80c7fedd628ab6c9992085ee90ca60652af126bf24ec8b18b07db9ce81cc708b
MD5 3f99cf8ae71394c660a64ba2640e457a
BLAKE2b-256 ed23f542532f4800c4eb201a7ecc693077cc70d13f676810964670172d037b8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 10a238cd4b5aa29454cd18abae82b3fb2e471b496cd57b964459ec685d024852
MD5 db4666aa01fd292fc2e38620eb843c4d
BLAKE2b-256 4f8b558163e02fbdb345c68c89f9faabefb3a0a9c1ded5b30a9ab8478f675c73

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8c5e0e89752f77fa21e88542959d872ae8b052162ae2e3427637200840aaf44
MD5 ac9248c23923c5e9d020b8964b58a2a7
BLAKE2b-256 2259de3f36b43e1d82211edcf5dd8d970abd7d112ce8e39f8e296b6e67537237

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 189407ae9442e350a42a89539922e66da6b4f2ae8fb2762a34ed3084fad57116
MD5 9e6c5961a12b2f819055e6428c5d496d
BLAKE2b-256 78f7034659ea990aa36bed1b0122df4ce526f182e4f0d068ef5b8c7e36779ab5

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: medforge-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 170.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medforge-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0908c70e8a340da729a33a4bc2318ff38c8701b159c764528658345bfb850d13
MD5 c3142a437cb3f0484ce2b76b29b08ca3
BLAKE2b-256 08ac1638f3d88567e5fd58677d326a8ca720c37241f1530f968061c8fab2fe66

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp311-cp311-win_amd64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 806db97a667fb8fd33d439a12ebce754888757c783f41d3f246336b40cd0b6c3
MD5 af850b83a492a9d9f0411393b6f73c3d
BLAKE2b-256 496cc2ace074c9c7791c3991fccc5db714fbe1bee0a4ec82fdd53211ec4f2dfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 136c6605967b24735d67869da3c6c9425505e616bff8604fa61f04a49311210e
MD5 9dd2efff5b149c29f57d1b622579d3fa
BLAKE2b-256 bbc736920c6b1036341b9d49fda0beaaa65fa7b1357c77e070060d89c3f97e73

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medforge-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cff4d3d622623a0357332390624d09cac6aaf6b5701ebbea9b8feb2b220c1f1e
MD5 006696672be321da71940efee5414f04
BLAKE2b-256 f64a6e799fef7c27cd40828f63307ebe792426dab77c933cbc13e67208787cb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on medforge/medforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page