Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USP Drug Classification data dictionary + tidying #33

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ac875b1
Data Wrangling for Drug Use Visualizations (#24)
dhuppenkothen Feb 3, 2017
df5ae74
Script for data reading/wrangling (#25)
dhuppenkothen Feb 4, 2017
a471e83
Small bug fix to remove hard-coded directory paths (#28)
dhuppenkothen Feb 4, 2017
0228bbb
Markdown version of goals statement - first draft.
jenniferthompson Feb 5, 2017
03bfc17
add USP drug classification tidying and data dictionary
cduvallet Feb 5, 2017
b5f2cda
Added anchor for citations and superscripted refs
mattgawarecki Feb 6, 2017
3ac353d
Merge pull request #29 from jenniferthompson/master
jenniferthompson Feb 6, 2017
1cbf1e2
Cleaning drug manufacturer data
Feb 6, 2017
c6e4f2b
move USP Drug Classification to
cduvallet Feb 7, 2017
dcd95fa
clarify usp drug classification data dict info
cduvallet Feb 7, 2017
53563a4
small changes
cduvallet Feb 7, 2017
dc023fd
update links
cduvallet Feb 7, 2017
8fc78cf
small changes
cduvallet Feb 7, 2017
c105869
Merge pull request #31 from skirmer/master
jenniferthompson Feb 7, 2017
8a15e47
download from data.world, clean up functions, add comments
cduvallet Feb 8, 2017
b675cdf
Merge pull request #35 from Data4Democracy/data-dictionaries
jenniferthompson Feb 8, 2017
468a753
added direct link to the datasets of interest
Feb 8, 2017
aa1e34d
Merge pull request #39 from selahlynch/patch-1
jenniferthompson Feb 8, 2017
5712435
Restructuring of repo (#36)
jenniferthompson Feb 9, 2017
cc445b2
Add @skirmer to maintainers!
jenniferthompson Feb 9, 2017
22db3e7
Correct directory name for datadictionaries
jenniferthompson Feb 9, 2017
02b95af
Add link to objectives doc
jenniferthompson Feb 9, 2017
62c92b9
Update datadictionaries/README.md to reflect updated repo structure
jenniferthompson Feb 9, 2017
c7fdbe1
Merge branch 'master' into data-dictionaries
cduvallet Feb 13, 2017
e63ff4d
update files to reflect repo structure changes
cduvallet Feb 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ ENV/
# Mac OS files
.DS_Store
.Rproj.user

10 changes: 10 additions & 0 deletions R/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## R

All R scripts and notebooks are here! Organizational structure:

- `analysis-vis`: Analyses and visualizations
- `apps`: Shiny app files (subfolder for each)
- `d4ddrugspending`: Anything that could be put in an R package - for example, functions to join specific datasets in our project
- `datawrangling`: Dataset-specific scripts to collect and clean

Note that data.world has an [R client](https://github.com/datadotworld/data.world-r)! This makes it easy to import data directly from our repo there.
5 changes: 5 additions & 0 deletions R/analysis-vis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## analysis-vis

Analysis and visualization scripts/Rmd files.

Note that data.world has a [R client](https://github.com/datadotworld/data.world-r)! Great for importing datasets directly from our repo there.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ library(jsonlite)

```{r load_spending_data}
## -- Spending data --------------------------------------------------------------------------------
## Read in drug names (brand + generic)
drugnames <- read_feather('data/drugnames.feather')

## Function to add a column with spending year to a data frame
add_drug_year <- function(df, yr){
mutate(df, drug_year = yr)
Expand All @@ -27,9 +24,8 @@ add_drug_year <- function(df, yr){
drug.years <- 2011:2015

## Read in each year's data set, add year and drug names, and combine into a single data.frame
spending.data <- map(paste0('data/spending-', drug.years, '.feather'), read_feather) %>%
spending.data <- map(paste0('dataworld/spending-', drug.years, '.feather'), read_feather) %>%
map2(drug.years, add_drug_year) %>%
map(bind_cols, drugnames) %>%
bind_rows()

```
Expand All @@ -39,6 +35,24 @@ head(spending.data)

```

```{r load_atc}
atc.data <- read.csv('dataworld/atc-codes.csv')
head(atc.data)
```

```{r check_drug_uses}
matt.drug.uses <- read_feather('dataworld/drug_uses.feather')

matt.drug.uses

```

```{r dig}
length(intersect())

```


```{r combine_generics}
## -- Combine data by year for all brand names for the same generic --------------------------------
spending.data.bygeneric <- spending.data %>%
Expand Down Expand Up @@ -95,6 +109,18 @@ head(therapeutic.areas)

```

# Try to merge therapeutic classes with drug names
```{r join_class_names}
library(fuzzyjoin)

## Need to extract generic names from name column

# ## -- Separate generic and brand names in therapeutic.areas ----------------------------------------
# therapeutic.areas <- therapeutic.areas %>%
# separate(name, into = c('brand', 'generic'), sep = ' \\(', remove = FALSE, fill = )

```

# Out-of-pocket cost over time for low-income vs non-low-income users of aripiprazole (Aricept)
```{r plot_aripiprazole}
plotdata <- spending.data.bygeneric %>%
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions R/apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## apps

Scripts for R Shiny apps. Store each app in a separate subdirectory.

Note that data.world has a [R client](https://github.com/datadotworld/data.world-r)! Great for importing datasets directly from our repo there.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading