Skip to main content

An easy way to calculate CCBHC measurements.

Project description

CCBHC Measurements

Table of Contents

Purpose

The goal of this package is to simplify the process for calculating CCBHC measurements for all CCBHCs. It does this by taking in all the relevant data for a measurement and outputing whether the data meets the measurements' criteria. Here's the DEP-REM-6 as an example:

simple example of how the package works Click here for the more detailed DEP-REM-6 example pdf

1. Data Processing

Our code is simple:

  1. Import the Measurement you want to calculate.
  2. Give it the required data (downloaded excel reports from your EHR, query data from SQL, or whatever)
  3. Run get_all_submeasures(). Under the hood, get_all_submeasures() determines which data meets the Measurments criteria and which does not.
  4. Export your data to your preferred tool for analysis. If you want to keep it in pandas, you already have it. If you want to use Excel, or Power BI, you can export it there as well!

2. Dashboard Display

We've also created a base Power BI file as a foundation for a dashboard. Check out the dashboard folder here.

Dashboard Picture

Currently Supported Measurements

The definition for these Measurements can be found at https://www.samhsa.gov/sites/default/files/ccbhc-quality-measures-technical-specifications-manual.pdf

At the moment we only have these Measurements, but we plan on releasing a new Measurement every two weeks.

Code Demonstration

import pandas as pd
import ccbhc_measurements as ccbhc

- Step 1: Load in the data into Pandas Dataframes

all_inclusive_excel_file = r"../file/path/to/Dep Rem Data.xlsx"
phq_data = pd.read_xlsx(all_inclusive_excel_file, sheet_name = "phq9")
diagnosis_data = pd.read_xlsx(all_inclusive_excel_file, sheet_name = "diagnosis")
demographic_data = pd.read_xlsx(all_inclusive_excel_file, sheet_name = "demographic")
insurance_data = pd.read_xlsx(all_inclusive_excel_file, sheet_name = "insurance")

- Step 2: Ensure that the dataframes follows the correct schema

Dep Rem 6 Required Data Input and Output Diagram

phq_data = phq_data[["patient_id","patient_DOB","encounter_id","encounter_datetime","total_score"]].copy()
diagnosis_data = diagnosis_data[["patient_id","encounter_datetime","diagnosis"]].copy()
demographic_data = demographic_data[["patient_id","race","ethnicity"]].copy()
insurance_data = insurance_data[["patient_id","insurance","start_datetime","end_datetime"]].copy()

- Step 3: Calculate Dep-Rem

submeasure_data = [phq_data,diagnosis_data,demographic_data,insurance_data]
measure = ccbhc.Dep_Rem(submeasure_data)
results = measure.get_all_submeasures()s
for name, data in results.items():
    data.to_excel(name+".xlsx", index=False)
Example Data Output:
patient_id patient_measurement_year_id encounter_id age medicaid numerator numerator_reason
1 1-2024 1 18+ FALSE TRUE Has Remission
2 1-2025 3 18+ FALSE FALSE Remission Period not Reached
3 3-2024 4 18+ FALSE FALSE No PHQ-9 Follow Up
4 4-2024 5 18+ FALSE FALSE No Remission

- Step 4: Create a Dashboard in Power BI (Optional)

We've created an example dashboard in Power BI for easy implementation but feel free to use the analysis tool of your choice. Feel free to download it from the dashboard folder.

De-panda-cies

License

CC BY-NC-SA 4.0

Installation

Binary installers for the latest released version are available at the Python Package Index (PyPI)

# PyPI
pip install ccbhc_measurements

Contributors

  • Alex Gursky - Data Engineer
  • Yisroel Len - Director of Data Analytics & CCBHC Project Evaluator

Contributions and Discussions

Feel free to add and create you own Measurements. All Measurements should follow this uml. Send us your recomendations, bugs, questions or feedback at agursky@pesachtikvah.com


Back to Top

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

ccbhc_measurements-2025.3.11.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

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

ccbhc_measurements-2025.3.11-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file ccbhc_measurements-2025.3.11.tar.gz.

File metadata

  • Download URL: ccbhc_measurements-2025.3.11.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ccbhc_measurements-2025.3.11.tar.gz
Algorithm Hash digest
SHA256 a85dbc54461d885f5e34823e7b7369512f473b3c7ad0167bcdc488b82af0629b
MD5 55174980510877ca44127b84e556d3a0
BLAKE2b-256 bfda5e52f01f0571cedba7e0f2c378321cf7ad936c18ff5ce38871d290621690

See more details on using hashes here.

File details

Details for the file ccbhc_measurements-2025.3.11-py3-none-any.whl.

File metadata

File hashes

Hashes for ccbhc_measurements-2025.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 21f1c2a6ca24327bfd33aefc8ef011c1dd144d8bfd356a4d586c397ec02cc89a
MD5 6c184bfc8c0daf35f12705d19633af81
BLAKE2b-256 ce58613476cde1808c28758d2433e9f867c082c28f8bc8d239b0bb35aca96303

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