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

Fix final evaluation function #446

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Fix final evaluation function #446

merged 3 commits into from
Jan 16, 2025

Conversation

jwalsh28
Copy link
Collaborator

Closes #445

Small tweak to resolve bug in final form evaluation.

@jwalsh28 jwalsh28 changed the base branch from main to version2025 January 13, 2025 17:53
@jwalsh28 jwalsh28 requested a review from ridhi96 January 16, 2025 02:23
@jwalsh28
Copy link
Collaborator Author

@ridhi96 I made the final tweak we discussed on adding in the option to pad the geographies. I believe this does not take away the value of that test as it still checks if there are any cases where the data has a fip with a length that differs from all other geographies in the data, which should never happen.

If you approve after one last look through I will merge with version2025!

Copy link

@ridhi96 ridhi96 left a comment

Choose a reason for hiding this comment

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

Hi JP,

I am still getting the same error:

Error in `dplyr::mutate()` at functions/testing/evaluate_final_data_4.R:106:3:                                  
ℹ In argument: `place = str_pad(place, width = 5, side = "left", pad = "0")`.
Caused by error:
! object 'place' not found
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/dplyr:::mutate_error>
Error in `dplyr::mutate()` at functions/testing/evaluate_final_data_4.R:106:3:
ℹ In argument: `place = str_pad(place, width = 5, side = "left", pad = "0")`.
Caused by error:
! object 'place' not found
---
Backtrace:
     ▆
  1. ├─global evaluate_final_data(...)
  2. │ ├─dplyr::mutate(...) at functions/testing/evaluate_final_data_4.R:106:3
  3. │ └─dplyr:::mutate.data.frame(...)
  4. │   └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  5. │     ├─base::withCallingHandlers(...)
  6. │     └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
  7. │       └─mask$eval_all_mutate(quo)
  8. │         └─dplyr (local) eval()
  9. └─stringr::str_pad(place, width = 5, side = "left", pad = "0")
 10.   └─vctrs::vec_size_common(string = string, width = width, pad = pad)
Run rlang::last_trace(drop = FALSE) to see 3 hidden frames.

Maybe the error is because of my files. I will investigate this.

Another thing I want to highlight is that the update you made to pad the strings after reading might not catch the case where, for example, a county value incorrectly has length 2 or 1 (chances of this happening are highly unlikely but it could still happen).

@jwalsh28
Copy link
Collaborator Author

I see your point on the geography length but I think those cases are a different kind of error. For example, a state that is entered with 1 digit but should have 2 (with the second being a non-zero) would to me represent that the metric someone is producing erroneous FIPs entirely, where length 3 + would say they are including a more extensive FIPs code then required. Harder to correct for the former.

@jwalsh28 jwalsh28 merged commit 8cbcc01 into version2025 Jan 16, 2025
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.

Fix bug with final data evaluation test function
3 participants