Skip to main content

mainzelliste-client

Python client for the mainzelliste, a pseudonymization service

Installation

pip install mainzelliste-client

Usage

Basic Example

from mainzelliste_client import MainzellisteClient

example_key = 'e8KcR1vcOLOTY0lRC7RjnMbdr4ARYIGurhEUZSpbvqU='

with MainzellisteClient(base_url='http://localhost:8081', api_key=example_key) as client:
    new_patient_id = client.generate_patient_id('5Yp0E')

print(new_patient_id)  # PQRYHQG0

Setup a test Mainzelliste instance

  1. Go in the tests/docker/ directory
cd tests/docker/
  1. Run the docker compose
docker-compose up -d
  1. Mainzelliste should be at http://localhost:8081/

API Reference

MainzellisteClient

__init__(base_url, api_key, api_version="2.0")

Initialize the Mainzelliste client.

Parameters:

  • base_url (str): Base URL of the Mainzelliste service

  • api_key (str): API key for authentication

  • api_version (str, optional): API version to use (default: "2.0")

generate_patient_id(patient_id)

Generate a new pseudonymized patient ID using the Mainzelliste API. This is the main method for users to pseudonymize patient identifiers.

This method handles the complete workflow: creating a session, generating a token, and adding the patient to get a new pseudonymized ID.

Parameters:

  • patient_id (str): Original patient ID to be pseudonymized

Returns: String containing the new pseudonymized patient ID.

Example:

with MainzellisteClient(base_url='http://localhost:8081', api_key='your-api-key') as client:
    new_id = client.generate_patient_id('patient-123')
    print(f"Pseudonymized ID: {new_id}")

create_session()

Create a new session.

Returns: Dictionary containing session information with a uri field.

create_token(session_id, token_type, idtypes=None, fields=None, ids=None)

Create a token for a session.

Parameters:

  • session_id (str): The session ID

  • token_type (str): Type of token (e.g., "addPatient")

  • idtypes (list, optional): List of ID types to generate (default: ["pid"])

  • fields (dict, optional): Patient fields (default: {})

  • ids (dict, optional): Patient IDs (default: {})

Returns: Dictionary containing token information with a tokenId field.

add_patient(token_id, sureness=True)

Add a patient using a token.

Parameters:

  • token_id (str): The token ID for adding the patient

  • sureness (bool, optional): Whether the data is certain (default: True)

Returns: Dictionary containing patient information.

close()

Close the underlying session.

License

See LICENSE file for details.

Metadata

Release files for mainzelliste-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mainzelliste-client 0.1.1
File Size Uploaded Provenance Actions
mainzelliste_client-0.1.1.tar.gz 4.7 kB Without provenance Details for mainzelliste_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mainzelliste-client 0.1.1
File Interpreter ABI Platform Actions
mainzelliste_client-0.1.1-py3-none-any.whl Python 3 none any Details for mainzelliste_client-0.1.1-py3-none-any.whl

Total release size: 9.5 kB

Release files / mainzelliste_client-0.1.1.tar.gz

Download URL mainzelliste_client-0.1.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
814a9b1a04870457cfd85405b58bf1f5741dba4313d9426ed8c5d999c9b8756f
BLAKE2b-256 checksum
How to use checksums
be619c5ae9f2a468da78d145a60f68cfe4b8c94dd1bb2436ffc5ca0aa9349bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / mainzelliste_client-0.1.1-py3-none-any.whl

Download URL mainzelliste_client-0.1.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
916c4391637825396f547c9eacf0f096f4f567756af6e682cc201fd557489648
BLAKE2b-256 checksum
How to use checksums
8dbd372d759cbdde40cb5fdce4cbc3b181bd59383c827ded58454fc284b9851c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Security for mainzelliste-client 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page