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 platform
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 platform.system() == "Windows":
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

asyncio.run(main())

Development

Useful commands

Setup

poetry install

Run tests

poetry 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)
poetry run coverage run -m pytest && poetry run coverage report -m

Linting

poetry run flake8

Formatting

poetry run black .

Type Checking

poetry run mypy .

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.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file minder.research_portal_client-0.1.2.tar.gz.

File metadata

File hashes

Hashes for minder.research_portal_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 244c561f7b8950c6db54c20f7c639c421515c019308f84d0678fdce548e07d9d
MD5 55aac099208fba742a6a2d20e0f06938
BLAKE2b-256 b85d9aaef7bced5a5205ed2b495abd86a86c279f4c8be88a20d9a58d2a8af0be

See more details on using hashes here.

File details

Details for the file minder.research_portal_client-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for minder.research_portal_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 853663845d3a0070b2935239d2ffac837f65558f1b3650c91bd8f77296a5bdc8
MD5 d1a2d756dbe191400095669a8ad3e9a0
BLAKE2b-256 febd9d0d4bafedaeeb4ac079486574176913ce928f2c9a4e41a299baa81ca99e

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