-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from all commits
61e2c23
7187651
07ee0d0
17aa118
1ef09bd
2075869
44ffd30
c2b08c1
6201d2f
1ad97b0
0f1d266
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ inputs: | |
ASSUMED_ROLE: | ||
description: AWS role used for S3 actions | ||
outputs: | ||
PTAXSIM_DB_DIR: | ||
description: "PTAXSIM database directory on runner" | ||
value: ${{ steps.set_db_dir.outputs.PTAXSIM_DB_DIR }} | ||
PTAXSIM_VERSION: | ||
description: "PTAXSIM database version" | ||
value: ${{ steps.version_db.outputs.PTAXSIM_VERSION }} | ||
|
@@ -18,6 +21,14 @@ runs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set database directory | ||
id: set_db_dir | ||
run: | | ||
PDIR=$RUNNER_TEMP | ||
echo "PTAXSIM_DB_DIR=$PDIR" >> $GITHUB_ENV | ||
echo "PTAXSIM_DB_DIR=$PDIR" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Get database version | ||
id: version_db | ||
run: | | ||
|
@@ -30,7 +41,7 @@ runs: | |
uses: actions/[email protected] | ||
id: cache_db | ||
with: | ||
path: ptaxsim.db.bz2 | ||
path: ${{ env.PTAXSIM_DB_DIR }}/ptaxsim.db.bz2 | ||
key: ${{ format('{0}-{1}', env.PTAXSIM_VERSION, hashFiles('DESCRIPTION')) }} | ||
enableCrossOsArchive: true | ||
|
||
|
@@ -47,23 +58,27 @@ runs: | |
run: | | ||
aws s3 cp ${{ inputs.PTAXSIM_DB_BASE_URI }}/ptaxsim-${{ env.PTAXSIM_VERSION }}.db.bz2 ptaxsim.db.bz2 --quiet | ||
shell: bash | ||
working-directory: ${{ env.PTAXSIM_DB_DIR }} | ||
|
||
- name: Unpack database (Linux) | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get install -y pbzip2 | ||
pbzip2 -dk ${{ github.workspace }}/ptaxsim.db.bz2 | ||
pbzip2 -dk ptaxsim.db.bz2 | ||
shell: bash | ||
working-directory: ${{ env.PTAXSIM_DB_DIR }} | ||
|
||
- name: Unpack database (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install pbzip2 | ||
pbzip2 -dk ${{ github.workspace }}/ptaxsim.db.bz2 | ||
pbzip2 -dk ptaxsim.db.bz2 | ||
shell: bash | ||
working-directory: ${{ env.PTAXSIM_DB_DIR }} | ||
|
||
- name: Unpack database (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
7z x ${{ github.workspace }}\ptaxsim.db.bz2 | ||
7z x ptaxsim.db.bz2 | ||
shell: cmd | ||
working-directory: ${{ env.PTAXSIM_DB_DIR }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This stuff is just extraneous cleanup from my built-in linter/fixers. |
||
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. | ||
|
||
Once the exemption EAV has been subtracted from the property's EAV, the final EAV is multiplied by the local tax rate to get the final property tax bill. Since local tax rates can vary significantly by area, the actual effective value of each exemption likewise varies geographically. | ||
|
||
|
@@ -41,6 +41,14 @@ library(ptaxsim) | |
ptaxsim_db_conn <- DBI::dbConnect(RSQLite::SQLite(), here("./ptaxsim.db")) | ||
``` | ||
|
||
```{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") | ||
) | ||
``` | ||
|
||
The PIN we'll use is **25-32-114-005-0000**, the same PIN whose bill is shown above. This is a small, single-family property in Calumet with a very typical exemption situation, just a Homeowner Exemption. | ||
|
||
We can use the `tax_bill()` function to get every bill for this PIN from the last 15 years. These bills will _include_ any reduction from exemptions the PIN received. | ||
|
@@ -183,7 +191,7 @@ The exemption amount for this PIN has increased in tandem with increases in the | |
|
||
We can also use PTAXSIM to answer hypotheticals. For example, how would this PIN's bill history change if the Homeowner Exemption increased from \$10,000 to \$15,000 in 2018? | ||
|
||
To find out, we again create a modified PIN input to pass to `tax_bill()`. This time, we increase the Homeowner Exemption to $15,000 for all years after 2018. | ||
To find out, we again create a modified PIN input to pass to `tax_bill()`. This time, we increase the Homeowner Exemption to $15,000 for all years after 2018. | ||
|
||
```{r} | ||
exe_dt_2 <- lookup_pin(2006:2020, "25321140050000") %>% | ||
|
@@ -293,7 +301,7 @@ We're using `data.table` syntax here because it's much faster than `dplyr` when | |
t_bills_w_exe <- tax_bill(t_years, t_pins)[, stage := "With exemptions"] | ||
``` | ||
|
||
Unlike a single PIN, removing exemptions from many PINs means that the base (the amount of total taxable value available) will change substantially. In order to accurately model the effect of removing exemptions, we need to fully recalculate the base of each district by adding the sum of taxable value recovered from each PIN. | ||
Unlike a single PIN, removing exemptions from many PINs means that the base (the amount of total taxable value available) will change substantially. In order to accurately model the effect of removing exemptions, we need to fully recalculate the base of each district by adding the sum of taxable value recovered from each PIN. | ||
|
||
To start, we use the `lookup_pin()` function to recover the total EAV of exemptions for each PIN. | ||
|
||
|
@@ -367,7 +375,7 @@ t_no_exe_summ <- rbind(t_bills_w_exe, t_bills_no_exe)[ | |
] | ||
``` | ||
|
||
Finally, we can plot the average bill with and without exemptions by property type. | ||
Finally, we can plot the average bill with and without exemptions by property type. | ||
|
||
<details> | ||
|
||
|
@@ -427,7 +435,7 @@ Exemptions in Calumet have significantly increased in both volume and amount (vi | |
|
||
Conversely, Calumet's commercial property owners have picked up an increasingly large share of the overall tax burden since 2006. In 2019, the average commercial property paid about $1,100 more than they would have if exemptions did not exist. | ||
|
||
## Changing exemptions | ||
## Changing exemptions | ||
|
||
PTAXSIM can also answer hypotheticals about large areas. For example, how would the average residential tax bill in Calumet change if the Senior Exemption increased by $5,000 and the Senior Freeze Exemption was removed? | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,14 @@ library(tidyr) | |
ptaxsim_db_conn <- DBI::dbConnect(RSQLite::SQLite(), here("./ptaxsim.db")) | ||
``` | ||
|
||
```{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") | ||
) | ||
``` | ||
Comment on lines
+44
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
## Single taxing district | ||
|
||
We're going to use the the Village of Ford Heights as our example taxing district, since it's relatively small and uncomplicated. | ||
|
@@ -362,7 +370,7 @@ fhm_pins <- DBI::dbGetQuery( | |
) | ||
``` | ||
|
||
This gives us about 2,300 PINs, roughly 300 more than the Village of Ford Heights has alone. We can fetch and prepare the geometries the same way we did for the single district case. | ||
This gives us about 2,300 PINs, roughly 300 more than the Village of Ford Heights has alone. We can fetch and prepare the geometries the same way we did for the single district case. | ||
|
||
```{r} | ||
fhm_pins_geo <- lookup_pin10_geometry( | ||
|
There was a problem hiding this comment.
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 precedingptaxsim_db_conn
definition on CI, but locally we can skip this call and use the one on line 50 instead?There was a problem hiding this comment.
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.