Package: pdcscore
README.mdThe objective of this package is to offer a Python-based solution for computing the Proportion of Days Covered (PDC), a widely used metric in the healthcare industry to evaluate medication adherence. As the healthcare analytics sector shifts away from SAS, there is a growing need to recreate key metrics in alternative platforms. This package aims to simplify the process and reduce the workload for business analysts in the healthcare ecosystem by providing a readily available PDC calculation tool, thereby eliminating the need to build it from scratch.Please use as described below:INPUT PARAMETERS:dataframe-A pandas dataframe containing the required columns described below.patient_id_col-A unique patient identifier. Format = STRING or INTEGERdrugname_col-The name of the drug being filled or drug class or Generic name, per usual PDC requirements. Format = STRINGfilldate_col-The date of the fill being dispensed. Format = DATEsupply_days_col-Days of supply being dispensed at fill. Format = INTEGERmsr_start_dt_col-start date of measurement period for the patient or a reference START DATE. Format = DATEmsr_end_dt_col-end date of measurement period for the patient or a reference END DATE. Format = DATEoverlap_adjustment-Set to True to accommodate early refills, otherwise set to FalseOUTPUT DATAFRAME-A Pandas dataframe containing the following columnspatient_id_col-This will return a column name representing a unique patient identifier as provided in original input dataframe. FORMAT = STRINGdrugname_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. FORMAT = INTEGERtotaldays-The total number of days in patient analysis window. Set to 0 if days of coverage is 0. FORMAT = INTEGERpdc_score-The patient's PDC score, calculated as dayscovered / totaldays. Set to 0 if days of coverage is 0. FORMAT = FLOATUSAGE EXAMPLE#  Import required librariesimportpandasaspdimportnumpyasnpfromdatetimeimportdatetimefrompdcscoreimportpdcCalc# Create a sample dataframedf=pd.DataFrame({'patient_id':['A001','A001','A001','B001','B001','B001','C001','C001','C001','C001','C001','C001'],'drugname':['DRUG_X','DRUG_X','DRUG_X','DRUG_Y','DRUG_Y','DRUG_Y','DRUG_Y','DRUG_Y','DRUG_Y','DRUG_Z','DRUG_Z','DRUG_Z'],'filldate':pd.to_datetime(['2021-10-21','2022-01-21','2022-03-20','2022-01-01','2022-02-01','2022-03-01','2022-02-18','2022-03-01','2022-03-22','2021-06-18','2022-02-11','2022-03-05']),'supply_days':[90,30,30,30,30,30,30,30,30,30,30,30],'msr_start_dt':pd.to_datetime(['2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01','2022-01-01']),'msr_end_dt':pd.to_datetime(['2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31','2022-03-31'])})# Inspect sample datadf.head(n=len(df))# calculate PDC scores on the input DataFramecalcfunc=pdcCalc(dataframe=df,patient_id_col='patient_id',drugname_col='drugname',filldate_col='filldate',supply_days_col='supply_days',msr_start_dt_col='msr_start_dt',msr_end_dt_col='msr_end_dt',overlap_adjustment=True)# Set to True to adjust for early refillspdc_scores_df=calcfunc.calculate_pdc()# Inspect outputpdc_scores_df.head()