# Prelude Parser
[![Tests Status](https://github.com/pbs-data-solutions/prelude-parser/workflows/Testing/badge.svg?branch=main&event=push)](https://github.com/pbs-data-solutions/prelude-parser/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pbs-data-solutions/prelude-parser/main.svg)](https://results.pre-commit.ci/latest/github/pbs-data-solutions/prelude-parser/main)
[![Coverage](https://codecov.io/github/pbs-data-solutions/prelude-parser/coverage.svg?branch=main)](https://codecov.io/gh/pbs-data-solutions/prelude-parser)
[![PyPI version](https://badge.fury.io/py/prelude-parser.svg)](https://badge.fury.io/py/prelude-parser)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/prelude-parser?color=5cc141)](https://github.com/pbs-data-solutions/prelude-parser)
Parses XML files exported from [Prelude EDC](https://preludeedc.com/) into formats Python can use.
## Installation
```sh
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.
```sh
pip install prelude-parser[pandas]
```
Optionally the `polars` extra can be installed to parse to a Polars `DataFrame`
```sh
pip install prelude-parser[polars]
```
All extras can be install with
```sh
pip install prelude-parser[all]
```
## Usage
Parse a Prelude flat XML file to a Python dictionary.
```py
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.
```py
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.
```py
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.
```py
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](CONTRIBUTING.md)
Raw data
{
"_id": null,
"home_page": "https://github.com/pbs-data-solutions/prelude-parser",
"name": "prelude-parser",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "parser,prelude-edc,xml,pandas,polars",
"author": null,
"author_email": "Paul Sanders <paul@pbsdatasolutions.com>",
"download_url": "https://files.pythonhosted.org/packages/3f/14/dc4cad017739f2f79a6e471c21521b26faed8de60c33ce4a23425cc90351/prelude_parser-0.3.2.tar.gz",
"platform": null,
"description": "# Prelude Parser\n\n[![Tests Status](https://github.com/pbs-data-solutions/prelude-parser/workflows/Testing/badge.svg?branch=main&event=push)](https://github.com/pbs-data-solutions/prelude-parser/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pbs-data-solutions/prelude-parser/main.svg)](https://results.pre-commit.ci/latest/github/pbs-data-solutions/prelude-parser/main)\n[![Coverage](https://codecov.io/github/pbs-data-solutions/prelude-parser/coverage.svg?branch=main)](https://codecov.io/gh/pbs-data-solutions/prelude-parser)\n[![PyPI version](https://badge.fury.io/py/prelude-parser.svg)](https://badge.fury.io/py/prelude-parser)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/prelude-parser?color=5cc141)](https://github.com/pbs-data-solutions/prelude-parser)\n\nParses XML files exported from [Prelude EDC](https://preludeedc.com/) into formats Python can use.\n\n## Installation\n\n```sh\npip install prelude-parser\n```\n\nOptionally the `pandas` extra can be installed to parse to a Pandas `DataFrame`\n\nNote: Pandas only supports Python 3.9+ so this is not available in Python 3.8.\n\n```sh\npip install prelude-parser[pandas]\n```\n\nOptionally the `polars` extra can be installed to parse to a Polars `DataFrame`\n\n```sh\npip install prelude-parser[polars]\n```\n\nAll extras can be install with\n\n```sh\npip install prelude-parser[all]\n```\n\n## Usage\n\nParse a Prelude flat XML file to a Python dictionary.\n\n```py\nfrom prelude_parser import parse_to_dict\ndata = parse_to_dict(\"physical_examination.xml\")\n```\n\nParse a Prelude flat XML file into a list of Python class. The name of the class is taken from the\nform name node in the XML file converted to pascal case. For example a <physical_examination> node\nwill result in a PhysicalExamination class being created.\n\n```py\nfrom prelude_parser import parse_to_classes\ndata = parse_to_classes(\"physical_examination.xml\")\n```\n\nParse a Prelude flat XML file into a Pandas DataFrame. This works for Prelude flat XML files that\nwere exported with the \"write tables to seperate files\" option. In order to use this option\n`prelude-parser` either needs to be installed with the `pandas` extra or the `all` extras.\n\n```py\nfrom prelude_parser.pandas import to_dataframe\ndf = to_dataframe(\"physical_examination.xml\")\n```\n\nParse a Prelude flat XML file into a Polars DataFrame. This works for Prelude flat XML files that\nwere exported with the \"write tables to seperate files\" option. In order to use this option\n`prelude-parser` either needs to be installed with the `polars` extra or the `all` extras.\n\n```py\nfrom prelude_parser.polars import to_dataframe\ndf = to_dataframe(\"physical_examination.xml\")\n```\n\n## Contributing\n\nContributions to this project are welcome. If you are interesting in contributing please see our [contributing guide](CONTRIBUTING.md)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Parses XML files exported from Prelude EDC into formats usable by Python.",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://github.com/pbs-data-solutions/prelude-parser",
"Source Code": "https://github.com/pbs-data-solutions/prelude-parser"
},
"split_keywords": [
"parser",
"prelude-edc",
"xml",
"pandas",
"polars"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "08541d815c26e95cf5ef9a0a2032e015c066269d45c615c44263da9466e1abe7",
"md5": "49c78b0ff480b0127af463dfe92f1269",
"sha256": "0fb70a3493858e4a401b286dfda0ae27bca288dc4d15b996cfa9136137493fef"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-macosx_10_7_x86_64.whl",
"has_sig": false,
"md5_digest": "49c78b0ff480b0127af463dfe92f1269",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 351358,
"upload_time": "2023-10-07T01:24:45",
"upload_time_iso_8601": "2023-10-07T01:24:45.371112Z",
"url": "https://files.pythonhosted.org/packages/08/54/1d815c26e95cf5ef9a0a2032e015c066269d45c615c44263da9466e1abe7/prelude_parser-0.3.2-cp38-abi3-macosx_10_7_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ff9f1f14b0c2cb6557af009fc2a314f70baf51bfef52e9bf62c2bfa5c29127c9",
"md5": "273b78a12a3897604fc7e1da93520b19",
"sha256": "234778b062a8912bf61a44f5444ea646b64d9d9b3a255ffab5d4792fc0bf0b1c"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "273b78a12a3897604fc7e1da93520b19",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 346033,
"upload_time": "2023-10-07T01:24:47",
"upload_time_iso_8601": "2023-10-07T01:24:47.339463Z",
"url": "https://files.pythonhosted.org/packages/ff/9f/1f14b0c2cb6557af009fc2a314f70baf51bfef52e9bf62c2bfa5c29127c9/prelude_parser-0.3.2-cp38-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c9662c8f15fc337a975fb288e18ed64610877d66d02d6cfdde9b44bca26376c9",
"md5": "4c477721ed39237ec17f59f680984715",
"sha256": "54d5e77d6de946277cdc6561ff6af18f878a11c572dd2fe5d2c7d1de96c075a8"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "4c477721ed39237ec17f59f680984715",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1235544,
"upload_time": "2023-10-07T01:24:49",
"upload_time_iso_8601": "2023-10-07T01:24:49.089260Z",
"url": "https://files.pythonhosted.org/packages/c9/66/2c8f15fc337a975fb288e18ed64610877d66d02d6cfdde9b44bca26376c9/prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2749e3e2867c295e588af985ebaa8c520074ac0d18fb2bbcd8d81d03e8726005",
"md5": "e07c70df4b7957362f224034400c2188",
"sha256": "a4a6184e8779b8228eabfab9c6e5a03699a6f111fb0adfe39136fde279036a30"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"has_sig": false,
"md5_digest": "e07c70df4b7957362f224034400c2188",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1244068,
"upload_time": "2023-10-07T01:24:50",
"upload_time_iso_8601": "2023-10-07T01:24:50.926861Z",
"url": "https://files.pythonhosted.org/packages/27/49/e3e2867c295e588af985ebaa8c520074ac0d18fb2bbcd8d81d03e8726005/prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "76d409256ea0bc6f6e99f75b7cfa5ed043703ec423d2e5dcca1737138cab2baf",
"md5": "18750490a54afbb5ea2a948160473514",
"sha256": "0b913a63abb5844710c4a08836dcf29af3ede50e103ca9a3107ee7d87c2fb377"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "18750490a54afbb5ea2a948160473514",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1372423,
"upload_time": "2023-10-07T01:24:52",
"upload_time_iso_8601": "2023-10-07T01:24:52.721793Z",
"url": "https://files.pythonhosted.org/packages/76/d4/09256ea0bc6f6e99f75b7cfa5ed043703ec423d2e5dcca1737138cab2baf/prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "753dc8b5fa44084b25aae42912a6a03283e28e6060e390489e06ee711652862f",
"md5": "da3579324c2accc4add6dda7447dcf6c",
"sha256": "bc19992525561c45824374a4020454d3008fd876310e55ebe1387c86afcf4c65"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "da3579324c2accc4add6dda7447dcf6c",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1439872,
"upload_time": "2023-10-07T01:24:54",
"upload_time_iso_8601": "2023-10-07T01:24:54.080326Z",
"url": "https://files.pythonhosted.org/packages/75/3d/c8b5fa44084b25aae42912a6a03283e28e6060e390489e06ee711652862f/prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e508ed1c98932d90dfe59bcda91a1b08153e57bc69ce51bbffd3e137677ddff7",
"md5": "35ed29e99823ac591272730f7cdf8c77",
"sha256": "e829de988164546111a1e28b2c9f83e0bc9e53f578a124e5af3291df68b5f36d"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "35ed29e99823ac591272730f7cdf8c77",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1241993,
"upload_time": "2023-10-07T01:24:55",
"upload_time_iso_8601": "2023-10-07T01:24:55.978087Z",
"url": "https://files.pythonhosted.org/packages/e5/08/ed1c98932d90dfe59bcda91a1b08153e57bc69ce51bbffd3e137677ddff7/prelude_parser-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "08437233ded997e3f4fa0f914d10654512c4b8f06d4c58a0c2485e1d87bcbebd",
"md5": "9965e1684fa94d2388737cb989152428",
"sha256": "89690d7fc021e5a4874a4e5f15115e772fa3489e323dbcbec4d035cfde1dd781"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "9965e1684fa94d2388737cb989152428",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1270694,
"upload_time": "2023-10-07T01:24:57",
"upload_time_iso_8601": "2023-10-07T01:24:57.474673Z",
"url": "https://files.pythonhosted.org/packages/08/43/7233ded997e3f4fa0f914d10654512c4b8f06d4c58a0c2485e1d87bcbebd/prelude_parser-0.3.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cdd8eed460150ef39177981cacd6bedb47767d47232e5ddf8d1c00b9cc01f3d5",
"md5": "c7f39d7b86a32f39786e80fb6b36ef76",
"sha256": "19edc4307fa15cc0331e68a15c40bfc460e44c5d33fecd2d3d2c5301d8f55c4e"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-win32.whl",
"has_sig": false,
"md5_digest": "c7f39d7b86a32f39786e80fb6b36ef76",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 207982,
"upload_time": "2023-10-07T01:24:59",
"upload_time_iso_8601": "2023-10-07T01:24:59.573441Z",
"url": "https://files.pythonhosted.org/packages/cd/d8/eed460150ef39177981cacd6bedb47767d47232e5ddf8d1c00b9cc01f3d5/prelude_parser-0.3.2-cp38-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "82e0bcbd69bfc86ba241132a80a5f57d3bbf0dfdaf6487f68ee519db1329780c",
"md5": "6421f3f759b6ee9e48cb7608d29f0103",
"sha256": "4a66ffb873b1e4ec713002e434af87873cd2c0db3d725dcef6c27a2647867b41"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "6421f3f759b6ee9e48cb7608d29f0103",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 212569,
"upload_time": "2023-10-07T01:25:01",
"upload_time_iso_8601": "2023-10-07T01:25:01.351188Z",
"url": "https://files.pythonhosted.org/packages/82/e0/bcbd69bfc86ba241132a80a5f57d3bbf0dfdaf6487f68ee519db1329780c/prelude_parser-0.3.2-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3f14dc4cad017739f2f79a6e471c21521b26faed8de60c33ce4a23425cc90351",
"md5": "e788e6613cc1797729ff196afd5e4b03",
"sha256": "ab2a50142f86786b625bb223d281d0ff700b2830ca9b4adab8cc05f1dd231a51"
},
"downloads": -1,
"filename": "prelude_parser-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "e788e6613cc1797729ff196afd5e4b03",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18500,
"upload_time": "2023-10-07T01:25:03",
"upload_time_iso_8601": "2023-10-07T01:25:03.166415Z",
"url": "https://files.pythonhosted.org/packages/3f/14/dc4cad017739f2f79a6e471c21521b26faed8de60c33ce4a23425cc90351/prelude_parser-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-07 01:25:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pbs-data-solutions",
"github_project": "prelude-parser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "prelude-parser"
}