lydata


Namelydata JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryLibrary for handling lymphatic involvement data
upload_time2025-07-12 09:54:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords data lymph involvement
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Library for Loading and Manipulating lyDATA Tables

[![Build](https://github.com/lycosystem/lydata-package/actions/workflows/release.yml/badge.svg)](https://github.com/lycosystem/lydata-package/actions/workflows/release.yml)
[![Tests](https://github.com/lycosystem/lydata-package/actions/workflows/tests.yml/badge.svg)](https://github.com/lycosystem/lydata-package/actions/workflows/tests.yml)
[![Documentation Status](https://readthedocs.org/projects/lydata/badge/?version=stable)](https://lydata.readthedocs.io/stable/?badge=stable)
[![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lycosystem/lydata-package/python-coverage-comment-action-data/endpoint.json)](https://htmlpreview.github.io/?https://github.com/lycosystem/lydata-package/blob/python-coverage-comment-action-data/htmlcov/index.html)

This repository provides a Python library for loading, manipulating, and validating the datasets available on [lyDATA](https://github.com/lycosystem/lydata).

> [!WARNING]
> This Python library is still highly experimental!
>
> Also, it has recently been spun off from the repository of datasets, [lyDATA](https://github.com/lycosystem/lydata), and some things might still not work as expected.

## Installation

### 1. Install from PyPI

You can install the library from PyPI using pip:

```bash
pip install lydata
```

### 2. Install from Source

If you want to install the library from source, you can clone the repository and install it using pip:

```bash
git clone https://github.com/lycosystem/lydata-package
cd lydata-package
pip install -e .
```

## Usage

The first and most common use case would probably listing and loading the published datasets:

```python
>>> import lydata
>>> for dataset_spec in lydata.available_datasets(
...     year=2023,              # show all datasets added in 2023
...     ref="61a17e",           # may be some specific hash/tag/branch
... ):
...     print(dataset_spec.name)
2023-clb-multisite
2023-isb-multisite

# return generator of datasets that include oropharyngeal tumor patients
>>> first_dataset = next(lydata.load_datasets(subsite="oropharynx"))
>>> print(first_dataset.head())
... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
  patient                              ... positive_dissected
        #                              ...             contra
       id         institution     sex  ...                III   IV    V
0    P011  Centre Léon Bérard    male  ...                0.0  0.0  0.0
1    P012  Centre Léon Bérard  female  ...                0.0  0.0  0.0
2    P014  Centre Léon Bérard    male  ...                0.0  0.0  NaN
3    P015  Centre Léon Bérard    male  ...                0.0  0.0  NaN
4    P018  Centre Léon Bérard    male  ...                NaN  NaN  NaN
[5 rows x 82 columns]

```

And since the three-level header of the tables is a little unwieldy at times, we also provide some shortcodes via a custom pandas accessor. As soon as `lydata` is imported it can be used like this:

```python
>>> print(first_dataset.ly.age)
... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
0      67
1      62
      ...
261    60
262    60
Name: (patient, #, age), Length: 263, dtype: int64

```

And we have implemented `Q` and `C` objects inspired by Django that allow easier querying of the tables:

```python
>>> from lydata import C

# select patients younger than 50 that are not HPV positive (includes NaNs)
>>> query_result = first_dataset.ly.query((C("age") < 50) & ~(C("hpv") == True))
>>> (query_result.ly.age < 50).all()
np.True_
>>> (query_result.ly.hpv == False).all()
np.True_

```

For more details and further examples or use-cases, have a look at the [official documentation](https://lydata.readthedocs.org/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lydata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "data, lymph, involvement",
    "author": null,
    "author_email": "Roman Ludwig <roman.ludwig@usz.ch>",
    "download_url": "https://files.pythonhosted.org/packages/bc/35/507ed3c535446fcea0e4a179ab22d1dd812afa2418f2b376a9064c43768a/lydata-0.3.1.tar.gz",
    "platform": null,
    "description": "# Python Library for Loading and Manipulating lyDATA Tables\n\n[![Build](https://github.com/lycosystem/lydata-package/actions/workflows/release.yml/badge.svg)](https://github.com/lycosystem/lydata-package/actions/workflows/release.yml)\n[![Tests](https://github.com/lycosystem/lydata-package/actions/workflows/tests.yml/badge.svg)](https://github.com/lycosystem/lydata-package/actions/workflows/tests.yml)\n[![Documentation Status](https://readthedocs.org/projects/lydata/badge/?version=stable)](https://lydata.readthedocs.io/stable/?badge=stable)\n[![Coverage badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lycosystem/lydata-package/python-coverage-comment-action-data/endpoint.json)](https://htmlpreview.github.io/?https://github.com/lycosystem/lydata-package/blob/python-coverage-comment-action-data/htmlcov/index.html)\n\nThis repository provides a Python library for loading, manipulating, and validating the datasets available on [lyDATA](https://github.com/lycosystem/lydata).\n\n> [!WARNING]\n> This Python library is still highly experimental!\n>\n> Also, it has recently been spun off from the repository of datasets, [lyDATA](https://github.com/lycosystem/lydata), and some things might still not work as expected.\n\n## Installation\n\n### 1. Install from PyPI\n\nYou can install the library from PyPI using pip:\n\n```bash\npip install lydata\n```\n\n### 2. Install from Source\n\nIf you want to install the library from source, you can clone the repository and install it using pip:\n\n```bash\ngit clone https://github.com/lycosystem/lydata-package\ncd lydata-package\npip install -e .\n```\n\n## Usage\n\nThe first and most common use case would probably listing and loading the published datasets:\n\n```python\n>>> import lydata\n>>> for dataset_spec in lydata.available_datasets(\n...     year=2023,              # show all datasets added in 2023\n...     ref=\"61a17e\",           # may be some specific hash/tag/branch\n... ):\n...     print(dataset_spec.name)\n2023-clb-multisite\n2023-isb-multisite\n\n# return generator of datasets that include oropharyngeal tumor patients\n>>> first_dataset = next(lydata.load_datasets(subsite=\"oropharynx\"))\n>>> print(first_dataset.head())\n... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n  patient                              ... positive_dissected\n        #                              ...             contra\n       id         institution     sex  ...                III   IV    V\n0    P011  Centre L\u00e9on B\u00e9rard    male  ...                0.0  0.0  0.0\n1    P012  Centre L\u00e9on B\u00e9rard  female  ...                0.0  0.0  0.0\n2    P014  Centre L\u00e9on B\u00e9rard    male  ...                0.0  0.0  NaN\n3    P015  Centre L\u00e9on B\u00e9rard    male  ...                0.0  0.0  NaN\n4    P018  Centre L\u00e9on B\u00e9rard    male  ...                NaN  NaN  NaN\n[5 rows x 82 columns]\n\n```\n\nAnd since the three-level header of the tables is a little unwieldy at times, we also provide some shortcodes via a custom pandas accessor. As soon as `lydata` is imported it can be used like this:\n\n```python\n>>> print(first_dataset.ly.age)\n... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n0      67\n1      62\n      ...\n261    60\n262    60\nName: (patient, #, age), Length: 263, dtype: int64\n\n```\n\nAnd we have implemented `Q` and `C` objects inspired by Django that allow easier querying of the tables:\n\n```python\n>>> from lydata import C\n\n# select patients younger than 50 that are not HPV positive (includes NaNs)\n>>> query_result = first_dataset.ly.query((C(\"age\") < 50) & ~(C(\"hpv\") == True))\n>>> (query_result.ly.age < 50).all()\nnp.True_\n>>> (query_result.ly.hpv == False).all()\nnp.True_\n\n```\n\nFor more details and further examples or use-cases, have a look at the [official documentation](https://lydata.readthedocs.org/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Library for handling lymphatic involvement data",
    "version": "0.3.1",
    "project_urls": {
        "documentation": "https://lydata.readthedocs.io",
        "source": "https://github.com/lycosystem/lydata-package"
    },
    "split_keywords": [
        "data",
        " lymph",
        " involvement"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b3f88e9aba1cf27fa58ff8b57f3d7bd9061b2cd44f986d3f28dccc447d01884e",
                "md5": "d242fcb2cf2996a119000a130577a044",
                "sha256": "2aaaf76e9447be5c797a817df66c020e2b2989697bc3baa750c97146898ac9d0"
            },
            "downloads": -1,
            "filename": "lydata-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d242fcb2cf2996a119000a130577a044",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 23872,
            "upload_time": "2025-07-12T09:54:09",
            "upload_time_iso_8601": "2025-07-12T09:54:09.321422Z",
            "url": "https://files.pythonhosted.org/packages/b3/f8/8e9aba1cf27fa58ff8b57f3d7bd9061b2cd44f986d3f28dccc447d01884e/lydata-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bc35507ed3c535446fcea0e4a179ab22d1dd812afa2418f2b376a9064c43768a",
                "md5": "b836b5afc746a731cc91587ed7ad3f3c",
                "sha256": "bdb7bdbf641aa7c79169044f60775a7767b67c6a2bc3227f6d19ce5acc333eaf"
            },
            "downloads": -1,
            "filename": "lydata-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b836b5afc746a731cc91587ed7ad3f3c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 106754,
            "upload_time": "2025-07-12T09:54:10",
            "upload_time_iso_8601": "2025-07-12T09:54:10.904271Z",
            "url": "https://files.pythonhosted.org/packages/bc/35/507ed3c535446fcea0e4a179ab22d1dd812afa2418f2b376a9064c43768a/lydata-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-12 09:54:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lycosystem",
    "github_project": "lydata-package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lydata"
}
        
Elapsed time: 0.48485s