# BCDA Client
A Python client for the CMS Beneficiary Claims Data API (BCDA).
## Installation
bash
pip install bcda-client
## Quick Start
python
from bcda_client import BCDAClient
Initialize client (Sandbox)
client = BCDAClient(
client_id="your_client_id",
client_secret="your_client_secret",
is_sandbox=True
)
Download data
results = client.download_data(
output_dir="my_data",
include_csv=True,
incremental=False
)
## Features
- Support for both sandbox and production environments
- Automatic authentication handling
- Support for all BCDA endpoints:
- Metadata
- Patient
- Group (all and runout)
- Jobs
- Attribution Status
- Data export in both Parquet and CSV formats
- Support for incremental and full extracts
- Automatic flattening of nested FHIR structures
## Configuration
### Environment Options
Sandbox Environment
client = BCDAClient(
client_id="your_client_id",
client_secret="your_client_secret",
is_sandbox=True
)
Production Environment
client = BCDAClient(
client_id="your_client_id",
client_secret="your_client_secret",
is_sandbox=False
)
Custom Environment
client = BCDAClient(
client_id="your_client_id",
client_secret="your_client_secret",
base_url="https://custom.bcda.url"
)
### Download Options
Full extract with CSV
client.download_data(
output_dir="my_data",
include_csv=True,
incremental=False
)
Incremental extract (last 30 days)
client.download_data(
output_dir="my_data",
include_csv=True,
incremental=True
)
## Output Structure
my_data/
├── parquet/
│ ├── Patient_20240211_134435.parquet
│ ├── Coverage_20240211_134435.parquet
│ └── ExplanationOfBenefit_20240211_134435.parquet
└── csv/
├── Patient_20240211_134435.csv
├── Coverage_20240211_134435.csv
└── ExplanationOfBenefit_20240211_134435.csv
## Features
- Easy authentication with the BCDA API
- Simple methods to retrieve beneficiary data
- Automatic handling of pagination
- Error handling and retry mechanisms
## Requirements
- Python 3.6+
- See requirements.txt for package dependencies
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Raw data
{
"_id": null,
"home_page": "https://github.com/pachecocarlos27/bcda-client",
"name": "bcda-client-datant",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "healthcare, bcda, cms, medicare, api-client",
"author": "Carlos Pacheco",
"author_email": "admin@data-nt.com",
"download_url": "https://files.pythonhosted.org/packages/e1/94/2a836e3775f8c078457a4bb19b387ba45e5e50445c6ce48f7251ebecc4a2/bcda_client_datant-0.2.0.tar.gz",
"platform": null,
"description": "# BCDA Client\r\n\r\nA Python client for the CMS Beneficiary Claims Data API (BCDA).\r\n\r\n## Installation\r\n\r\nbash\r\npip install bcda-client\r\n\r\n## Quick Start\r\n\r\npython\r\nfrom bcda_client import BCDAClient\r\nInitialize client (Sandbox)\r\nclient = BCDAClient(\r\nclient_id=\"your_client_id\",\r\nclient_secret=\"your_client_secret\",\r\nis_sandbox=True\r\n)\r\nDownload data\r\nresults = client.download_data(\r\noutput_dir=\"my_data\",\r\ninclude_csv=True,\r\nincremental=False\r\n)\r\n\r\n## Features\r\n\r\n- Support for both sandbox and production environments\r\n- Automatic authentication handling\r\n- Support for all BCDA endpoints:\r\n - Metadata\r\n - Patient\r\n - Group (all and runout)\r\n - Jobs\r\n - Attribution Status\r\n- Data export in both Parquet and CSV formats\r\n- Support for incremental and full extracts\r\n- Automatic flattening of nested FHIR structures\r\n\r\n## Configuration\r\n\r\n### Environment Options\r\n\r\nSandbox Environment\r\nclient = BCDAClient(\r\nclient_id=\"your_client_id\",\r\nclient_secret=\"your_client_secret\",\r\nis_sandbox=True\r\n)\r\nProduction Environment\r\nclient = BCDAClient(\r\nclient_id=\"your_client_id\",\r\nclient_secret=\"your_client_secret\",\r\nis_sandbox=False\r\n)\r\nCustom Environment\r\nclient = BCDAClient(\r\nclient_id=\"your_client_id\",\r\nclient_secret=\"your_client_secret\",\r\nbase_url=\"https://custom.bcda.url\"\r\n)\r\n\r\n### Download Options\r\nFull extract with CSV\r\nclient.download_data(\r\noutput_dir=\"my_data\",\r\ninclude_csv=True,\r\nincremental=False\r\n)\r\nIncremental extract (last 30 days)\r\nclient.download_data(\r\noutput_dir=\"my_data\",\r\ninclude_csv=True,\r\nincremental=True\r\n)\r\n\r\n## Output Structure\r\n\r\nmy_data/\r\n\u251c\u2500\u2500 parquet/\r\n\u2502 \u251c\u2500\u2500 Patient_20240211_134435.parquet\r\n\u2502 \u251c\u2500\u2500 Coverage_20240211_134435.parquet\r\n\u2502 \u2514\u2500\u2500 ExplanationOfBenefit_20240211_134435.parquet\r\n\u2514\u2500\u2500 csv/\r\n\u251c\u2500\u2500 Patient_20240211_134435.csv\r\n\u251c\u2500\u2500 Coverage_20240211_134435.csv\r\n\u2514\u2500\u2500 ExplanationOfBenefit_20240211_134435.csv\r\n\r\n\r\n## Features\r\n\r\n- Easy authentication with the BCDA API\r\n- Simple methods to retrieve beneficiary data\r\n- Automatic handling of pagination\r\n- Error handling and retry mechanisms\r\n\r\n## Requirements\r\n\r\n- Python 3.6+\r\n- See requirements.txt for package dependencies\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python client for the BCDA (Beneficiary Claims Data API)",
"version": "0.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/pachecocarlos27/bcda-client/issues",
"Documentation": "https://github.com/pachecocarlos27/bcda-client#readme",
"Homepage": "https://github.com/pachecocarlos27/bcda-client"
},
"split_keywords": [
"healthcare",
" bcda",
" cms",
" medicare",
" api-client"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d8e57a2801f62a7f965eb0d3f30343d296ef516212d8714c1ca3c6122e1b178f",
"md5": "4150a9c247564780f252f40c2b162af0",
"sha256": "d490eec9e4449ff3676bea0e65fc4ba1758f4a2e4677d2ae8f7cfdee19d78ffd"
},
"downloads": -1,
"filename": "bcda_client_datant-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4150a9c247564780f252f40c2b162af0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 16825,
"upload_time": "2025-02-18T21:34:05",
"upload_time_iso_8601": "2025-02-18T21:34:05.121322Z",
"url": "https://files.pythonhosted.org/packages/d8/e5/7a2801f62a7f965eb0d3f30343d296ef516212d8714c1ca3c6122e1b178f/bcda_client_datant-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e1942a836e3775f8c078457a4bb19b387ba45e5e50445c6ce48f7251ebecc4a2",
"md5": "9432590d591ae17bca1160721b3cb715",
"sha256": "983b161a0f2c0568f8dc8f6ae421241855277e94bc6a04b1950af1211393b9c0"
},
"downloads": -1,
"filename": "bcda_client_datant-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "9432590d591ae17bca1160721b3cb715",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17385,
"upload_time": "2025-02-18T21:34:06",
"upload_time_iso_8601": "2025-02-18T21:34:06.848469Z",
"url": "https://files.pythonhosted.org/packages/e1/94/2a836e3775f8c078457a4bb19b387ba45e5e50445c6ce48f7251ebecc4a2/bcda_client_datant-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-18 21:34:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pachecocarlos27",
"github_project": "bcda-client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "requests",
"specs": [
[
">=",
"2.25.0"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "pyarrow",
"specs": [
[
">=",
"3.0.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.50.0"
]
]
}
],
"lcname": "bcda-client-datant"
}