Skip to main content

No project description provided

Project description

minder.research-data-snapshots

Install

python -m pip install minder.research-data-snapshots

This will provide exports in Parquet format, which should be sufficient if you're using Pandas or another dataframe library.

If you require exports in CSV format then use:

python -m pip install 'minder.research-data-snapshots[csv]'

Use

First retrieve an access token from https://research.minder.care/

Then use one of the following methods to retrieve data snapshots

CLI

python -m minder.research_data_snapshots --dataset patients raw_heart_rate --organization SABP "H&F" --token-path /path/to/access/token

Run python -m minder.research_data_snapshots --help to see all options

Library

python -m pip install 'pandas[parquet]'
export RESEARCH_PORTAL_TOKEN_PATH=/path/to/access/token
import tempfile
from datetime import datetime
from pathlib import Path

import pandas as pd

from minder.research_data_snapshots import download_datasets

path = download_datasets(["patients"], ["SABP"])[0]
df = pd.read_parquet(path)
print(df)

folder = Path(tempfile.gettempdir()) / "research-data-snapshots"
download_datasets(["patients", "raw_heart_rate"], folder=folder)
df = (
    pd.read_parquet(
        folder / "raw_heart_rate",
        filters=[
            ("start_date", ">=", datetime.fromisoformat("2023-01-01T00Z")),
            ("start_date", "<", datetime.fromisoformat("2024-01-01T00Z")),
        ],
        columns=["patient_id", "start_date", "value"],
    )
    .sort_values("start_date")
    .reset_index(drop=True)
)
print(df)

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

File details

Details for the file minder_research_data_snapshots-0.20.0.tar.gz.

File metadata

File hashes

Hashes for minder_research_data_snapshots-0.20.0.tar.gz
Algorithm Hash digest
SHA256 3e7ec48369a9fbac0aeb0703ec1ff93391d641a6a85bcd865bf995ed6fc6bb73
MD5 e264c246fd1c88eba25f7a6799a2af45
BLAKE2b-256 96176dce7ef9bf868aaf2d6b4a085482f7bf5a34cab3aad4511694ccac62408f

See more details on using hashes here.

File details

Details for the file minder.research_data_snapshots-0.20.0-py3-none-any.whl.

File metadata

File hashes

Hashes for minder.research_data_snapshots-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 135a77a9ee7acb48a3a7b26a9c5f083c7d37c16569a882c0372c28d956ba8759
MD5 d16302eda7f3d66eaf896bc45296762f
BLAKE2b-256 b503c4e39827fb600c07f96c05d106cd349f7940d7999b128051442a73b288ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page