xcures_api ( only necessary api calls being implemented ATM)
python wrapper for the xcures REST API.
Status
- The auth functionality is working.
- Subject API query is working, but not tested extensively.
- Other API hooks, ie: query, are not implemented in a trusted way quite yet.
Installation
Development
Environment
Conda
- Install Miniconda
- Create a new environment.
conda create -y -n XCAPI -c conda-forge python=3.10 ipython pytest pip pytz requests ipython && conda activate XCAPI && pip install yaml_config_day twine black
- Activate the environment
conda activate XCAPI
Production // pip
Install w/pip
pip install xcures_api
Configuration
YAML Credentials File
- Based on credentials obtained from xcures. Using the yaml_config_day package.
- Located in
~/.config/xcures/xcures_$XCURES_ENV.yaml, whereXCURES_ENV=might beprodortest. - Contents:
export XCURES_ENV=prod
more ~/.config/xcures/xcures_$XCURES_ENV.yaml
---
base_url: "https://partner.xcures.com"
base_auth_url: "https://xcures-patient-registry-prod.us.auth0.com"
project_id: "PROJECTIDHERE"
client_id: "CLIENTIDHERE"
client_secret: "SECRETKEYHERE"
Usage
given the env is set and the yaml file is configured
Authenticate
from xcures.xcures_api import XCuresAPI as xc_api
# Initialize the API connection, using your credentials yaml file.
xc = xc_api()
# print the session id
print(xc)
# print your auth token
print(xc.token)
# print all subjects in the project
xc.subject()
Tests
Crude Dev Test
conda activate XCAPI
python xcures_api/xcures_api.py # just for quick dev, this will be moved to proper pytest.
Pytest
conda activate XCAPI
pytest
- This is one test checking if failure to find an appropriate yaml file will raise an exception. I'm not certain how much effort to put into mocking the REST api behavior given credentials are needed to use it. TODO: check with the xcures dev team to see if there are test credentials available.
Update pypi
python setup.py sdist
twine upload --repository rcrf dist/*
Metadata
Release files for xcures-api 0.0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xcures_api-0.0.3.5.tar.gz | 4.9 kB | Without provenance | Details for xcures_api-0.0.3.5.tar.gz |
Release files / xcures_api-0.0.3.5.tar.gz
| Download URL | xcures_api-0.0.3.5.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
078dec4fe580117ad139bc1e5b2d8206d02a3774b6bb6655258c0eb0bbc4c374
|
|
BLAKE2b-256 checksum How to use checksums |
4eaee9db4babdee382b65b5a022cbbc68d899a90517bb94472314646062ba974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.14
|
Security for xcures-api 0.0.3.5
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.