Metadata-Version: 2.4
Name: carp-analytics-python
Version: 0.2.0
Summary: A high-performance Python library for processing and analysing data from CARP (Copenhagen Research Platform) clinical studies
Project-URL: Homepage, https://carp.dk
Project-URL: Documentation, https://docs.carp.dk
Project-URL: Repository, https://github.com/carp-dk/carp-analytics-python.git
Project-URL: Issues, https://github.com/carp-dk/carp-analytics-python/issues
Project-URL: Changelog, https://github.com/carp-dk/carp-analytics-python/blob/main/CHANGELOG.md
Author-email: CARP Team <support@carp.dk>
Maintainer-email: CARP Team <support@carp.dk>
License-Expression: MIT
License-File: LICENSE
Keywords: carp,clinical-studies,data-processing,health-data,json-streaming,mhealth,pandas,parquet,research
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: ijson>=3.2.0
Requires-Dist: rich>=13.0.0
Requires-Dist: tqdm>=4.65.0
Provides-Extra: all
Requires-Dist: folium>=0.14.0; extra == 'all'
Requires-Dist: matplotlib>=3.7.0; extra == 'all'
Requires-Dist: numba>=0.57.0; extra == 'all'
Requires-Dist: numpy>=1.24.0; extra == 'all'
Requires-Dist: pandas>=2.0.0; extra == 'all'
Requires-Dist: pyarrow>=14.0.0; extra == 'all'
Requires-Dist: scikit-learn>=1.3.0; extra == 'all'
Requires-Dist: scipy>=1.10.0; extra == 'all'
Provides-Extra: pandas
Requires-Dist: pandas>=2.0.0; extra == 'pandas'
Requires-Dist: pyarrow>=14.0.0; extra == 'pandas'
Provides-Extra: science
Requires-Dist: numpy>=1.24.0; extra == 'science'
Requires-Dist: scikit-learn>=1.3.0; extra == 'science'
Requires-Dist: scipy>=1.10.0; extra == 'science'
Provides-Extra: viz
Requires-Dist: folium>=0.14.0; extra == 'viz'
Requires-Dist: matplotlib>=3.7.0; extra == 'viz'
Description-Content-Type: text/markdown

# CARP Analytics Python

[![PyPI version](https://badge.fury.io/py/carp-analytics-python.svg)](https://badge.fury.io/py/carp-analytics-python)
[![Python versions](https://img.shields.io/pypi/pyversions/carp-analytics-python.svg)](https://pypi.org/project/carp-analytics-python/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

`carp-analytics-python` is a Python library for working with CARP study data. It focuses on streaming JSON records, participant lookup, schema discovery, export, parquet conversion, and optional plotting.

## Quick Start

```python
from carp import CarpStudy

study = CarpStudy("sleep-data/phase-1-1/data-streams.json")
print(study.records.count())
print(study.participants.summary_rows()[0])
```

## Main API

`CarpStudy` is the primary entrypoint.

```python
from carp import CarpStudy

study = CarpStudy([
    "sleep-data/phase-1-1/data-streams.json",
    "sleep-data/phase-2-1/data-streams.json",
])

study.schema.scan()
study.export.export_json("output.json", data_type="dk.cachet.carp.stepcount")
study.frames.convert_to_parquet("output_parquet")
study.participant("alice@example.com").info()
```

## CLI

```bash
carp schema sleep-data/phase-1-1/data-streams.json
carp count sleep-data/phase-1-1/data-streams.json
carp participants sleep-data/phase-1-1/data-streams.json
carp export sleep-data/phase-1-1/data-streams.json -o output.json -t dk.cachet.carp.stepcount
carp group sleep-data/phase-1-1/data-streams.json -o grouped_output
carp convert sleep-data/phase-1-1/data-streams.json -o output_parquet
```

## Documentation

The docs are built with Sphinx, `autodoc`, and `napoleon`.

```bash
python -m pip install sphinx sphinx-rtd-theme
sphinx-build -b html docs docs/_build/html
```

## Examples

```bash
python examples/main.py sleep-data/phase-1-1/data-streams.json
python examples/disc.py sleep-data/phase-1-1/data-streams.json
```

## Optional Dependencies

`pandas` and `pyarrow` enable dataframe and parquet support. `folium` enables plotting.
