Skip to content

Create pdf report of on demand ratio analyses - #21

Merged
Damonamajor merged 48 commits into
mainfrom
19-create-pdf-report-of-on-demand-ratio-analyses
Nov 3, 2026
Merged

Damonamajor merged 48 commits into
mainfrom
19-create-pdf-report-of-on-demand-ratio-analyses

Conversation

@Damonamajor

@Damonamajor Damonamajor commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Draft can be found here:

O:\CCAODATA\tmp\ratio-analysis.pdf

@Damonamajor Damonamajor linked an issue Aug 24, 2026 that may be closed by this pull request
@Damonamajor
Damonamajor marked this pull request as ready for review August 24, 2026 17:27
@Damonamajor
Damonamajor requested a review from a team as a code owner August 24, 2026 17:27
@Damonamajor

Damonamajor commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@wrridgeway Take a quick look at the output and see if anything stands out. After that we can do a code review.

@Damonamajor

Copy link
Copy Markdown
Contributor Author

In the quick edit round, I also added a table for descriptive stats, which makes the initial text kind of obsolete. Just left in both for now.

@ccao-jardine ccao-jardine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work so far, @Damonamajor! Some comments here for your next iteration.

Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Damonamajor and others added 2 commits August 24, 2026 16:22
Co-authored-by: Nicole Jardine <138712135+ccao-jardine@users.noreply.github.com>
Co-authored-by: Nicole Jardine <138712135+ccao-jardine@users.noreply.github.com>
@ccao-jardine

Copy link
Copy Markdown
Member

Oh, one more request @Damonamajor: in the intro paragraph, can we list the modeling groups (Single-Family, Multi-Family, Condo?) and/or the class codes that the ratio analysis entails?

@Damonamajor

Damonamajor commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Oh, one more request @Damonamajor: in the intro paragraph, can we list the modeling groups (Single-Family, Multi-Family, Condo?) and/or the class codes that the ratio analysis entails?

They come from the res model. Is that considered single and multi family?

@Damonamajor

Copy link
Copy Markdown
Contributor Author

New file is in the sale shared drive. Didn't make changes on the last question since I didn't know how it should be stated.

@ccao-jardine ccao-jardine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for continuing your work on this!

Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Damonamajor and others added 9 commits August 27, 2026 10:02
Co-authored-by: Nicole Jardine <138712135+ccao-jardine@users.noreply.github.com>
…thub.com:ccao-data/recurring-data-requests into 19-create-pdf-report-of-on-demand-ratio-analyses
@Damonamajor

Copy link
Copy Markdown
Contributor Author

New file is uploaded

