Skip to main content

A Python client for the BCDA (Beneficiary Claims Data API)

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bcda_client_datant-0.1.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bcda_client_datant-0.1.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file bcda_client_datant-0.1.2.tar.gz.

File metadata

  • Download URL: bcda_client_datant-0.1.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for bcda_client_datant-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f2b6fb3fd8f97c5263b47e2fd9d91df910891343662add19287d0c412992356e
MD5 beec1745890604d4ac825a14b68198c6
BLAKE2b-256 0832f5ff1c49034d0f416b1b8ff6f0803e5922c1ef671ae80a6329dcda291659

See more details on using hashes here.

File details

Details for the file bcda_client_datant-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for bcda_client_datant-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c00b7c4d789f64edbb80b7ff890498c64a343a98d10419b095da3efb16f9b43a
MD5 b24a797f3ee77493b70da9f603ceabd9
BLAKE2b-256 c8182e361352427129b91725c206122dbd1102645c5f9fdf533f8f9fb4b28cae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page