Skip to main content

Parses XML files exported from Prelude EDC into formats usable by Python.

Project description

Prelude Parser

Tests Status pre-commit.ci status Coverage PyPI version PyPI - Python Version

Parses XML files exported from Prelude EDC into formats Python can use.

Installation

pip install prelude-parser

Optionally the pandas extra can be installed to parse to a Pandas DataFrame

Note: Pandas only supports Python 3.9+ so this is not available in Python 3.8.

pip install prelude-parser[pandas]

Optionally the polars extra can be installed to parse to a Polars DataFrame

pip install prelude-parser[polars]

All extras can be install with

pip install prelude-parser[all]

Usage

Parse a Prelude flat XML file to a Python dictionary.

from prelude_parser import parse_to_dict
data = parse_to_dict("physical_examination.xml")

Parse a Prelude flat XML file into a list of Python class. The name of the class is taken from the form name node in the XML file converted to pascal case. For example a <physical_examination> node will result in a PhysicalExamination class being created.

from prelude_parser import parse_to_classes
data = parse_to_classes("physical_examination.xml")

Parse a Prelude flat XML file into a Pandas DataFrame. This works for Prelude flat XML files that were exported with the "write tables to seperate files" option. In order to use this option prelude-parser either needs to be installed with the pandas extra or the all extras.

from prelude_parser.pandas import to_dataframe
df = to_dataframe("physical_examination.xml")

Parse a Prelude flat XML file into a Polars DataFrame. This works for Prelude flat XML files that were exported with the "write tables to seperate files" option. In order to use this option prelude-parser either needs to be installed with the polars extra or the all extras.

from prelude_parser.polars import to_dataframe
df = to_dataframe("physical_examination.xml")

Contributing

Contributions to this project are welcome. If you are interesting in contributing please see our contributing guide

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

prelude_parser-0.4.0.tar.gz (19.9 kB view hashes)

Uploaded Source

Built Distributions

prelude_parser-0.4.0-cp38-abi3-win_amd64.whl (202.6 kB view hashes)

Uploaded CPython 3.8+ Windows x86-64

prelude_parser-0.4.0-cp38-abi3-win32.whl (201.6 kB view hashes)

Uploaded CPython 3.8+ Windows x86

prelude_parser-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

prelude_parser-0.4.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.2 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

prelude_parser-0.4.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.2 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

prelude_parser-0.4.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.1 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

prelude_parser-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

prelude_parser-0.4.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.5+ i686

prelude_parser-0.4.0-cp38-abi3-macosx_11_0_arm64.whl (318.5 kB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

prelude_parser-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl (321.7 kB view hashes)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

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