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

Move PTAXSIM DB file to runner temp dir #36

Merged
merged 11 commits into from
May 3, 2024

Conversation

dfsnow
Copy link
Member

@dfsnow dfsnow commented May 3, 2024

This PR fixes two bugs related to our PTAXSIM CI integration. Mainly:

  • Newer versions of R seem to copy the contents of the package directory to a temporary folder when building a package. Usually this is fine, but GitHub runners only have a limited amount of disk space. The unzipped PTAXSIM DB file was being copied from the working directory to the temp build directory, exhausting the disk space on the runner. To fix this, I moved to the PTAXSIM DB file to the temp directory and pointed all connection strings to the new location.
  • One of the tests pulls a random selection of 1M PINs and compared the PTAXSIM-calculated tax bill to the real tax bill. This test was intermittently failing. The failure turned out to be due to a single agency/base combo that resulted in a NaN tax rate (divide by 0 error). I added a line to replace NaN values with 0 and added a test to catch future issues of the same nature.

@dfsnow dfsnow changed the title Move PTAXSIM db file to runner temp dir Move PTAXSIM DB file to runner temp dir May 3, 2024
@dfsnow dfsnow self-assigned this May 3, 2024
@dfsnow dfsnow marked this pull request as ready for review May 3, 2024 21:21
@@ -13,7 +13,7 @@ knitr::opts_chunk$set(

# Introduction

Property tax exemptions are savings that lower a homeowner’s property tax bill. They work by reducing or freezing the taxable value (Equalized Assessed Value, or EAV) of a home. For example, the most common exemption, the Homeowner Exemption, reduces EAV by \$10,000.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff is just extraneous cleanup from my built-in linter/fixers.

Comment on lines +44 to +50
```{r, echo=FALSE}
# This is needed to build the vignette using GitHub Actions
ptaxsim_db_conn <- DBI::dbConnect(
RSQLite::SQLite(),
Sys.getenv("PTAXSIM_DB_PATH")
)
```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vignettes need to point at the temp directory during build time, but I don't necessarily want to use the env var setup here since it's a bit confusing.

Copy link
Contributor

@jeancochrane jeancochrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, looks great! I don't totally get the different circumstances under which the database connection is supposed to be created for the vignettes, but I'm fine moving forward if you feel good about this pattern.

Comment on lines +54 to +58
# This is needed to build the vignette using GitHub Actions
ptaxsim_db_conn <- DBI::dbConnect(
RSQLite::SQLite(),
Sys.getenv("PTAXSIM_DB_PATH")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question, non-blocking] What's the relationship between this DBI::dbConnect() call and the one that precedes it on line 50? Is the idea just that this will overwrite the preceding ptaxsim_db_conn definition on CI, but locally we can skip this call and use the one on line 50 instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got it. This call is hidden in the actual output vignette HTML just because I think it's simpler to show a file path instead of an env var setup, but the env var is necessary for it to work on CI.

@dfsnow dfsnow merged commit f0b4b82 into master May 3, 2024
10 checks passed
@dfsnow dfsnow deleted the dfsnow/fix-ptaxsim-db-setup-action branch May 3, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants