pdc-calculator


Namepdc-calculator JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryA package to facilitate efficient and accurate calculation of the medication adherence metric "Proportion of Days Covered" or "PDC".
upload_time2023-05-04 04:19:02
maintainer
docs_urlNone
authorDaniel Famutimi MD, MPH
requires_python
licenseMIT
keywords pdc calculator medication adherence
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            The purpose of this package is to provide a python-native means to calculate a common industry metric for medication adherence, Proportion of Days Covered (PDC). Much of the healthcare analytics industry is transitioning from SAS and are working to replicate such fundametal metrics in new environments. The goal is to offer one less thing that needs to be rebuilt from scratch, and hopefully make work easier for business analysts in the healthcare ecosystem.

I followed the original implementation logic of PDC in SAS, this can be found at https://support.sas.com/resources/papers/proceedings13/167-2013.pdf 

This paper offers a gentle yet detailed introduction to the topic, and will serve as a reference to anyone new to the subject.

More updates such as multiprocessing to follow in future developments.

Please use as described below:

**PARAMETERS:**

**dataframe** - *A pandas dataframe containing the required columns described below.*

**patient_id_col** - *A unique patient identifier. Format = STRING or INTEGER*

**drugname_col** - *The name of the drug being filled or drug class or Generic name, per usual PDC requirements. Format = STRING*

**filldate_col** - *The date of the fill being dispensed. Format = DATE*

**supply_days_col** - *Days of supply being dispensed at fill. Format = INTEGER*

**mbr_elig_start_dt_col** - *First date of coverage eligiblity for patient or a reference START DATE. Format = DATE*

**MBRELIGEND** - *Last date of coverage eligiblity for patient or a reference END DATE. Format = DATE*

**Returns** - *A Pandas dataframe containing the following columns*

**patient_id_col** - *This will return a column name representing a unique patient identifier as provided in original input dataframe. FORMAT = STRING*

**drugname_col** - *The name of the drug being filled or drug class or Generic name, as provided in original input dataframe.*

**DAYSCOVERED**- *The number of unique days of drug coverage, after shifting coverage to accommodate early refills. FORMAT = INTEGER*

**TOTALDAYS** - *The total number of days in patient analysis window. Set to 0 if days of coverage is 0. FORMAT = INTEGER*

**PDC_SCORE** - *The patient's PDC score, calculated as DAYSCOVERED / TOTALDAYS. Set to 0 if days of coverage is 0. FORMAT = FLOAT*





