Skip to main content

A high-performance Python library for processing and analysing data from CARP (Copenhagen Research Platform) clinical studies

Project description

CARP Analytics Python

PyPI version Python versions License: 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

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.

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

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.

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

Examples

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.

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

carp_analytics_python-0.2.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

carp_analytics_python-0.2.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file carp_analytics_python-0.2.0.tar.gz.

File metadata

  • Download URL: carp_analytics_python-0.2.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for carp_analytics_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a58f22a18124993426ae7c7af7b408123b90ab32e0073fe0af94bac38b156aa
MD5 2d1ad55dced1cddef3717ea7e733080a
BLAKE2b-256 e80287789ddb8efb0dac9dd822309804651f96a24026f65676211fd5127b2ae6

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_analytics_python-0.2.0.tar.gz:

Publisher: release.yml on carp-dk/carp-analytics-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_analytics_python-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for carp_analytics_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1fabccfe1c6034ed22ba3b044e8898566054b7055ad1035596fd9c582924f91
MD5 457106033291747e306a130cd9c9b7f3
BLAKE2b-256 d259bbc92d5dd4ddc41b954c1b36eae4d1a9bacb4bae2465c079b747d9330b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_analytics_python-0.2.0-py3-none-any.whl:

Publisher: release.yml on carp-dk/carp-analytics-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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