# Code for Traditional and GenAI Text Analysis of COVID-19 Pandemic Trends in Hospital Community Benefits IRS Documentation

This directory includes the code and output for the manuscript "Traditional and GenAI Text Analysis of COVID-19 Pandemic Trends in Hospital Community Benefits IRS Documentation". 

## SetUp

The `requirements.txt` file includes the required Python packages for this work.

If planning to run the GenAI analysis, the user will need an [OpenAI API key](https://openai.com/index/openai-api/) saved in a .ENV file called 'API_KEY'. Running this analysis will cost money at current OpenAI API rates.

## Data

The data is available with a license from RTI International. RTI cleans and prepares unstructured data collected by the IRS.

## Traditional Text Methods

The main analysis and figures are created with:

1. `notebook_main.ipynb`
2. `notebook_revise_and_resubmit_additions.ipynb`

The output from these analyses is available in the respective PDF files:
1. `notebook_main.pdf` (includes Table 1)
2. `notebook_revise_and_resubmit_additions.pdf` (includes Figures 2 and 3)

## GenAI Analysis
The GenAI analysis is available in `cbi_genai_analysis_r_and_r.py`.

Because this analysis requires an OpenAI API Key and funds to replicate, we have also included screenshots of the test version of this process running in `Screenshots.docx`. The full manuscript output is available in `summary_of_summaries_covid_cancelled.xlsx` and `summary_of_summaries_covid_changes.xlsx`.

## Contact
Please contact corresponding author Emily Hadley at `ehadley@rti.org` with any questions.