**USAGE EXAMPLE**
```python

#  Import required libraries
import pandas as pd
import numpy as np
from pdc_calculator import PDC_Calculator

# Create a sample dataframe
df = pd.DataFrame({
    'MCID': ['A', 'A', 'A', 'B', 'B', 'B'],
    'DRUGNAME': ['X', 'X', 'X', 'Y', 'Y', 'Y'],
    'RX_FILLED_DT': pd.to_datetime(['2022-01-01', '2022-01-21', '2022-03-20',
                                '2022-01-01', '2022-02-01', '2022-03-01']),
    'DAYS_SPLY_NBR': [30, 30, 30, 30, 30, 30],
    'START_DT': pd.to_datetime(['2022-01-01', '2022-01-01', '2022-01-01',
                                         '2022-02-01', '2022-02-01', '2022-02-01']),
    'END_DT': pd.to_datetime(['2022-03-31', '2022-03-31', '2022-03-31',
                                       '2022-03-31', '2022-03-31', '2022-03-31'])
})

# Inspect sample data
df.head(n=len(df))

# calculate PDC scores on the input DataFrame
pdc_calculator = PDC_Calculator(dataframe=df, patient_id_col='MCID', drugname_col='DRUGNAME'
                                         , filldate_col='RX_FILLED_DT', supply_days_col='DAYS_SPLY_NBR'
                                         , mbr_elig_start_dt_col='START_DT', mbr_elig_end_dt_col='END_DT')
pdc_scores_df = pdc_calculator.calculate_pdc()

# Inspect output
pdc_scores_df.head()




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pdc-calculator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pdc calculator medication adherence",
    "author": "Daniel Famutimi MD, MPH",
    "author_email": "danielfamutimi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ac/96/a8f172b08abc35ac3b633887e26c16968b8e1a3b74c6f4b9928cfc4d6498/pdc_calculator-1.0.4.tar.gz",
    "platform": null,
    "description": "The purpose of this package is to provide a python-native means to calculate a common industry metric for medication adherence, Proportion of Days Covered (PDC). Much of the healthcare analytics industry is transitioning from SAS and are working to replicate such fundametal metrics in new environments. The goal is to offer one less thing that needs to be rebuilt from scratch, and hopefully make work easier for business analysts in the healthcare ecosystem.\n\nI followed the original implementation logic of PDC in SAS, this can be found at https://support.sas.com/resources/papers/proceedings13/167-2013.pdf \n\nThis paper offers a gentle yet detailed introduction to the topic, and will serve as a reference to anyone new to the subject.\n\nMore updates such as multiprocessing to follow in future developments.\n\nPlease use as described below:\n\n**PARAMETERS:**\n\n**dataframe** - *A pandas dataframe containing the required columns described below.*\n\n**patient_id_col** - *A unique patient identifier. Format = STRING or INTEGER*\n\n**drugname_col** - *The name of the drug being filled or drug class or Generic name, per usual PDC requirements. Format = STRING*\n\n**filldate_col** - *The date of the fill being dispensed. Format = DATE*\n\n**supply_days_col** - *Days of supply being dispensed at fill. Format = INTEGER*\n\n**mbr_elig_start_dt_col** - *First date of coverage eligiblity for patient or a reference START DATE. Format = DATE*\n\n**MBRELIGEND** - *Last date of coverage eligiblity for patient or a reference END DATE. Format = DATE*\n\n**Returns** - *A Pandas dataframe containing the following columns*\n\n**patient_id_col** - *This will return a column name representing a unique patient identifier as provided in original input dataframe. FORMAT = STRING*\n\n**drugname_col** - *The name of the drug being filled or drug class or Generic name, as provided in original input dataframe.*\n\n**DAYSCOVERED**- *The number of unique days of drug coverage, after shifting coverage to accommodate early refills. FORMAT = INTEGER*\n\n**TOTALDAYS** - *The total number of days in patient analysis window. Set to 0 if days of coverage is 0. FORMAT = INTEGER*\n\n**PDC_SCORE** - *The patient's PDC score, calculated as DAYSCOVERED / TOTALDAYS. Set to 0 if days of coverage is 0. FORMAT = FLOAT*\n\n\n\n\n\n**USAGE EXAMPLE**\n```python\n\n#  Import required libraries\nimport pandas as pd\nimport numpy as np\nfrom pdc_calculator import PDC_Calculator\n\n# Create a sample dataframe\ndf = pd.DataFrame({\n    'MCID': ['A', 'A', 'A', 'B', 'B', 'B'],\n    'DRUGNAME': ['X', 'X', 'X', 'Y', 'Y', 'Y'],\n    'RX_FILLED_DT': pd.to_datetime(['2022-01-01', '2022-01-21', '2022-03-20',\n                                '2022-01-01', '2022-02-01', '2022-03-01']),\n    'DAYS_SPLY_NBR': [30, 30, 30, 30, 30, 30],\n    'START_DT': pd.to_datetime(['2022-01-01', '2022-01-01', '2022-01-01',\n                                         '2022-02-01', '2022-02-01', '2022-02-01']),\n    'END_DT': pd.to_datetime(['2022-03-31', '2022-03-31', '2022-03-31',\n                                       '2022-03-31', '2022-03-31', '2022-03-31'])\n})\n\n# Inspect sample data\ndf.head(n=len(df))\n\n# calculate PDC scores on the input DataFrame\npdc_calculator = PDC_Calculator(dataframe=df, patient_id_col='MCID', drugname_col='DRUGNAME'\n                                         , filldate_col='RX_FILLED_DT', supply_days_col='DAYS_SPLY_NBR'\n                                         , mbr_elig_start_dt_col='START_DT', mbr_elig_end_dt_col='END_DT')\npdc_scores_df = pdc_calculator.calculate_pdc()\n\n# Inspect output\npdc_scores_df.head()\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to facilitate efficient and accurate calculation of the medication adherence metric \"Proportion of Days Covered\" or \"PDC\".",
    "version": "1.0.4",
    "project_urls": null,
    "split_keywords": [
        "pdc",
        "calculator",
        "medication",
        "adherence"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "519170bdd6babe86a34c4432d146355853518f27c2268ae6f3343f52535be254",
                "md5": "324efd03b2b92885184dd1e009335061",
                "sha256": "178e60c9568587bcb01448ab70f31438b6b32f00838af6a8a60897e9f6b01003"
            },
            "downloads": -1,
            "filename": "pdc_calculator-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "324efd03b2b92885184dd1e009335061",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3609,
            "upload_time": "2023-05-04T04:19:00",
            "upload_time_iso_8601": "2023-05-04T04:19:00.359072Z",
            "url": "https://files.pythonhosted.org/packages/51/91/70bdd6babe86a34c4432d146355853518f27c2268ae6f3343f52535be254/pdc_calculator-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac96a8f172b08abc35ac3b633887e26c16968b8e1a3b74c6f4b9928cfc4d6498",
                "md5": "ccb7e7c938408ab022d69b3a2a15b842",
                "sha256": "9dcbabef68a29b74db81365a6a3b05d4569e46567ac774e04d41d0e526da71f0"
            },
            "downloads": -1,
            "filename": "pdc_calculator-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ccb7e7c938408ab022d69b3a2a15b842",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3836,
            "upload_time": "2023-05-04T04:19:02",
            "upload_time_iso_8601": "2023-05-04T04:19:02.141670Z",
            "url": "https://files.pythonhosted.org/packages/ac/96/a8f172b08abc35ac3b633887e26c16968b8e1a3b74c6f4b9928cfc4d6498/pdc_calculator-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-04 04:19:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pdc-calculator"
}
        
Elapsed time: 0.24033s