Skip to content

Parses XML files exported from Prelude EDC into Python dictionaries, classes, Pandas data frames, or Polars data frames

License

Notifications You must be signed in to change notification settings

pbs-data-solutions/prelude-parser

Repository files navigation

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

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

About

Parses XML files exported from Prelude EDC into Python dictionaries, classes, Pandas data frames, or Polars data frames

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •