# castorapi
Python API wrapper for Castor EDC to fetch data from or post data to your clinical study.
## Install
Using conda and the conda-forge channel (recommended):
conda install -c conda-forge castorapi
But, you can also install using pip (https://pypi.org/project/castorapi/):
pip install castorapi
## Update
Using conda and the conda-forge channel:
conda update -c conda-forge castorapi
Using pip (https://pypi.org/project/castorapi/):
pip install castorapi --upgrade
## Usage
First, make sure that save the client and secret from your Castor account in
seperate *client* and *secret* files (without line endings) in a private
folder on your PC. Do not share these files with anyone.
![image](https://user-images.githubusercontent.com/981436/130036568-6209334a-2a8b-4948-9387-7c6c74e0ef08.png)
See also https://data.castoredc.com/api and https://helpdesk.castoredc.com/article/124-application-programming-interface-api
## Example code
import castorapi as ca
c = ca.CastorApi('/path/to/folder/with/secret_client')
c.select_study_by_name('<CASTOR_STUDY_NAME>') # all following commands use this study selection
stats = c.request_statistics()
print(stats)
df_study, df_structure_study, df_report, df_structure_report, df_optiongroups_structure = c.records_reports_all()
users_in_study = c.request_studyuser()
print(users_in_study)
# Getting data from castor about patients in a study
c.request_study_records(record_id='CASTOR00010')
# Posting data to castor to create a new patient
# add institute_id and , request_method='POST' to use this functionality.
c.request_study_records(record_id='CASTOR00010', institute_id=<instituteID>, request_method='POST')
## Known issues
1. The documentation is sparse. Feel free to contribute.
2. Not all Castor API functions are implemented (I implement them on a need-to-use basis), feel free to contribute.
3. See https://github.com/wouterpotters/castorapi/issues for an overview of all open issues.
## NOTE
I am not affiliated with Castor EDC in any way. Use this software at your own risk.
If this API tool does not suffice - take a look at the work from Reinier van Linschoten, who also created a Python package for two-way communication Castor EDC (2021). (https://github.com/reiniervlinschoten/castoredc_api)
Raw data
{
"_id": null,
"home_page": "https://github.com/wouterpotters/castorapi",
"name": "castorapi",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Castor EDC,API,Castor,Clinical study,database,data science",
"author": "Wouter V. Potters",
"author_email": "w.v.potters@amsterdamumc.nl",
"download_url": "https://files.pythonhosted.org/packages/c2/6b/82a586535ee71995234d006ffed2bb68da1504160c6eb9f79464430a32b8/castorapi-0.3.tar.gz",
"platform": null,
"description": "# castorapi\nPython API wrapper for Castor EDC to fetch data from or post data to your clinical study.\n\n## Install\nUsing conda and the conda-forge channel (recommended):\n\n conda install -c conda-forge castorapi\n\nBut, you can also install using pip (https://pypi.org/project/castorapi/):\n\n pip install castorapi\n\n## Update\nUsing conda and the conda-forge channel:\n\n conda update -c conda-forge castorapi\n\nUsing pip (https://pypi.org/project/castorapi/):\n\n pip install castorapi --upgrade\n\n## Usage\nFirst, make sure that save the client and secret from your Castor account in \nseperate *client* and *secret* files (without line endings) in a private \nfolder on your PC. Do not share these files with anyone.\n\n![image](https://user-images.githubusercontent.com/981436/130036568-6209334a-2a8b-4948-9387-7c6c74e0ef08.png)\n\nSee also https://data.castoredc.com/api and https://helpdesk.castoredc.com/article/124-application-programming-interface-api\n\n## Example code\n import castorapi as ca\n c = ca.CastorApi('/path/to/folder/with/secret_client')\n c.select_study_by_name('<CASTOR_STUDY_NAME>') # all following commands use this study selection\n stats = c.request_statistics()\n print(stats)\n df_study, df_structure_study, df_report, df_structure_report, df_optiongroups_structure = c.records_reports_all()\n users_in_study = c.request_studyuser()\n print(users_in_study)\n \n # Getting data from castor about patients in a study\n c.request_study_records(record_id='CASTOR00010')\n \n # Posting data to castor to create a new patient\n # add institute_id and , request_method='POST' to use this functionality.\n c.request_study_records(record_id='CASTOR00010', institute_id=<instituteID>, request_method='POST')\n\n## Known issues\n1. The documentation is sparse. Feel free to contribute.\n2. Not all Castor API functions are implemented (I implement them on a need-to-use basis), feel free to contribute.\n3. See https://github.com/wouterpotters/castorapi/issues for an overview of all open issues.\n\n## NOTE\nI am not affiliated with Castor EDC in any way. Use this software at your own risk.\nIf this API tool does not suffice - take a look at the work from Reinier van Linschoten, who also created a Python package for two-way communication Castor EDC (2021). (https://github.com/reiniervlinschoten/castoredc_api)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API wrapper for Castor EDC to fetch data from you clinical study.",
"version": "0.3",
"project_urls": {
"Download": "https://github.com/wouterpotters/castorapi/archive/master.zip",
"Homepage": "https://github.com/wouterpotters/castorapi"
},
"split_keywords": [
"castor edc",
"api",
"castor",
"clinical study",
"database",
"data science"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "14ef80c630151d48152b3eaf68d42b826d5756fd06e8ec65f2335f1797e83aa6",
"md5": "b66fc3d49b44a04f046bebf64ceb1fb1",
"sha256": "abc4729548390162be00ece471690b08a7382e09606cef34db9a8314fc566168"
},
"downloads": -1,
"filename": "castorapi-0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b66fc3d49b44a04f046bebf64ceb1fb1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 11308,
"upload_time": "2023-08-11T13:44:17",
"upload_time_iso_8601": "2023-08-11T13:44:17.488556Z",
"url": "https://files.pythonhosted.org/packages/14/ef/80c630151d48152b3eaf68d42b826d5756fd06e8ec65f2335f1797e83aa6/castorapi-0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c26b82a586535ee71995234d006ffed2bb68da1504160c6eb9f79464430a32b8",
"md5": "2b53f3762288fcde3e1212d7b81d40b3",
"sha256": "f9172707bd53bac3a84bf38f801541f7096fd5b1122883ab068c2093259cc04a"
},
"downloads": -1,
"filename": "castorapi-0.3.tar.gz",
"has_sig": false,
"md5_digest": "2b53f3762288fcde3e1212d7b81d40b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12380,
"upload_time": "2023-08-11T13:44:19",
"upload_time_iso_8601": "2023-08-11T13:44:19.184801Z",
"url": "https://files.pythonhosted.org/packages/c2/6b/82a586535ee71995234d006ffed2bb68da1504160c6eb9f79464430a32b8/castorapi-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-11 13:44:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wouterpotters",
"github_project": "castorapi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "castorapi"
}