Skip to main content

Deterioration Allocation Index Framework

Project description

The Deterioration-Allocation Index: A framework for health inequality evaluation

PyPI - Python Version PyPI - Package Status PyPI - Latest Release PyPI - Wheel PyPI - License Ruff

Coverage Tests Passing Lines of Code Percentage Comments Snyk Package Health

This repository implements a DA-AUC (deterioration-allocation area under curve) metric for quantifying inequality between patient groups (a) embedded in datasets; or (b) induced by statistical / ML / AI models. This is analogous to ROC-AUC for assessing performance of prediction models.

Methodology

We define and quantify health inequalities in a generic resource allocation scenario using a novel deterioration-allocation framework. The basic idea is to define two indices: a deterioration index and an allocation index. The allocation index is to be derived from the model of interest.

Conceptually, models used in real-world contexts can be abstracted and thought of as resource allocators, predicting for example the probability of Intensive Care Unit (ICU) admission. Note that the models do not need to be particularly designed to allocate resources, for example, risk prediction of cardiovascular disease (CVD) among people with diabetes is also a valid index for downstream resource allocation. Essentially, a resource allocator is a computational model that takes patient data as input and outputs a (normalised) score between 0 and 1. We call this score the allocation index.

The deterioration index is a score between 0 and 1 to measure the deterioration status of patients. It can be derived from an objective measurement for disease prognosis (i.e., a marker of prognosis in epidemiology terminology), such as extensively used comorbidity scores or biomarker measurements like those for CVDs.

Figure 1

Once we have defined the two indices, each patient can then be represented as a point in a two-dimensional space of <allocation index, deterioration index>. A sample of the group of patients is then translated into a set of points in the space, for which a regression model can be fitted to approximate a curve in the space.

The area between the two curves is then the deterioration difference between their corresponding patient groups, quantifying the inequalities induced by the allocator, i.e., the model that produces the allocation index. The curve with the larger area under it represents the patient group which would be unfairly treated if the allocation index was to be used in allocating resources or services: a patient from this group would be deemed healthier than a patient from another group who is equally ill.

See the paper for more details: Quantifying Health Inequalities Induced by Data and AI Models.

Installation of the daindex python package

pip install daindex

Advanced install (for developers)

After cloning the repository, you can install the package for local development using uv:

uv sync
uv run pre-commit install

Usage

  1. Create sample data for testing

    import pandas as pd
    import numpy as np
    n_size = 100
    
    # generate female data
    female_mm = [int(m) for m in np.random.normal(3.2, .5, size=n_size)]
    df_female = pd.DataFrame(dict(mm=female_mm, gender=['f'] * n_size))
    df_female.head()
    
    # generate male data
    male_mm = [int(m) for m in np.random.normal(3, .5, size=n_size)]
    df_male = pd.DataFrame(dict(mm=male_mm, gender=['m'] * n_size))
    df_male.head()
    
    # merge dataframes
    df = pd.concat([df_female, df_male], ignore_index=True)
    
  2. Import the compare_two_groups function:

    from daindex.util import compare_two_groups
    
  3. Run inequality analysis between the female and male groups:

    compare_two_groups(
       df[df.gender=='f'], df[df.gender=='m'], 'mm',
       'female', 'male', '#Multimorbidity', 3, is_discrete=True
    )
    

    You will see something similar to.

    ({'overall-prob': 0.9999, 'one-step': 0.7199, 'k-step': 0.054609, '|in_matrix|': 100},
    {'overall-prob': 0.9999, 'one-step': 0.42, 'k-step': 0.03195, '|in_matrix|': 100},
    0.7092018779342724)
    

    The result means the inequality of female vs male is 0.709.

Tutorials

  • We provide a basic use case for the deterioration-allocation index: basic_tutorial.ipynb.
  • A more complex tutorial around the MEPS dataset is under construction: meps_tutorial.ipynb.
  • More tutorials will be added, including those for replicating studies on HiRID and MIMIC datasets.

Contact

honghan.wu@ucl.ac.uk or h.wilde@ucl.ac.uk

Reference

If using this package in your own work, please cite:

Honghan Wu, Aneeta Sylolypavan, Minhong Wang, and Sarah Wild. 2022. ‘Quantifying Health Inequalities Induced by Data and AI Models’. In IJCAI-ECAI, 6:5192–98. https://doi.org/10.24963/ijcai.2022/721.

Useful links: slides, recording, arxiv, proceedings.

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

daindex-0.8.1.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

daindex-0.8.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file daindex-0.8.1.tar.gz.

File metadata

  • Download URL: daindex-0.8.1.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for daindex-0.8.1.tar.gz
Algorithm Hash digest
SHA256 a102d721547d6cf53b15821e7417ad376b29f965719a2a9b0336ddd1f5aea74d
MD5 df4bdcc9ce440c33c38e3d61bd3816f9
BLAKE2b-256 0d3e755e5e71598dc1b440ad6a74c0499307579bbcccbc872bfbc17f888a88fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for daindex-0.8.1.tar.gz:

Publisher: pypi.yml on knowlab/daindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daindex-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: daindex-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for daindex-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 366fe50c5917f9c256c7f9af97e464063bc33782ba3078f0ddf3b46c05f55638
MD5 2ec9a8f10ae9b33df7a5623ef46b7ab9
BLAKE2b-256 dc4ca27a913f58e5922e0931b8c44546073cca3cde1165ac2a707e0c60ed8ab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for daindex-0.8.1-py3-none-any.whl:

Publisher: pypi.yml on knowlab/daindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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