medicaid_utils.adapted_algorithms.py_ed_pqi package

Submodules

medicaid_utils.adapted_algorithms.py_ed_pqi.ed_pqi module

This program creates claim level Potentially Preventable ED visit indicators (Sheryl Davies, Ellen Schultz et al 2017).

class medicaid_utils.adapted_algorithms.py_ed_pqi.ed_pqi.EDPreventionQualityIndicators[source]

Bases: object

data_folder = '/home/runner/work/medicaid-utils/medicaid-utils/medicaid_utils/adapted_algorithms/py_ed_pqi/data'
filename = 'ed_pqi.py'
classmethod flag_potentially_preventable_ed_visits(df_ed: DataFrame, df_ps: DataFrame, months_restricted: bool = False) DataFrame[source]

Flag potentially preventable ED visits using PQI criteria.

Categorizes ED visits by condition type (acute ACSC, chronic ACSC, dental, asthma, back pain), applies age and diagnosis-based exclusions, and aggregates counts and costs at the patient level.

Parameters:
  • df_ed (dask.DataFrame) – ED claims DataFrame with diagnosis and payment columns.

  • df_ps (dask.DataFrame) – Patient-level DataFrame with exclusion indicators.

  • months_restricted (bool, default=False) – Whether to restrict to valid enrollment months.

Returns:

Patient-level DataFrame with PQI ED visit count and cost columns.

Return type:

dask.DataFrame

Examples

>>> # Requires ED and PS dask DataFrames with required columns
>>> df_ed = EDPreventionQualityIndicators.flag_potentially_preventable_ed_visits(
...     df_ed, df_ps, months_restricted=False)
classmethod get_patient_exclusion_indicators(df_ip: DataFrame, df_ot: DataFrame, df_ps: DataFrame) DataFrame[source]

Generate patient-level exclusion indicators for ED PQI measures.

Flags disease-related diagnoses across IP and OT claims, aggregates them to the patient level, and merges with the PS (personal summary) file.

Parameters:
  • df_ip (dask.DataFrame) – Inpatient claims DataFrame.

  • df_ot (dask.DataFrame) – Outpatient claims DataFrame.

  • df_ps (dask.DataFrame) – Personal summary DataFrame with demographic columns.

Returns:

Patient-level DataFrame with exclusion indicator columns.

Return type:

dask.DataFrame

Examples

>>> # Requires IP, OT, and PS dask DataFrames with diagnosis columns
>>> df_ps = EDPreventionQualityIndicators.get_patient_exclusion_indicators(
...     df_ip, df_ot, df_ps)
package_folder = '/home/runner/work/medicaid-utils/medicaid-utils/medicaid_utils/adapted_algorithms/py_ed_pqi'
medicaid_utils.adapted_algorithms.py_ed_pqi.ed_pqi.fix_index(df: DataFrame, index_name: str, drop_column: bool = True) DataFrame[source]

Set or fix the index of a dask DataFrame.

Ensures the DataFrame is indexed by the specified column. If the DataFrame already has the correct index with known divisions, it optionally drops or keeps the index column.

Parameters:
  • df (dask.DataFrame) – Input dask DataFrame.

  • index_name (str) – Name of the column to use as the index.

  • drop_column (bool, default=True) – Whether to drop the index column from the DataFrame columns.

Returns:

DataFrame with the specified index set.

Return type:

dask.DataFrame

Examples

>>> # Requires a dask DataFrame with an 'MSIS_ID' column
>>> df = fix_index(df, 'MSIS_ID')
medicaid_utils.adapted_algorithms.py_ed_pqi.ed_pqi.get_ed_pqis(df_ip: DataFrame, df_ot: DataFrame, df_ps: DataFrame, df_ed: DataFrame, restrict_months: bool = False) DataFrame[source]

Compute ED Prevention Quality Indicators for a given set of claims.

This is the main entry point that creates patient-level exclusion indicators from IP and OT claims, then flags potentially preventable ED visits.

Parameters:
  • df_ip (dask.DataFrame) – Inpatient claims DataFrame.

  • df_ot (dask.DataFrame) – Outpatient claims DataFrame.

  • df_ps (dask.DataFrame) – Personal summary DataFrame.

  • df_ed (dask.DataFrame) – ED claims DataFrame.

  • restrict_months (bool, default=False) – Whether to restrict to valid enrollment months.

Returns:

Patient-level DataFrame with ED PQI measures.

Return type:

dask.DataFrame

Examples

>>> # Requires IP, OT, PS, and ED dask DataFrames
>>> df_ed_pqi = get_ed_pqis(df_ip, df_ot, df_ps, df_ed)