Metadata-Version: 2.1
Name: pharmacy
Version: 0.4.9
Summary: A set of utilities for use with hospital and retail pharmacy data to deal with common pharmacy operations problems.
License: AGPL-3.0-or-later
Author: Danny Limoges
Author-email: drlimoges@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: pandas (>=1.00.0,<2.0.0)
Requires-Dist: thefuzz (>=0.20.0,<0.21.0)
Description-Content-Type: text/markdown

 [comment]: <>  ( __version__ = '0.4.9'  )
 
# *pharmacy*
[![Package Status](https://img.shields.io/pypi/status/pharmacy.svg)](https://pypi.org/project/pharmacy/)
[![PyPI Latest Release](https://img.shields.io/pypi/v/pharmacy.svg)](https://pypi.org/project/pharmacy/)
[![License](https://img.shields.io/pypi/l/pharmacy.svg)](https://github.com/PyPharm/pypharm/LICENSE/blob/main/LICENSE)
[![Downloads](https://static.pepy.tech/badge/pharmacy/month)](https://pepy.tech/project/pharmacy)

A hospital and retail pharmacy-focused Python package by Danny Limoges, PharmD. 

## <span style="color:red">*This project is in the alpha/planning stage.*</span>

## Installation
Available on PyPI as an installable package:  https://pypi.org/project/pharmacy/
```
  pip install pharmacy
```
## What is it?
This is a collection of modular utilities that aid in processing pharmacy data.  Users must perform their
own data validation to ensure that results generated by pharmacy are accurate 
and that the correct data was inputted.

## What is it *not*?
*pharmacy* is not a pharmacy management system and does not replace Epic, Meditech, Pioneer or any other pharmacy software.
 
# Syntax
 
## find_best_matches
 Get a **fuzzy match** between two DataFrames and combine them where matched.
 
**Output:** pandas DataFrame.  All rows from df_orig are kept and their corresponding matches are tacked onto the end if they  meet the match threshold.
 
```python
import pharmacy as rx
import pandas as pd

df_out = rx.find_best_matches(
                  df_orig       # Original pandas DataFrame 
                  , df2         # DataFrame to match against
                  , match_col   # Which column to examine in original DataFrame
                  , match_col_comparator = None   # The column name to compare
                  , threshold=80    # Only accept matches above this fuzzy match threshold.
                  , scorer=fuzz.token_set_ratio # Which type of fuzzy match? 
                                                # options: ratio, partial_ratio, token_sort_ratio, token_set_ratio
                  )
```
For more information on fuzzy match types, check out this article:
 
[Understanding Fuzzy String Matching: Exploring Fuzz Ratio, Fuzz Partial Ratio, Token Set Ratio, and Token Sort Ratio: Machine Learning Concept 78, by 
Chandra Prakash Bathula](https://medium.com/@chandu.bathula16/understanding-fuzzy-string-matching-exploring-fuzz-ratio-fuzz-partial-ratio-token-set-ratio-and-d6892430f53c)

### Example
```python
>>> import pandas as pd
>>> import pharmacy as rx
>>> df = pd.DataFrame(
...     [('10000-1000-10','Acetaminophen 325mg',),
...     ('20000-2000-30','Lisinopril 10mg','7'),
...     ('30000-3000-30','Tylenol #3','c5'),
...      ], columns = ['ndc','description','schedule'])
```


## Potential Future Goals
Tools to work on data from...
- Drug data
  - Use fuzzy and exact-matching to align different drug data files. 
  - Pricing
  - Generic Equivalents
  - Usage
  - Shortages and availability
- Patient profiles
  - Demographics
  - Geolocation
- Prescription data
  - Fills
  - Claims
    - Loss analysis
    - Opportunity analysis
- **Modeling**
  - Integrate pharmacy data with TensorFlow
  - Generate large-scale insights
  - Predict the outcomes of new clinical services based on current data
- **Integration**
  - Incorporate data from ordering sites, etc.

  

[comment]: https://fontawesome.com/icons/hospital?s=thin


