Skip to main content

A Pythonic interface for MEDS datasets

Project description

meds_reader: A Pythonic interface for MEDS datasets

pypy docs Build wheels License

meds_reader is a fast and easy-to-use library for reading and processing subject data stored in MEDS (Medical Event Data Standard) format using a Python-native API.

Inspired by HuggingFace Datasets, meds_reader transforms MEDS datasets into collections of Python objects, that can then be processed using normal Python functions.

Example

# First we need to convert to a database
# That requires running the following command in a terminal
$ meds_reader_convert mimic_meds mimic_meds_reader --num_threads 4
# Now we can use Python to interact with our data
import meds_reader

# We can now construct a database
database = meds_reader.SubjectDatabase("mimic_meds_reader")

# Databases are dict-like objects that store subject data

# We can iterate through all the subject ids in the database
for subject_id in database:

    # We can retrieve subject data given a subject_id
    subject = database[subject_id]

    # Subject data can be manipulated with normal Python operations
    print(subject.subject_id)
    for event in subject.events:
        print(event.time, event.code)

        # We can also iterate through all properties in a generic manner
        for property_name, property_value in event:
            print(property_name, property_value)

To learn more, see our full documentation.

Installation

meds_reader can be installed using pip.

pip install meds_reader

Interactive Demo

An interactive demo can be found at Google Colab.

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

meds_reader-0.1.9.tar.gz (60.6 kB view hashes)

Uploaded Source

Built Distributions

meds_reader-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

meds_reader-0.1.9-cp312-cp312-macosx_12_0_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.12 macOS 12.0+ x86-64

meds_reader-0.1.9-cp312-cp312-macosx_12_0_arm64.whl (3.0 MB view hashes)

Uploaded CPython 3.12 macOS 12.0+ ARM64

meds_reader-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

meds_reader-0.1.9-cp311-cp311-macosx_12_0_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.11 macOS 12.0+ x86-64

meds_reader-0.1.9-cp311-cp311-macosx_12_0_arm64.whl (3.0 MB view hashes)

Uploaded CPython 3.11 macOS 12.0+ ARM64

meds_reader-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

meds_reader-0.1.9-cp310-cp310-macosx_12_0_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.10 macOS 12.0+ x86-64

meds_reader-0.1.9-cp310-cp310-macosx_12_0_arm64.whl (3.0 MB view hashes)

Uploaded CPython 3.10 macOS 12.0+ ARM64

meds_reader-0.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

meds_reader-0.1.9-cp39-cp39-macosx_12_0_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.9 macOS 12.0+ x86-64

meds_reader-0.1.9-cp39-cp39-macosx_12_0_arm64.whl (3.0 MB view hashes)

Uploaded CPython 3.9 macOS 12.0+ ARM64

Supported by

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