Python SDK for the Federated Learning Clinical Safety API
Project description
🔧 Federated Learning Clinical Safety Server SDK
This is the documentation for the Federated Learning Clinical Safety Dashboard SDK! This project provides a package for interacting with the Federated Learning Clinical Safety Dashboard Server in a type-safe and easy manner.
Using the SDK
The package is available from PyPi.
Installation
pip install federated-learning-clinical-safety-sdk
🚀 Quickstart code
from api_sdk.client import APIClient
from api_sdk.models import FlModel
# 1. Initialize
BASE_URL = "http://localhost:8000/api" # i.e. vht-dev.shef.ac.uk/api
TOKEN = "your_api_token_here" # create a machine account with create_uploader <username>
client = APIClient(BASE_URL, TOKEN)
# 2. List all federated models
models = client.list_models()
for m in models:
print(f"{m.id}: {m.name} ({m.accuracy*100:.1f}% accuracy)")
# 3. Fetch a single model by ID
model = client.get_model(model_id=1)
print(model)
# 4. Create a new model
new = FlModel(
name="MyModel",
accuracy=0.88,
generalisability=0.82,
security=0.75
)
created = client.create_model(new)
print(f"Created model ID = {created.id}")
Development
Prerequisites
Before you begin, ensure you have the following installed:
- Python 3.10+
- Poetry
Installing poetry
Windows NT
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
Then add to path:
%USERPROFILE%\AppData\Roaming\pypoetry\venv\Scripts
Linux/MacOS/Unix-like systems:
pipx install poetry
Publishing new versions
This repo is set up with Continuous Deployment to automatically deploy new packages to PyPi.
To deploy a new version, do the following.
- Bump the package version
poetry version patch
- Create a matching git tag
git tag v<version number (i.e. 0.1.1)>
- Push the tag to GitHub
git push origin v<version number from step 2 (i.e. 0.1.1)>
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file federated_learning_clinical_safety_sdk-0.1.1.tar.gz.
File metadata
- Download URL: federated_learning_clinical_safety_sdk-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cea4c2502c77da61e70460158abbaed05e4aa187329c91ec37d0715ae89b23f
|
|
| MD5 |
5ec74ec028d7d2da106b8280169c2135
|
|
| BLAKE2b-256 |
64d7afad66664480415ce7fef065bc453ba7ab40fba903e23761b71f0da63c4e
|
File details
Details for the file federated_learning_clinical_safety_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: federated_learning_clinical_safety_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccef6f4696f69a66044a441799768625d3b0daaae14ee7fde3a250d95bb38c28
|
|
| MD5 |
ddafb57181a1622943a2a568f94f9b2d
|
|
| BLAKE2b-256 |
37c86c458e8ae779943df43d568e4585f7e89b60643c406b11880119409fc7fd
|