xcures-api


Namexcures-api JSON
Version 0.0.3.5 PyPI version JSON
download
home_pagehttps://github.com/RCRF/xcures_api
SummaryPython wrapper for the xcures REST api, found here https://partner.xcures.com/api-docs.
upload_time2024-06-25 18:58:22
maintainerNone
docs_urlNone
authorJohn Major
requires_python>=3.10
licenseMIT
keywords xcures api bioinformatics patient records
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xcures_api ( only necessary api calls being implemented ATM)
python wrapper for the [xcures REST API](https://partner.xcures.com/api-docs).

## 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](https://docs.anaconda.com/miniconda/miniconda-install/)
* Create a new environment.
```bash
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
```bash
conda activate XCAPI
```

## Production // pip

### Install w/pip
```bash 
pip install xcures_api
```

## Configuration

### YAML Credentials File
* Based on credentials obtained from xcures. Using the [yaml_config_day](https://github.com/Daylily-Informatics/yaml_config_day) package.
* Located in `~/.config/xcures/xcures_$XCURES_ENV.yaml`, where `XCURES_ENV=` might be `prod` or `test`.
* Contents:
  
```bash
export XCURES_ENV=prod
more ~/.config/xcures/xcures_$XCURES_ENV.yaml
```


```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
```python
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
```python
conda activate XCAPI
python xcures_api/xcures_api.py # just for quick dev, this will be moved to proper pytest.
```

## Pytest
```bash
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
```bash
python setup.py sdist
twine upload --repository rcrf  dist/*
```
 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RCRF/xcures_api",
    "name": "xcures-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "xcures api bioinformatics patient records",
    "author": "John Major",
    "author_email": "iamh2o@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4e/ae/e9db4babdee382b65b5a022cbbc68d899a90517bb94472314646062ba974/xcures_api-0.0.3.5.tar.gz",
    "platform": null,
    "description": "# xcures_api ( only necessary api calls being implemented ATM)\npython wrapper for the [xcures REST API](https://partner.xcures.com/api-docs).\n\n## Status\n* The auth functionality is working.\n* Subject API query is working, but not tested extensively.\n* Other API hooks, ie: query, are not implemented in a trusted way quite yet.\n\n# Installation\n\n## Development\n### Environment\n#### Conda\n* [Install Miniconda](https://docs.anaconda.com/miniconda/miniconda-install/)\n* Create a new environment.\n```bash\nconda 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\n```\n\n* Activate the environment\n```bash\nconda activate XCAPI\n```\n\n## Production // pip\n\n### Install w/pip\n```bash \npip install xcures_api\n```\n\n## Configuration\n\n### YAML Credentials File\n* Based on credentials obtained from xcures. Using the [yaml_config_day](https://github.com/Daylily-Informatics/yaml_config_day) package.\n* Located in `~/.config/xcures/xcures_$XCURES_ENV.yaml`, where `XCURES_ENV=` might be `prod` or `test`.\n* Contents:\n  \n```bash\nexport XCURES_ENV=prod\nmore ~/.config/xcures/xcures_$XCURES_ENV.yaml\n```\n\n\n```yaml\n---\nbase_url: \"https://partner.xcures.com\"\nbase_auth_url: \"https://xcures-patient-registry-prod.us.auth0.com\"\nproject_id: \"PROJECTIDHERE\"\nclient_id: \"CLIENTIDHERE\"\nclient_secret: \"SECRETKEYHERE\"\n```\n\n\n# Usage\n_given the env is set and the yaml file is configured_\n\n## Authenticate\n```python\nfrom xcures.xcures_api import XCuresAPI as xc_api\n\n# Initialize the API connection, using your credentials yaml file.\nxc = xc_api()\n\n# print the session id\nprint(xc)\n\n# print your auth token\nprint(xc.token)\n\n# print all subjects in the project\nxc.subject()\n```\n\n# Tests\n## Crude Dev Test\n```python\nconda activate XCAPI\npython xcures_api/xcures_api.py # just for quick dev, this will be moved to proper pytest.\n```\n\n## Pytest\n```bash\nconda activate XCAPI\npytest\n```\n* 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.\n\n\n\n# Update pypi\n```bash\npython setup.py sdist\ntwine upload --repository rcrf  dist/*\n```\n \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for the xcures REST api, found here https://partner.xcures.com/api-docs.",
    "version": "0.0.3.5",
    "project_urls": {
        "Homepage": "https://github.com/RCRF/xcures_api"
    },
    "split_keywords": [
        "xcures",
        "api",
        "bioinformatics",
        "patient",
        "records"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4eaee9db4babdee382b65b5a022cbbc68d899a90517bb94472314646062ba974",
                "md5": "a8a161a310a5149cb9bd9691d408ebe2",
                "sha256": "078dec4fe580117ad139bc1e5b2d8206d02a3774b6bb6655258c0eb0bbc4c374"
            },
            "downloads": -1,
            "filename": "xcures_api-0.0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a8a161a310a5149cb9bd9691d408ebe2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 4895,
            "upload_time": "2024-06-25T18:58:22",
            "upload_time_iso_8601": "2024-06-25T18:58:22.716180Z",
            "url": "https://files.pythonhosted.org/packages/4e/ae/e9db4babdee382b65b5a022cbbc68d899a90517bb94472314646062ba974/xcures_api-0.0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-25 18:58:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RCRF",
    "github_project": "xcures_api",
    "github_not_found": true,
    "lcname": "xcures-api"
}
        
Elapsed time: 3.27545s