Skip to main content

Functions to clean and prepare data for down-stream analyses.

Project description

Data cleaning package

version: 0.2.1

This repository collects python modules to clean and prepare data for downstream analyses or presentation in reports. For example, the module contains functionality to created formatted publication ready baseline tables or supplementary excel tables.

Please consult the package documentation.

Installation

At present, the repository is undergoing development and no packages exist yet on PyPy or in Conda. Therefore it is recommended that it is installed in either of the two ways listed below. First, clone this repository and then cd to the root of the repository.

git clone git@gitlab.com:SchmidtAF/clean-data.git
cd clean-data

Installation using conda dependencies

A conda environment is provided in a yaml file in the directory ./resources/conda/. A new conda environment called clean-data can be built using the command:

# From the root of the repository
conda env create --file ./resources/conda/envs/conda_create.yaml

To add to an existing environment use:

# From the root of the repository
conda env update --file ./resources/conda/envs/conda_update.yaml

Next the package can be installed:

make install

Development

For development work, install the package in editable mode with Git commit hooks configured:

make install-dev

This command installs the package in editable mode and configures Git commit hooks, allowing you to run git pull to update the repository or switch branches without reinstalling.

Alternatively, you can install manually:

python -m pip install -e .
python .setup_git_hooks.py

Git Hooks Configuration

When setting up a development environment, the setup-hooks command configures Git hooks to enforce conventional commit message formatting and spell check using codespell.

To view the commit message format requirements, run:

./.githooks/commit-msg -help

For frequent use, add this function to your shell configuration (~/.bashrc or ~/.zshrc):

commit-format-help() {
    local git_root
    git_root=$(git rev-parse --show-toplevel 2>/dev/null)
    
    if [ -z "$git_root" ]; then
        echo "Error: Not inside a git repository"
        return 1
    fi
    
    local hook_path="$git_root/.githooks/commit-msg"
    
    if [ ! -f "$hook_path" ]; then
        echo "Error: commit-msg hook not found"
        return 1
    fi
    
    "$hook_path" --help
}

If you have already installed the package in editable mode without running _setup_git_hooks.py, you can configure the hooks manually at any time by running:

_setup_git_hooks.py

Validating the package

After installing the package from GitLab, you may wish to run the test suite to confirm everything is working as expected:

# From the root of the repository
pytest tests

Usage

Please have a look at the examples in resources for some possible recipes.

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

clean_data_schmidtaf-0.2.1.tar.gz (74.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clean_data_schmidtaf-0.2.1-py3-none-any.whl (75.6 kB view details)

Uploaded Python 3

File details

Details for the file clean_data_schmidtaf-0.2.1.tar.gz.

File metadata

  • Download URL: clean_data_schmidtaf-0.2.1.tar.gz
  • Upload date:
  • Size: 74.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for clean_data_schmidtaf-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2662354c3c8431e9b616b930538494c3f1d7d47822ce05adb3d52cb05c06cb68
MD5 03f432462825bb6fa2f81ac684cc18ff
BLAKE2b-256 f34444d3b9c285d2c83e19c25ea5a9b0d444d24bae96c5c41bd64bf76f346eef

See more details on using hashes here.

File details

Details for the file clean_data_schmidtaf-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for clean_data_schmidtaf-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c2037ed01eadea7da2f7a8108dcbeef207d493c99c8ad23133d2fd30208c897
MD5 fe9bc25fe9d031e2eac02f91d6e4b3ff
BLAKE2b-256 980cafcf7b3dc615d726280e2ea24ccd680f28e11d10118fbd132af391b17f05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page