Skip to content

Commit

Permalink
Fix README Mermaid diagram (#38)
Browse files Browse the repository at this point in the history
* Add workflow steps to build mermaid diag

* Move big mermaid diag to dedicated file

* Move mermaid output to GH pages dir

* Update diagram output location

* Add link to rendered mermaid

* Update file path for output mermaid diags

* Move all diags to dedicated workflow
  • Loading branch information
dfsnow authored Jun 12, 2024
1 parent f505712 commit 10b598c
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 622 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,27 @@ jobs:
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Setup node
uses: actions/setup-node@v4

- name: Install docs build dependencies
run: npm install -g @mermaid-js/mermaid-cli

- name: Prepare Mermaid assets for docs
run: |
for file in inst/mermaid/*.mmd; do
mmdc -i "$file" -o "${file/.mmd/.svg}"
done
mkdir -p docs/mermaid
mv inst/mermaid/*.svg docs/mermaid
working-directory: ${{ env.PROJECT_DIR }}
shell: bash

- name: Configure pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'

Expand Down
302 changes: 4 additions & 298 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -253,305 +253,11 @@ The PTAXSIM backend database contains cleaned data from the Cook County Clerk, T

### Database diagram

<details>

<summary><strong>Click here</strong> to show full database diagram</summary>

```mermaid
erDiagram
agency {
int year PK
varchar agency_num PK
boolean home_rule_ind
int agg_ext_base_year
bigint lim_numerator
bigint lim_denominator
double lim_rate
bigint prior_eav
bigint curr_new_prop
bigint cty_cook_eav
bigint cty_dupage_eav
bigint cty_lake_eav
bigint cty_will_eav
bigint cty_kane_eav
bigint cty_mchenry_eav
bigint cty_dekalb_eav
bigint cty_grundy_eav
bigint cty_kankakee_eav
bigint cty_kendall_eav
bigint cty_lasalle_eav
bigint cty_livingston_eav
bigint cty_total_eav
double pct_burden
bigint total_levy
bigint total_max_levy
double total_prelim_rate
bigint total_reduced_levy
bigint total_final_levy
double total_final_rate
varchar reduction_type
double reduction_pct
double total_non_cap_ext
double total_ext
}
agency_info {
varchar agency_num PK
varchar agency_name
varchar agency_name_short
varchar agency_name_original
varchar major_type
varchar minor_type
}
agency_fund {
int year PK
varchar agency_num PK
varchar fund_num PK
bigint levy
double loss_pct
bigint levy_plus_loss
double rate_ceiling
bigint max_levy
double prelim_rate
bigint ptell_reduced_levy
boolean ptell_reduced_ind
bigint final_levy
double final_rate
}
agency_fund_info {
varchar fund_num PK
varchar fund_name
boolean capped_ind
}
cpi {
int year
double cpi
double ptell_cook
int levy_year PK
}
eq_factor {
int year PK
double eq_factor_tentative
double eq_factor_final
}
metadata {
varchar db_version
varchar requires_pkg_version
varchar created_with_pkg_version
varchar created_at
varchar created_by
varchar author_name
varchar author_email
varchar source_url_database
varchar source_url_package
int data_year_min
int data_year_max
}
pin {
int year PK
varchar pin PK
varchar class
varchar tax_code_num
double tax_bill_total
int av_mailed
int av_certified
int av_board
int av_clerk
int exe_homeowner
int exe_senior
int exe_freeze
int exe_longtime_homeowner
int exe_disabled
int exe_vet_returning
int exe_vet_dis_lt50
int exe_vet_dis_50_69
int exe_vet_dis_ge70
int exe_abate
}
pin_geometry {
int year
varchar pin10
double longitude
double latitude
text geometry
}
pin_geometry_raw {
varchar pin10 PK
int start_year PK
int end_year PK
double longitude
double latitude
text geometry
}
tax_code {
int year PK
varchar agency_num PK
double agency_rate
varchar tax_code_num PK
double tax_code_rate
}
tif {
int year PK
varchar agency_num PK
double prev_year_revenue
double curr_year_revenue
int first_year
boolean cancelled_this_year
}
tif_crosswalk {
int year
varchar agency_num_dist
varchar agency_num_final
}
tif_distribution {
int year PK
varchar agency_num PK
varchar tax_code_num PK
double tax_code_rate
bigint tax_code_eav
bigint tax_code_frozen_eav
bigint tax_code_revenue
double tax_code_distribution_pct
}
eq_factor ||--|{ pin : "applies to"
pin ||--|{ tax_code : "within"
cpi ||--|{ agency : "applies to"
tax_code }|--|| agency : "has"
tax_code ||--o| tif_distribution : "may have"
agency ||--|{ agency_fund : "contains"
agency_info ||--|{ agency : "describes"
agency_fund_info ||--|{ agency_fund : "describes"
tif ||--|| tif_crosswalk : "in"
tif_distribution }|--|| tif_crosswalk : "in"
agency_info ||--o{ tif: "describes"
tax_code }|--o| tif : "may have"
pin_geometry ||--o| pin : "has"
pin_geometry }|--|| pin_geometry_raw : "expands"
```
> :warning:
> [Click here](https://ccao-data.github.io/ptaxsim/mermaid/er-diagram-big.svg)
> for a more detailed version of the diagram below.
</details>

```mermaid
erDiagram
agency {
int year PK
varchar agency_num PK
boolean home_rule_ind
bigint cty_cook_eav
double total_ext
}
agency_info {
varchar agency_num PK
varchar agency_name
varchar major_type
}
agency_fund {
int year PK
varchar agency_num PK
varchar fund_num PK
bigint final_levy
double final_rate
}
agency_fund_info {
varchar fund_num PK
varchar fund_name
boolean capped_ind
}
cpi {
int year
double cpi
double ptell_cook
int levy_year PK
}
eq_factor {
int year PK
double eq_factor_tentative
double eq_factor_final
}
metadata {
varchar db_version
varchar requires_pkg_version
int data_year_min
int data_year_max
}
pin {
int year PK
varchar pin PK
varchar class
}
pin_geometry {
int year
varchar pin10
text geometry
}
tax_code {
int year PK
varchar agency_num PK
double agency_rate
varchar tax_code_num PK
double tax_code_rate
}
tif {
int year PK
varchar agency_num PK
double prev_year_revenue
double curr_year_revenue
int first_year
boolean cancelled_this_year
}
tif_crosswalk {
int year
varchar agency_num_dist
varchar agency_num_final
}
tif_distribution {
int year PK
varchar agency_num PK
varchar tax_code_num PK
double tax_code_distribution_pct
}
eq_factor ||--|{ pin : "applies to"
pin ||--|{ tax_code : "within"
cpi ||--|{ agency : "applies to"
tax_code }|--|| agency : "has"
tax_code ||--o| tif_distribution : "may have"
agency ||--|{ agency_fund : "contains"
agency_info ||--|{ agency : "describes"
agency_fund_info ||--|{ agency_fund : "describes"
tif ||--|| tif_crosswalk : "in"
tif_distribution }|--|| tif_crosswalk : "in"
agency_info ||--o{ tif: "describes"
tax_code }|--o| tif : "may have"
pin_geometry ||--o| pin : "has"
```
![](https://ccao-data.github.io/ptaxsim/mermaid/er-diagram-small.svg)

## Notes and caveats

Expand Down
Loading

0 comments on commit 10b598c

Please sign in to comment.