Skip to main content

Pandas DataFrame templates for REDCap instruments, with stacking and upload functionality.

Project description

rcol

rcol (RedCap Uni Oldenburg) is a Python package that provides Pandas DataFrame templates for REDCap instruments with stacking and upload functionality.

Installation

pip install rcol

Quick Start

from rcol.instruments import fal, ehi, bdi_ii
import pandas as pd

# Use individual instruments
print(f"FAL has {len(fal)} fields")
print(f"EHI has {len(ehi)} fields") 
print(f"BDI-II has {len(bdi_ii)} fields")

# Stack multiple instruments for REDCap upload
all_instruments = pd.concat([fal, ehi, bdi_ii], ignore_index=True)
print(f"Combined: {len(all_instruments)} total fields")

# Upload to REDCap (requires PyCap and API credentials)
from redcap import Project
project = Project(api_url, api_token)
project.import_metadata(all_instruments, import_format='df')

Available Instruments

  • fal: Fragebogen zur Allgemeinen Leistungsfähigkeit (General Performance Questionnaire)
  • ehi: Edinburgh Handedness Inventory
  • bdi_ii: Beck Depression Inventory II
  • moca: Montreal Cognitive Assessment (Version A)

Contributing a New Instrument

  1. Fork this repository

  2. Add your instrument data in src/rcol/instruments.py:

    # Define your instrument fields
    my_instrument_data = [
        {
            "field_name": "record_id",
            "form_name": "my_instrument", 
            "field_type": "text",
            "field_label": "Record ID",
            # ... other REDCap metadata fields
        },
        # ... more fields
    ]
    
    # Create DataFrame
    my_instrument = pd.DataFrame(my_instrument_data)
    
  3. Add a test in tests/test_templates.py:

    def test_my_instrument():
        assert "record_id" in my_instrument.columns
        assert "my_field" in my_instrument.columns
    
  4. Submit a pull request with your instrument and test

Development

# Clone and install for development
git clone https://github.com/JuliusWelzel/rcol.git
cd rcol
uv sync

# Run tests
uv run pytest

# Build package
uv build

License

MIT

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

rcol-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

rcol-0.0.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file rcol-0.0.2.tar.gz.

File metadata

  • Download URL: rcol-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for rcol-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9b1e8aae583a4de2c5914ef76671ef5b17e6ab3e6f545fadc28f06669c192bf3
MD5 43d36ef01d55c0b883cea018f867b567
BLAKE2b-256 910df006f91fe8f880a968b0c991c33f2f3c0e122a94442f09ab2a98e276125d

See more details on using hashes here.

File details

Details for the file rcol-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: rcol-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for rcol-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 951f471c47d00bc6063b8bf40e0567ca7c6a37756b569d7f38d0aee1cce3c31c
MD5 1632b6f11069b5739ac70916b3b686c3
BLAKE2b-256 9953b34b183e87f75a4d9b4a31a425bb44983c7b00e80600df8227f53a43efb6

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