Metadata-Version: 2.3
Name: umcn-consent
Version: 2.0.0rc1
Summary: 
Author: Karim, Sjoerd Kerkstra
Author-email: Karim <115158216+karimdiabb@users.noreply.github.com>, Sjoerd Kerkstra <sjoerd.kerkstra@radboudumc.nl>
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: pydantic>=2.12.5
Requires-Dist: requests>=2.32.5
Requires-Python: >=3.11, <4.0
Description-Content-Type: text/markdown

[![CI](https://github.com/ResearchBureau/umcn_consent/actions/workflows/build.yml/badge.svg)](https://github.com/ResearchBureau/umcn-consent/actions/workflows/build.yml)
[![PyPI](https://img.shields.io/pypi/v/umcn_consent)](https://pypi.org/project/umcn-consent/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/umcn_consent)](https://pypi.org/project/umcn-consent/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# UMCN_Consent
A Python layer for UMCN research usage consent systems

## Installation

```
pip install git+ssh://git@github.com:ResearchBureau/umcn-consent.git
```

## Usage

Set USER, PASWORD, CLIENT_ID and URL in your local environment

To check consent status for a patient:
```python
import os
from umcn_consent.auth import authenticate
from umcn_consent.core import AuthenticatedClient


session = authenticate(username=os.getenv("USER"),
                       password=os.getenv("PASSWORD"),
                       client_id=os.getenv("CLIENT_ID"))

client = AuthenticatedClient(session=session, url=os.getenv("URL"))
client.has_given_consent(pid="12345") 
```

see `examples/example.py`

## Contributing
How to contribute to this repo

### Get the code
Fork this repo, create a feature branch

### Set up environment
umcn_consent uses [uv](https://docs.astral.sh/uv) for dependency and package management 

* Install uv (see [uv docs](https://docs.astral.sh/uv/getting-started/installation/))

* Create a virtual env. Go to the folder where you cloned umcn_consent and use 
  ```  
  uv sync 
  ``` 

* Install [pre-commit](https://pre-commit.com) 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
* Run all tests
* Run [pre-commit](https://pre-commit.com):
  ```
  pre-commit run
  ```
### Publish
Create a pull request: [https://github.com/ResearchBureau/umcn_consent/pulls]()


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

* umcn_consent uses [semantic versioning](https://semver.org/) 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`


