Metadata-Version: 2.2
Name: bcda-client-datant
Version: 0.2.0
Summary: A Python client for the BCDA (Beneficiary Claims Data API)
Home-page: https://github.com/pachecocarlos27/bcda-client
Author: Carlos Pacheco
Author-email: admin@data-nt.com
Project-URL: Bug Tracker, https://github.com/pachecocarlos27/bcda-client/issues
Project-URL: Documentation, https://github.com/pachecocarlos27/bcda-client#readme
Keywords: healthcare,bcda,cms,medicare,api-client
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: pandas>=1.0.0
Requires-Dist: pyarrow>=3.0.0
Requires-Dist: tqdm
Requires-Dist: pytest>=6.0.0
Requires-Dist: pytest-benchmark>=3.4.1
Requires-Dist: psutil>=5.8.0
Requires-Dist: pyarrow>=3.0.0
Requires-Dist: pandas>=1.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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.