Comment thread ratio-analysis/ratio-analysis.qmd Outdated
# Extracts low and high bounds from each assessr *_met function body
met_bounds <- function(fn) {
b <- body(fn)
c(low = eval(b[[2]][[3]]), high = eval(b[[3]][[3]]))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There's not a great way to take the bounds from the function (as far as I can think of). Billy may have thoughts on it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I actually liked in your previous versions that you hard-coded the IAAO Standard goal ranges, instead of creating another function that references something confusing -- I think it made it much easier to understand what was going on. (Sorry if I wasn't clear! I just wanted to use assessr's prd_met function to determine the TRUE/FALSE boolean of whether the PRD standard was met, which you did implement.)

I'll leave this comment for Billy's review and let him be the great decider on the cleanest way to do this!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah, i think just hard-coding them is preferable. i do appreciate the effort to use assessr and make sure the values align with what we've formalized, though.

@ccao-jardine ccao-jardine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work taking a stab at a chunky project! I'm ready to hand over the reins but left a couple comments.

@wrridgeway, tagging you in for review! This is a pretty big boi. I'll let you decide whether you want to review this for correctness only and merging and then doing a PR of your own for Damon's review, or a different way to do this.

Thanks, this is looking solid!

Comment thread ratio-analysis/ratio-analysis.qmd Outdated
# Extracts low and high bounds from each assessr *_met function body
met_bounds <- function(fn) {
b <- body(fn)
c(low = eval(b[[2]][[3]]), high = eval(b[[3]][[3]]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I actually liked in your previous versions that you hard-coded the IAAO Standard goal ranges, instead of creating another function that references something confusing -- I think it made it much easier to understand what was going on. (Sorry if I wasn't clear! I just wanted to use assessr's prd_met function to determine the TRUE/FALSE boolean of whether the PRD standard was met, which you did implement.)

I'll leave this comment for Billy's review and let him be the great decider on the cleanest way to do this!

Comment thread ratio-analysis/render_all_files.R Resolved
Comment thread ratio-analysis/render_all_files.R Resolved
@wrridgeway

Copy link
Copy Markdown
Member

While I'm reviewing this, could we add a readme like we have in the other recurring data request folders?

@Damonamajor

Copy link
Copy Markdown
Contributor Author

For Billy's reference

Oh, I actually liked in your previous versions that you hard-coded the IAAO Standard goal ranges, instead of creating another function that references something confusing -- I think it made it much easier to understand what was going on. (Sorry if I wasn't clear! I just wanted to use assessr's prd_met function to determine the TRUE/FALSE boolean of whether the PRD standard was met, which you did implement.)

would be something like this

metric_meta <- tibble(
  name = c("Median Ratio", "COD", "PRD", "PRB", "MKI"),
  digits = c(2, 2, 2, 2, 2),
  lo = c(0.90, 5.0, 0.98, -0.05, 0.95),
  hi = c(1.10, 15.0, 1.03, 0.05, 1.05),
  mid = c(1.000, 10.0, 1.005, 0.00, 1.000),
  half_span = c(0.100, 5.0, 0.025, 0.05, 0.100),
  standard_label = c(
    "0.90 -- 1.10", "5.0 -- 15.0", "0.98 -- 1.03", "$\\pm$0.05", "0.95 -- 1.05"

@wrridgeway wrridgeway left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The values from the Bremen report all seem to align with the values from the old report so looks good! I've got some suggestions below, but nothing major. Obviously this is a ton of work and we haven't done much PDF output in the past, so awesome job on that. I leave graph presentation to you two, but I will say, this graph is a little chaotic and hard to read if you don't already know what you're looking for:

Image

Thoughts:

  • The line labels for figure 5 worked better in the HTML and we might need to try using something like ggrepel to help us out here.
  • We should start using gt() rather than kable()
  • All tables and graphs are labeled as "Figure" in the output, not sure how easy (or possible) it is to get the tables to actually be labeled as tables using cross-referencing.

Comment thread ratio-analysis/ratio-analysis.qmd Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we get some commenting in this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup, do you also have preferences on what we name the files and where they are stored? We talked briefly about it, but I don't know what conclusion was reached.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Question, non-blocking] Hijacking this thread to discuss file naming and folder structure:

File names look fine to me! The directory name ratio-analysis/ also seems reasonable, but I wonder if it would make more sense to nest this directory under provisional-ratio-curves/ (i.e. provisional-ratio-curves/ratio-analysis/) since it seems like the two projects are related? I don't have full context into this work, so admittedly I may be misinterpreting the relationship between the two projects; if you feel strongly about keeping them separate, that's fine by me too.

Comment thread ratio-analysis/render_all_files.R Resolved
Comment thread ratio-analysis/render_all_files.R Resolved
Comment thread ratio-analysis/render_all_files.R Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Outdated
# Extracts low and high bounds from each assessr *_met function body
met_bounds <- function(fn) {
b <- body(fn)
c(low = eval(b[[2]][[3]]), high = eval(b[[3]][[3]]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah, i think just hard-coding them is preferable. i do appreciate the effort to use assessr and make sure the values align with what we've formalized, though.

Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Resolved
Comment thread ratio-analysis/ratio-analysis.qmd Outdated
Comment on lines +452 to +457
#| Fair Market Values by Group.\newline Model and desk review fair
#| market values for properties with qualifying arm's-length sales
#| (Sold), properties without a recorded sale (Unsold), and all
#| residential parcels (All). Sold and Unsold do not sum to All
#| because properties removed by desk review as outliers are counted
#| in All but neither in Sold nor Unsold.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps we could add an "Excluded" group as well so the counts add up?

@ccao-jardine ccao-jardine Sep 16, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just commenting for posterity! We did make this change to add an "Excluded" group, but it produced a confusing summary. Because Excluded PINs are no longer represented in the FMV data, they were showing up as having null FMVs, 0 changes, and 0% change in Figures 3 and 4. This is an issue because it's very likely that these PINs did have FMV changes -- it's just that these changes are hidden, because the row for the PIN's FMV is excluded from the analysis.

For this PR, we're resolving this either by not having the "Excluded" PINs in the summary tables for Figs 3 and 4, or by replacing the null, 0 change, and 0% change results with a string that says "excluded".

Edited to add: I'll let @Damonamajor decide how to proceed, as either of the above options may require some text replacement too. Then feel free to resolve this convo!

Damonamajor and others added 3 commits September 9, 2026 16:21
Co-authored-by: William Ridgeway <10358980+wrridgeway@users.noreply.github.com>
Co-authored-by: William Ridgeway <10358980+wrridgeway@users.noreply.github.com>
Co-authored-by: William Ridgeway <10358980+wrridgeway@users.noreply.github.com>
@wrridgeway

Copy link
Copy Markdown
Member

https://r-graph-gallery.com/lollipop-plot.html

there are some cool graphs in here you guys could steal elements from. in particular i think this one has a good idea for labeling the points on figure 2.

Comment thread ratio-analysis/render_all_files.R Resolved
Damonamajor and others added 2 commits September 11, 2026 11:20
Co-authored-by: William Ridgeway <10358980+wrridgeway@users.noreply.github.com>

@jeancochrane jeancochrane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just popping in to leave some feedback on folder structure and import duplication, I didn't take a serious look at the code since Billy has done that already! Wherever we decide to store the new ratio-analysis/ directory, I would also request that we create a README in the root of that directory with a brief summary describing what this project is for and how to run it.

Comment thread ratio-analysis/render_all_files.R Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Question, non-blocking] Hijacking this thread to discuss file naming and folder structure:

File names look fine to me! The directory name ratio-analysis/ also seems reasonable, but I wonder if it would make more sense to nest this directory under provisional-ratio-curves/ (i.e. provisional-ratio-curves/ratio-analysis/) since it seems like the two projects are related? I don't have full context into this work, so admittedly I may be misinterpreting the relationship between the two projects; if you feel strongly about keeping them separate, that's fine by me too.

@ccao-jardine ccao-jardine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, thank you!

@Damonamajor

Copy link
Copy Markdown
Contributor Author

Just noting that we don't want two ratio_reports in the same folder. We will ask res-val if they want this and then decide how we want to merge it in.

@Damonamajor
Damonamajor merged commit ae8cc69 into main Nov 3, 2026
3 checks passed
@Damonamajor
Damonamajor deleted the 19-create-pdf-report-of-on-demand-ratio-analyses branch November 3, 2026 16:18
@Damonamajor

Copy link
Copy Markdown
Contributor Author

Adding one comment that there are unresolved issues working between trellix and local windows environments.

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.

Create pdf report of on-demand ratio analyses

4 participants