Skip to main content

No project description provided

Project description

Research Portal Client

Library to interact with Minder Research APIs.

Example

import logging
import asyncio
import datetime
from minder.research_portal_client import Configuration, JobManager
from minder.research_portal_client.models import ExportJobRequest, ExportJobRequestDataset


logging.basicConfig(level="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)
        await job_manager.download(job)


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

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()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Development

Useful commands

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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for minder.research_portal_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ccbae8806983520403e9b264e572ea1402d5ad8b649ef87974afcb286affc87f
MD5 f8f0486756c361af73742f2b8b7c2d88
BLAKE2b-256 968fe6550153ec71bac0b833e85095cff499c496061f5e00dad4957190ac587f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for minder.research_portal_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4f2f69c9b47cd264605d70d75fc4752c186a060dc2699469837d6d5f927c91e
MD5 7469f74149fc766f10f28a104d2f9355
BLAKE2b-256 50fd8e915133faf758d3017f67c9aa81e5d4dd48790f3f82ab781a7b7280d368

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