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.2.0.tar.gz (24.1 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.2.0-cp313-cp313-win_amd64.whl (218.1 kB view details)

Uploaded CPython 3.13Windows x86-64

medforge-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (394.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

medforge-0.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (390.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

medforge-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (344.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

medforge-0.2.0-cp312-cp312-win_amd64.whl (218.0 kB view details)

Uploaded CPython 3.12Windows x86-64

medforge-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (394.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

medforge-0.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (391.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

medforge-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (344.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

medforge-0.2.0-cp311-cp311-win_amd64.whl (218.2 kB view details)

Uploaded CPython 3.11Windows x86-64

medforge-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (394.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

medforge-0.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (390.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

medforge-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (348.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for medforge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7787edb92dd6f6823600ec728ebe21dced2ce488b58bd18c4b1ab7501bc629cd
MD5 633f7833c1388eb25c9d576ad637ca78
BLAKE2b-256 4f7699c8e1fe31a475400102199ba9f9cef7ed9b460acf139bae279e2ac1f580

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: medforge-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 218.1 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.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9461548590800a938e7af8517089c7378d94eb6997ca5519dd07bfd9791e6b49
MD5 30c69f450b4f89193a8ae1f2a34cb7db
BLAKE2b-256 99488bce693a9289940191005628ec539abeab1de72bb16e5c156726308b53e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59a5191e79827e19e03ab4aecb1451fd8fdb99933f33cb5543a981fd18114f1d
MD5 651d6b1660808fc3e1afc30dbeab113a
BLAKE2b-256 a302a279c0b5157e07fe764dcb5014f33b6d4be22b0de050dcf36fe09781cef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4697bbb0d7b0fa6c20d970fcd68e240396bcdbfb241195b2020d052007d7258d
MD5 d76f2644dfd97f30199195cf575d0d5e
BLAKE2b-256 2e798c36206ed55da59eea47b2264c3e134efdd85968c4578bf327abf3a0d7a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 781623c6612b4fe0f9353ad2f60153ee393bc83cf43ae8e018854829f70fbcab
MD5 7f46655b4e691fadf1e3eeac9d562a20
BLAKE2b-256 77ed0811455b9135b6dd69e0be779502a08975d553d922fcc022129a43eedaf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: medforge-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 218.0 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.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e98547ef5ce3f419534408d1b8c95035d6715571b18742f62b7a39ee8bb98980
MD5 2bbf433b2917c9501388953cc2c44049
BLAKE2b-256 1aaf26a9b177e63d0c1d2c752e1ce42fac12597113b82f93a39ae7c41e257e87

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cd14792f06452df6d5e914677dd4d632088c7d46fe57ad952d81545cdc151d8
MD5 bea0d1ecd95b85e2c0c7403fc63b8850
BLAKE2b-256 ec6f84d4c2af3ea5aa7201b4ea9ac949997fd80996cbc3fe59c7c521c35ff6f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 912c205d40d0c400b54ff7dc0e18949f3fa0293f44f92222ad004ea03fa9cfd2
MD5 962ea93998bfb7893d65c74c28d8d7d0
BLAKE2b-256 d3f0c0be03a852d8174b16ac144cf0b43b34d2fd0e51e1261ea710f0fd0034db

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df90bc0c442adea5cf63382705800623954b41953b4619f5a1bf428677d86ec8
MD5 efc94a4f00bc74ab72ed8bd380a3c001
BLAKE2b-256 143d3ab23c9cb0ed40e568e551ecdbcf2bdf5a3860188e3885b77db2f8b1d51c

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: medforge-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 218.2 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.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5ce553e2b0e514fb8cef128e359366f13816376f5ab49a26838c4541714d0fd3
MD5 fbb7e7ff718d0230573692379b1c22c1
BLAKE2b-256 cc578d08e11fa14eb505a519fa231b8bd284100710976d08937e7a11353cb8a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9b69c07511040388c7b969e1169dd6416f397b90060b7aeadd4c44ceaf4c6a3
MD5 3abe3713a3ed6fddbb1777e05d7a2073
BLAKE2b-256 576dfecaa3ecdb23fd578e83be8ddfa60ab6556fbe76111d4c2b8843d20625a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88115dfdaf7be93dd6807b4fe6fb94c2c9ac9d3b73c535886d2cc5004a0c677c
MD5 6cb3553f064c03053e786580e2a175c0
BLAKE2b-256 587b4f00124d3177621416d4a1b6a8b1add72c732f6f3f0561f374b737428721

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for medforge-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aff5fb4461d9984d8ccb5e869908085f46560f1c7119666aeba7dfe539fee1ea
MD5 b39403ea909f65b9dae78ddc1be3dba9
BLAKE2b-256 6223842c25228b4615e74dd8993ba91d86338e9357ef5ff06344faecdeb7f522

See more details on using hashes here.

Provenance

The following attestation bundles were made for medforge-0.2.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