Skip to main content

No project description provided

Project description

Research Portal Client

Library to interact with Minder Research APIs.

Example

pip install minder.research-portal-client
import logging
import asyncio
import datetime
import sys
from minder.research_portal_client import Configuration, JobManager
from minder.research_portal_client.models import (
    ExportJobRequest,
    ExportJobRequestDataset,
)


logging.basicConfig(level=logging.INFO)

Configuration.set_default(
    Configuration(
        access_token="---REDACTED---",
    )
)


async def example1():
    async with JobManager() as job_manager:
        now = datetime.datetime.today()
        since = now - datetime.timedelta(days=7)
        datasets: dict(str, ExportJobRequestDataset) = {
            "patients": ExportJobRequestDataset(),
            "observation_notes": ExportJobRequestDataset(),
        }

        export_job = ExportJobRequest(since, datasets=datasets)
        job_id = await job_manager.submit(export_job)
        job = await job_manager.wait(job_id)
        files = await job_manager.download(job)
        print(files)


async def example2():
    job_id = "c25249e0-82ff-43d1-9676-f3cead0228b9"
    async with JobManager() as job_manager:
        files = await job_manager.download(job_id)
        print(files)


async def example3():
    async with JobManager() as job_manager:
        datasets = await job_manager.client.info.list_datasets()
        print(datasets)

        organizations = await job_manager.client.info.list_organizations()
        print(organizations)

        reports = await job_manager.client.reports.list_reports()
        print(reports)


async def main():
    await example1()
    await example2()
    await example3()


if sys.platform == "win32":
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

asyncio.run(main())

Development

Setup

uv sync

Run tests

uv run pytest

Code Coverage

This command consists of 2 parts:

  • running tests with coverage collection
  • formatting the report: report (text to stdout), xml (GitLab compatible: cobertura), html (visual)
uv run coverage run -m pytest && uv run coverage report -m

Linting

uv run flake8

Formatting

uv run black .

Type Checking

uv run mypy .

Publishing

uv publish --token pypi-…

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

minder_research_portal_client-0.1.10.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

minder_research_portal_client-0.1.10-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file minder_research_portal_client-0.1.10.tar.gz.

File metadata

File hashes

Hashes for minder_research_portal_client-0.1.10.tar.gz
Algorithm Hash digest
SHA256 573f2eb0374f4effba404c42a72c9c50d86444e1a73708e1acaee3f6f389703b
MD5 2e66dfa748cf8dc8d6e7ee2580f86477
BLAKE2b-256 460d24fff6bb630819824dd64eeb87a3d5db848590ce3acfb3587547a20eac21

See more details on using hashes here.

File details

Details for the file minder_research_portal_client-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for minder_research_portal_client-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a6163436b5e69e26d1299ecef09d58a42dbb71ff57261eb9c6946c0e56cd2c7d
MD5 a6cee1e9a3b47d0beb6e08bed6efc1d8
BLAKE2b-256 3a3a802cbff5106da3e4b8c91ec31385911bbef7219774e178c602b5bcb16953

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