imednet


Nameimednet JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryUnofficial Python SDK for the iMednet clinical trials API
upload_time2025-08-18 18:20:02
maintainerFrederick de Ruiter
docs_urlNone
authorFrederick de Ruiter
requires_python<4.0,>=3.10
licenseMIT
keywords imednet clinical trials sdk api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # imednet

Unofficial Python SDK for the iMednet clinical trials API.

[![PyPI](https://img.shields.io/pypi/v/imednet.svg)](https://pypi.org/project/imednet/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/imednet.svg)](https://pypi.org/project/imednet/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/imednet.svg)](https://pypi.org/project/imednet/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imednet.svg)](https://pypi.org/project/imednet/)
[![License](https://img.shields.io/pypi/l/imednet.svg)](LICENSE)
[![CI](https://img.shields.io/github/actions/workflow/status/fderuiter/imednet-python-sdk/ci.yml?branch=main)](https://github.com/fderuiter/imednet-python-sdk/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen)](https://github.com/fderuiter/imednet-python-sdk)

## Purpose

This package simplifies integration with the iMednet REST API for clinical trial
management. It provides typed endpoint wrappers, helper workflows and a CLI so
researchers and developers can automate data extraction and submission without
reimplementing HTTP logic.

## Features

- Simple, consistent interface for API calls
- Automatic pagination across endpoints
- Pydantic models for requests and responses
- Workflow helpers for data extraction and mapping
- Pandas and CSV utilities
- Optional in-memory caching of study metadata
- Structured JSON logging and OpenTelemetry tracing
- Async client and command line interface

## Quickstart Installation

```bash
# PyPI release
pip install imednet
# Dev version
pip install git+https://github.com/fderuiter/imednet-python-sdk.git@main
```

## Minimal Example

```python
from imednet import ImednetSDK
from imednet.config import load_config
from imednet.utils import configure_json_logging

configure_json_logging()
cfg = load_config()
sdk = ImednetSDK(
    api_key=cfg.api_key,
    security_key=cfg.security_key,
    base_url=cfg.base_url,
)
print(sdk.studies.list())
```

## Asynchronous Example

```python
import asyncio
from imednet import AsyncImednetSDK
from imednet.config import load_config
from imednet.utils import configure_json_logging


async def main() -> None:
    configure_json_logging()
    cfg = load_config()
    async with AsyncImednetSDK(
        api_key=cfg.api_key,
        security_key=cfg.security_key,
        base_url=cfg.base_url,
    ) as sdk:
        print(await sdk.studies.async_list())


asyncio.run(main())
```

See [docs/async_quick_start.rst](docs/async_quick_start.rst) for more details.

## Tech Stack

- Python 3.10–3.12
- requests, httpx, pydantic, typer, tenacity, python-dotenv

## Project Structure

```
.
├── docs/       - Sphinx documentation
├── examples/   - Usage samples
├── imednet/    - SDK package
├── scripts/    - Helper scripts
└── tests/      - Unit and integration tests
```

## API Documentation

Full documentation is available at
<https://fderuiter.github.io/imednet-python-sdk/>.
The official iMednet API documentation is at <https://portal.prod.imednetapi.com/>.

## Postman Collection

The repository includes a ready-to-import Postman collection. Download
[`imednet.postman_collection.json`](imednet.postman_collection.json) and import it
into Postman to explore and test the API endpoints. The collection uses the
`{{baseUrl}}` variable for the API host; set this alongside your `x-api-key` and
`x-imn-security-key` headers in a Postman environment before sending requests.

## Configuration

The SDK and CLI read credentials from environment variables such as
`IMEDNET_API_KEY` and `IMEDNET_SECURITY_KEY`. See
[configuration](docs/configuration.rst) for the complete list, optional
settings, and `.env` support. Use `imednet.config.load_config()` to access these
values in your code.

## CLI Entry Points

The package installs an `imednet` command with subcommands for studies, sites,
subjects, records, jobs, queries and more. Use `imednet --help` to explore all
options.

Example of exporting a subset of variables:

```bash
imednet export sql MY_STUDY table sqlite:///data.db --vars AGE,SEX --forms 10,20
```

### SQLite exports

When the connection string uses SQLite, the command splits the output into one
table per form to avoid the 2000 column limit. Pass ``--single-table`` to
disable this behaviour. See ``docs/cli.rst`` for full examples.

## Testing & Development

```bash
./scripts/setup.sh  # once
poetry run ruff check --fix .
poetry run black --check .
poetry run mypy imednet
poetry run pytest -q
```

### Smoke-test workflow

The optional [smoke.yml](.github/workflows/smoke.yml) action runs the `tests/live` suite.
It relies on repository secrets `APIKEY` and `SECURITYKEY` and sets `IMEDNET_RUN_E2E`.
Use the workflow to confirm real API access on demand or via its nightly schedule.
INFO-level log messages stream to the terminal during these runs, making it easier to
debug failures.

## Building & Publishing

```bash
python -m build
python -m twine upload dist/*
```

Pushing a Git tag like `v0.1.4` triggers the GitHub Actions workflow that builds
and publishes the package to PyPI.

## Versioning & Changelog

This project follows [Semantic Versioning](https://semver.org). See
[CHANGELOG.md](CHANGELOG.md) for release history.

## Contributing

Contributions are welcome! See the
[contributing guide](docs/contributing.rst) and
[CONTRIBUTING.md](CONTRIBUTING.md) for full details.

## License

This project is licensed under the MIT license. See [LICENSE](LICENSE) for
details.

## Acknowledgements

Built with open source libraries including requests, httpx, pydantic and typer.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "imednet",
    "maintainer": "Frederick de Ruiter",
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": "fpderuiter@gmail.com",
    "keywords": "imednet, clinical trials, sdk, api",
    "author": "Frederick de Ruiter",
    "author_email": "127706008+fderuiter@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/be/59/aa6be923248bf7f0ba0d0f1e695e046b8f9642f0ce1a3a7ee57942f3dbb1/imednet-0.2.0.tar.gz",
    "platform": null,
    "description": "# imednet\n\nUnofficial Python SDK for the iMednet clinical trials API.\n\n[![PyPI](https://img.shields.io/pypi/v/imednet.svg)](https://pypi.org/project/imednet/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/imednet.svg)](https://pypi.org/project/imednet/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/imednet.svg)](https://pypi.org/project/imednet/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imednet.svg)](https://pypi.org/project/imednet/)\n[![License](https://img.shields.io/pypi/l/imednet.svg)](LICENSE)\n[![CI](https://img.shields.io/github/actions/workflow/status/fderuiter/imednet-python-sdk/ci.yml?branch=main)](https://github.com/fderuiter/imednet-python-sdk/actions/workflows/ci.yml)\n[![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen)](https://github.com/fderuiter/imednet-python-sdk)\n\n## Purpose\n\nThis package simplifies integration with the iMednet REST API for clinical trial\nmanagement. It provides typed endpoint wrappers, helper workflows and a CLI so\nresearchers and developers can automate data extraction and submission without\nreimplementing HTTP logic.\n\n## Features\n\n- Simple, consistent interface for API calls\n- Automatic pagination across endpoints\n- Pydantic models for requests and responses\n- Workflow helpers for data extraction and mapping\n- Pandas and CSV utilities\n- Optional in-memory caching of study metadata\n- Structured JSON logging and OpenTelemetry tracing\n- Async client and command line interface\n\n## Quickstart Installation\n\n```bash\n# PyPI release\npip install imednet\n# Dev version\npip install git+https://github.com/fderuiter/imednet-python-sdk.git@main\n```\n\n## Minimal Example\n\n```python\nfrom imednet import ImednetSDK\nfrom imednet.config import load_config\nfrom imednet.utils import configure_json_logging\n\nconfigure_json_logging()\ncfg = load_config()\nsdk = ImednetSDK(\n    api_key=cfg.api_key,\n    security_key=cfg.security_key,\n    base_url=cfg.base_url,\n)\nprint(sdk.studies.list())\n```\n\n## Asynchronous Example\n\n```python\nimport asyncio\nfrom imednet import AsyncImednetSDK\nfrom imednet.config import load_config\nfrom imednet.utils import configure_json_logging\n\n\nasync def main() -> None:\n    configure_json_logging()\n    cfg = load_config()\n    async with AsyncImednetSDK(\n        api_key=cfg.api_key,\n        security_key=cfg.security_key,\n        base_url=cfg.base_url,\n    ) as sdk:\n        print(await sdk.studies.async_list())\n\n\nasyncio.run(main())\n```\n\nSee [docs/async_quick_start.rst](docs/async_quick_start.rst) for more details.\n\n## Tech Stack\n\n- Python 3.10\u20133.12\n- requests, httpx, pydantic, typer, tenacity, python-dotenv\n\n## Project Structure\n\n```\n.\n\u251c\u2500\u2500 docs/       - Sphinx documentation\n\u251c\u2500\u2500 examples/   - Usage samples\n\u251c\u2500\u2500 imednet/    - SDK package\n\u251c\u2500\u2500 scripts/    - Helper scripts\n\u2514\u2500\u2500 tests/      - Unit and integration tests\n```\n\n## API Documentation\n\nFull documentation is available at\n<https://fderuiter.github.io/imednet-python-sdk/>.\nThe official iMednet API documentation is at <https://portal.prod.imednetapi.com/>.\n\n## Postman Collection\n\nThe repository includes a ready-to-import Postman collection. Download\n[`imednet.postman_collection.json`](imednet.postman_collection.json) and import it\ninto Postman to explore and test the API endpoints. The collection uses the\n`{{baseUrl}}` variable for the API host; set this alongside your `x-api-key` and\n`x-imn-security-key` headers in a Postman environment before sending requests.\n\n## Configuration\n\nThe SDK and CLI read credentials from environment variables such as\n`IMEDNET_API_KEY` and `IMEDNET_SECURITY_KEY`. See\n[configuration](docs/configuration.rst) for the complete list, optional\nsettings, and `.env` support. Use `imednet.config.load_config()` to access these\nvalues in your code.\n\n## CLI Entry Points\n\nThe package installs an `imednet` command with subcommands for studies, sites,\nsubjects, records, jobs, queries and more. Use `imednet --help` to explore all\noptions.\n\nExample of exporting a subset of variables:\n\n```bash\nimednet export sql MY_STUDY table sqlite:///data.db --vars AGE,SEX --forms 10,20\n```\n\n### SQLite exports\n\nWhen the connection string uses SQLite, the command splits the output into one\ntable per form to avoid the 2000 column limit. Pass ``--single-table`` to\ndisable this behaviour. See ``docs/cli.rst`` for full examples.\n\n## Testing & Development\n\n```bash\n./scripts/setup.sh  # once\npoetry run ruff check --fix .\npoetry run black --check .\npoetry run mypy imednet\npoetry run pytest -q\n```\n\n### Smoke-test workflow\n\nThe optional [smoke.yml](.github/workflows/smoke.yml) action runs the `tests/live` suite.\nIt relies on repository secrets `APIKEY` and `SECURITYKEY` and sets `IMEDNET_RUN_E2E`.\nUse the workflow to confirm real API access on demand or via its nightly schedule.\nINFO-level log messages stream to the terminal during these runs, making it easier to\ndebug failures.\n\n## Building & Publishing\n\n```bash\npython -m build\npython -m twine upload dist/*\n```\n\nPushing a Git tag like `v0.1.4` triggers the GitHub Actions workflow that builds\nand publishes the package to PyPI.\n\n## Versioning & Changelog\n\nThis project follows [Semantic Versioning](https://semver.org). See\n[CHANGELOG.md](CHANGELOG.md) for release history.\n\n## Contributing\n\nContributions are welcome! See the\n[contributing guide](docs/contributing.rst) and\n[CONTRIBUTING.md](CONTRIBUTING.md) for full details.\n\n## License\n\nThis project is licensed under the MIT license. See [LICENSE](LICENSE) for\ndetails.\n\n## Acknowledgements\n\nBuilt with open source libraries including requests, httpx, pydantic and typer.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Unofficial Python SDK for the iMednet clinical trials API",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/fderuiter/imednet-python-sdk",
        "Repository": "https://github.com/fderuiter/imednet-python-sdk"
    },
    "split_keywords": [
        "imednet",
        " clinical trials",
        " sdk",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8466a1dd003ac08466ba592aa75d5312ae08d42b5c6bcedba365e3d07f37e51f",
                "md5": "2ff5cb7c2d6c73e79b644d2eac34ed75",
                "sha256": "0265e5631a35ece67d5fe5af33fb6b91fb4e3a51cd191f96721a2ae9cc8d92fd"
            },
            "downloads": -1,
            "filename": "imednet-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2ff5cb7c2d6c73e79b644d2eac34ed75",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 90422,
            "upload_time": "2025-08-18T18:20:00",
            "upload_time_iso_8601": "2025-08-18T18:20:00.666571Z",
            "url": "https://files.pythonhosted.org/packages/84/66/a1dd003ac08466ba592aa75d5312ae08d42b5c6bcedba365e3d07f37e51f/imednet-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "be59aa6be923248bf7f0ba0d0f1e695e046b8f9642f0ce1a3a7ee57942f3dbb1",
                "md5": "2e5e4d8da72a5bfcb5ce9caf85d3940c",
                "sha256": "b00042b28003d136ca01bac3c680808203fa89df3b63d604064337fffc8062ab"
            },
            "downloads": -1,
            "filename": "imednet-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2e5e4d8da72a5bfcb5ce9caf85d3940c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 64098,
            "upload_time": "2025-08-18T18:20:02",
            "upload_time_iso_8601": "2025-08-18T18:20:02.245865Z",
            "url": "https://files.pythonhosted.org/packages/be/59/aa6be923248bf7f0ba0d0f1e695e046b8f9642f0ce1a3a7ee57942f3dbb1/imednet-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 18:20:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fderuiter",
    "github_project": "imednet-python-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "imednet"
}
        
Elapsed time: 0.52553s