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.
Metadata
Release files for bcda-client-datant 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bcda_client_datant-0.2.0.tar.gz | 17.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bcda_client_datant-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / bcda_client_datant-0.2.0.tar.gz
| Download URL | bcda_client_datant-0.2.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
983b161a0f2c0568f8dc8f6ae421241855277e94bc6a04b1950af1211393b9c0
|
|
BLAKE2b-256 checksum How to use checksums |
e1942a836e3775f8c078457a4bb19b387ba45e5e50445c6ce48f7251ebecc4a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / bcda_client_datant-0.2.0-py3-none-any.whl
| Download URL | bcda_client_datant-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d490eec9e4449ff3676bea0e65fc4ba1758f4a2e4677d2ae8f7cfdee19d78ffd
|
|
BLAKE2b-256 checksum How to use checksums |
d8e57a2801f62a7f965eb0d3f30343d296ef516212d8714c1ca3c6122e1b178f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|