Skip to main content

MedRxNorm

Python module for normalizing medical prescriptions. Converts common medical abbreviations, medical shorthand, and numbers to pronouncable representations. Uses FSTs made with Pynini python module to make normalization rules.

Installation

pip install MedRxNorm

How to Use

from MedRxNorm import MedRxNorm

mrn = MedRxNorm.MedRxNorm()

print(mrn.normalize("Take 2 TAB PO Q4H x 10 days prn"))
# Output: Take two tablets by mouth every four hours for ten days as needed

It is also possible to normalize individually by route, per day frequency, medicine type, and other abbreviations if needed.

print(mrn.normalize_route("Take 2 TAB PO Q4H x 10 days prn"))
# Output: Take 2 TAB by mouth Q4H x 10 days prn

print(mrn.normalize_per_day("Take 2 TAB PO Q4H x 10 days prn"))
# Output: Take 2 TAB PO every 4 hours x 10 days prn

print(mrn.normalize_med_type("Take 2 TAB PO Q4H x 10 days prn"))
# Output: Take 2 tablets PO Q4H x 10 days prn

print(mrn.normalize_abbreviations("Take 2 TAB PO Q4H x 10 days prn"))
# Output: Take 2 TAB PO Q4H for 10 days as needed

Limitations

The normalize method can be called on strings that are not medical prescriptions with no issue, it will simply return the same string. Example:

print(mrn.normalize("Hello world"))
# Output: Hello world

However, some issues still come up. While most medical abbreviations and shorthand do not overlap with actual English words, the normalize method will still turn words like the English word "bid" to "twice a day". Example:

print(mrn.normalize("I bid you goodnight"))
# Output: I twice a day you goodnight

Furthermore, I have only equipped this tool to accept exactly as many characters as it needs to (the characters that possibly show up in prescriptions). So, if you try to use any of these methods on strings with unknown characters, it will simply break. Example:

print(mrn.normalize("Hello world!"))
# Output: _pywrapfst.FstOpError: Operation failed

I believe both of these problems can be fixed by creating another FST that only accepts strings in the right format for a medical prescription before moving on to apply the normalization rules, however that is a large task that I will save for another day for now.

Metadata

Release files for MedRxNorm 0.1.4

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

Built distribution (wheel)

Table of built distributions (wheels) for MedRxNorm 0.1.4
File Interpreter ABI Platform
MedRxNorm-0.1.4-py3-none-any.whl Python 3 none any Details

Release files / MedRxNorm-0.1.4-py3-none-any.whl

Download URL MedRxNorm-0.1.4-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6a89322667d2ab646882b1a722f4ffe51f12e0287e8c2d76748065555007553
BLAKE2b-256 checksum
How to use checksums
5adedf188e8d81da2261a6125e50b13d5aa575d18740626874a68fcbf777934a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.1

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

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