LivingPark utils
A collection of utility functions to write LivingPark notebooks.
Usage examples:
import livingpark_utils
from livingpark_utils import download
from livingpark_utils.clinical import moca2mmse
from livingpark_utils.dataset import ppmi
utils = livingpark_utils.LivingParkUtils()
downloader = download.ppmi.Downloader(utils.study_files_dir)
utils.notebook_init()
utils.get_study_files(["Demographics.csv"], default=downloader)
utils.get_T1_nifti_files(
cohort, default=downloader
) # `cohort` is of type: pd.DataFrame
ppmi.find_nifti_file_in_cache(x["PATNO"], x["EVENT_ID"], x["Description"])
ppmi.disease_duration()
moca2mmse(2)
Exclude subjects from a cohort without leaking patient information.
from livingpark_utils.ignore import (
insert_hash,
remove_ignored,
)
# Assuming a cohort definition defined as `cohort`.
cohort = insert_hash(cohort, columns=["PATNO", "EVENT_ID", "Description"])
remove_ignored(cohort, ignore_file=".ppmiignore")
Usage to execute utility notebooks:
from livingpark_utils.scripts import run
run.mri_metadata()
run.pd_status()
Note: Optionally use the %%capture cell magic to further hide notebook outputs.
CLI commands
Download T1 nifti files using a cohort definition file.
$ get_T1_nifti_files <cohort_file> --downloader (ppmi) [--symlink=<bool>]
[--force=<bool>] [--timeout=<int>]
The cohort_file is a csv file created beforehand. Respectively to the chosen downloader, it must have the following columns:
- PPMI:
PATNO,EVENT_ID, andDescription.
Troubleshooting
Permission issues on Windows
We use symbolic links when creating the folder for cached data. Unfortunately, by default, Windows does not authorize users to create symbolic links. To fix this issue on your machine, please follow the guide from this blog post.
Contributing guidelines
We welcome contributions of any kind in the form of Pull-Request to this repository. See also LivingPark contributing guidelines.
Make sure to:
- Use Python type annotations
- Include Python docstrings using numpydoc format for all functions
- Format docstrings
- Run
psf/blackon the files you modify - Run
pre-commit run --allbefore committing, this will be checked in your PR
Metadata
Release files for livingpark-utils 0.9.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| livingpark_utils-0.9.5.tar.gz | 56.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| livingpark_utils-0.9.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 125.8 kB
Release files / livingpark_utils-0.9.5.tar.gz
| Download URL | livingpark_utils-0.9.5.tar.gz |
|---|---|
| Size | 56.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaa431e24f2a6f19c10221544f8badac13177b3cfafa52ff361c36cb36efcdb0
|
|
BLAKE2b-256 checksum How to use checksums |
cec827dd54213b8feacfc63bba6a83d0acb38eb516710cb05482fa028aaf0b21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / livingpark_utils-0.9.5-py3-none-any.whl
| Download URL | livingpark_utils-0.9.5-py3-none-any.whl |
|---|---|
| Size | 69.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1a9b32327f2b5d8d53723de53ce8657c8a54eadaf1dc0af9476876766f0bd9a
|
|
BLAKE2b-256 checksum How to use checksums |
6179a7fa0f6f90ab2b4475d796b18a56e4efb174391be39ca0a44374f0a6615a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Security for livingpark-utils 0.9.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.