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 Inventorybdi_ii: Beck Depression Inventory IImoca: Montreal Cognitive Assessment (Version A)
Contributing a New Instrument
-
Fork this repository
-
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)
-
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
-
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b1e8aae583a4de2c5914ef76671ef5b17e6ab3e6f545fadc28f06669c192bf3
|
|
| MD5 |
43d36ef01d55c0b883cea018f867b567
|
|
| BLAKE2b-256 |
910df006f91fe8f880a968b0c991c33f2f3c0e122a94442f09ab2a98e276125d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
951f471c47d00bc6063b8bf40e0567ca7c6a37756b569d7f38d0aee1cce3c31c
|
|
| MD5 |
1632b6f11069b5739ac70916b3b686c3
|
|
| BLAKE2b-256 |
9953b34b183e87f75a4d9b4a31a425bb44983c7b00e80600df8227f53a43efb6
|