Skip to main content

Perform exploratory data analysis on REDCap data

Project description

REDCap-EDA

CI Status

๐Ÿ“Œ Overview

REDCap-EDA is a command-line tool for performing Exploratory Data Analysis (EDA) on REDCap datasets. It automates data inspection, schema enforcement, statistical analysis, and visualization.

๐Ÿš€ Features

  • โœ… Automatic Data Type Enforcement (casts columns based on a predefined or user-defined schema)
  • ๐Ÿ“Š Summary Statistics (mean, median, std dev, outliers, categorical distributions)
  • ๐Ÿ“‰ Visualizations (histograms, box plots, categorical distributions, time trends)
  • ๐Ÿ”„ Multiprocessing for Faster Execution
  • ๐Ÿ” Progress Bars with tqdm
  • ๐Ÿ“‚ Exports Reports (JSON, CSV, and saved visualizations)
  • ๐Ÿ“ Interactive Schema Creation for custom datasets

๐Ÿ“ฆ Installation

# Clone the repository
git clone https://github.com/robertp/REDCap-EDA.git
cd REDCap-EDA

# Install dependencies using Poetry
poetry install

๐Ÿ› ๏ธ Usage

๐Ÿ”น Example Using the Sample Dataset and Interactive Schema Creation

poetry run redcap-eda analyze --sample

๐Ÿ”น Example Using the Sample Dataset with a Predefined Schema

poetry run redcap-eda analyze --sample --schema schemas/schema_sample_dataset.json

๐Ÿ”น Running EDA on a Custom Dataset with Interactive Schema Creation

poetry run redcap-eda analyze --csv path/to/your_data.csv

๐Ÿ”น Running EDA on a Custom Dataset with a Predefined Schema

poetry run redcap-eda analyze --csv path/to/your_data.csv --schema path/to/schema.json

๐Ÿ”น Running in Debug Mode

poetry run redcap-eda --debug analyze --sample

๐Ÿ”น Listing Available Test Cases

poetry run redcap-eda list-cases

๐Ÿ”น Interactive Testing with Makefile

# Explore a text-based column
make test-text

# Analyze numerical data
make test-numeric

# Inspect categorical variables
make test-categorical

# Run full exploratory analysis interactively
make test-eda

๐Ÿ“‚ Project Structure

.
โ”œโ”€โ”€ Makefile                # Helper commands
โ”œโ”€โ”€ README.md               # Project documentation
โ”œโ”€โ”€ mypy.ini                # Type checking configuration
โ”œโ”€โ”€ poetry.lock             # Poetry dependency lock file
โ”œโ”€โ”€ pyproject.toml          # Poetry project configuration
โ”œโ”€โ”€ schemas                 # Saved schema files
โ”‚   โ””โ”€โ”€ schema_sample_dataset.json
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ logs
โ”‚   โ”‚   โ””โ”€โ”€ redcap_eda.log  # Log files
โ”‚   โ””โ”€โ”€ redcap_eda
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ analysis        # EDA analysis modules
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ categorical
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ mixins.py
โ”‚       โ”‚   โ”œโ”€โ”€ datetime
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ mixins.py
โ”‚       โ”‚   โ”œโ”€โ”€ eda.py      # Main EDA module
โ”‚       โ”‚   โ”œโ”€โ”€ numerical
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ mixins.py
โ”‚       โ”‚   โ””โ”€โ”€ text
โ”‚       โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚       โ””โ”€โ”€ mixins.py
โ”‚       โ”œโ”€โ”€ cast_schema.py  # Schema enforcement
โ”‚       โ”œโ”€โ”€ cli.py          # Command-line interface
โ”‚       โ”œโ”€โ”€ load_case_data.py # Dataset loader
โ”‚       โ”œโ”€โ”€ logger.py       # Logging utilities
โ””โ”€โ”€ tests                   # Unit tests
    โ”œโ”€โ”€ __init__.py
    โ””โ”€โ”€ fixtures
        โ””โ”€โ”€ toy_data.csv    # Sample test data

๐Ÿ“ Contributing

  1. Fork the repository and create a feature branch.
  2. Run tests to ensure code integrity:
    poetry run pytest tests/
    
  3. Submit a pull request with a detailed description.

๐Ÿ“œ License

This project is licensed under the MIT License.

๐Ÿค Acknowledgments

  • REDCap for enabling structured data collection.
  • The Open Source Community for inspiration & contributions!

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

redcap_eda-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

redcap_eda-0.1.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file redcap_eda-0.1.0.tar.gz.

File metadata

  • Download URL: redcap_eda-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for redcap_eda-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2b5505a29171212f4cbd69d018d98e602019b4cf2e95de770b692ef00a7644b
MD5 6d0fba3b3825709cda4d250b21a5914b
BLAKE2b-256 6e4f3aa92209761aa0895f53c27eb875dd3ba470f4af6eaaa61a87279577a784

See more details on using hashes here.

File details

Details for the file redcap_eda-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: redcap_eda-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for redcap_eda-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5756224108a22c1aa36755d2351664ba80bd3ee700127bd599bf1307d0e4423
MD5 dfacc09c850378aea7a09e2c534940e4
BLAKE2b-256 4a018016c050c0a4e46d6196678332cb80c25ada716b328cbd27dd3bbbb0d067

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