sjoerdk / pimsclient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pimsclient

CI PyPI PyPI - Python Version Code style: black Checked with mypy

Client for PIMS keyfile management swagger web API.

  • Pseudonymize and reidentify using PIMS keyfile management as backend
  • Supports multiple identity/pseudonym types:
    • PatientUID
    • StudyInstanceUID
    • SeriesInstanceUID
    • SOPInstanceUID
    • AccessionNumber
  • Authentication via NTLM

Installation

pip install pimsclient

Usage

Basic example

To use pimsclient in a project

    # Create a KeyFile instance    
    keyfile = KeyFile.init_from_id(
        keyfile_id=49,
        client=AuthenticatedClient(session=session),
        server=PIMSServer(url="https://url_to_pims_api")     

    # I have some patientIDs I want to pseudonymize with PIMS
    keys = keyfile.pseudonymize([PatientID('1234'),
                                 PatientID('5678'),
                                 PatientID('9012')])

    # I found some pseudo patientIDs. What was the original ID?
    keys = keyfile.reidentify([PseudoPatientID('Patient1'),
                               PseudoPatientID('Patient2'),
                               PseudoPatientID('Patient3')])

Credentials

pimsclient needs an authenticated requests.Session() object to interact with PIMS API. Check with the admins of the PIMS API server for credentials

Contributing

You can contribute in different ways

Report bugs

Report bugs at https://github.com/sjoerdk/pimsclient/issues.

Contribute code

Get the code

Fork this repo, create a feature branch

Set up environment

pimsclient uses poetry for dependency and package management

  • Install poetry (see poetry docs)
  • Create a virtual env. Go to the folder where cloned pimsclient and use
    poetry install 
    
  • Install pre-commit hooks.
    pre-commit install
    

Add your code

Make your code contributions. Make sure document and add tests for new features. To automatically publish to pypi, increment the version number and push to master. See below.

Lint your code

Publish

Create a pull request

Incrementing the version number

A merged pull request will only be published to pypi if it has a new version number. To bump pimsclient's version, do the following.

  • pimsclient uses semantic versioning Check whether your addition is a PATCH, MINOR or MAJOR version.

  • Manually increment the version number:

    • pyproject.toml -> version = "0.1.2"
  • Add a brief description of your updates new version to HISTORY.md

Credits

This package was originally created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

License:MIT License


Languages

Language:Python 100.0%