From fe16fc89fb1db8e965c4c80be73851138f1c969c Mon Sep 17 00:00:00 2001 From: Jean Cochrane Date: Thu, 12 Oct 2023 16:03:39 +0000 Subject: [PATCH 1/3] Remove legacy ccao::vars_dict attributes from README.Rmd code --- README.Rmd | 37 +++++++++++++++++++++---------------- README.md | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.Rmd b/README.Rmd index a6a112c..fcf24de 100644 --- a/README.Rmd +++ b/README.Rmd @@ -67,27 +67,30 @@ Because our office (mostly) cannot observe individual condo unit characteristics library(dplyr) library(tidyr) library(yaml) -params <- read_yaml("params.yaml") +library(httr) + +condo_params <- read_yaml("params.yaml") +condo_preds <- condo_params$model$predictor$all + +res_params_text <- GET( + "https://raw.githubusercontent.com/ccao-data/model-res-avm/master/params.yaml" +) %>% + content(as = "text") +res_params <- read_yaml(text = res_params_text) +res_preds <- res_params$model$predictor$all + +condo_unique_preds <- setdiff(condo_preds, res_preds) + ccao::vars_dict %>% - filter( - var_is_predictor, - !var_name_model %in% c("meta_sale_price") - ) %>% inner_join( - as_tibble(params$model$predictor$all), + as_tibble(condo_preds), by = c("var_name_model" = "value") ) %>% - filter( - stringr::str_starts(var_name_model, "char_", negate = TRUE) | - var_name_model %in% c("char_yrblt", "char_land_sf") | - var_model_type == "condo", - stringr::str_starts(var_name_model, "ind_", negate = TRUE) - ) %>% distinct( + var_name_model, `Feature Name` = var_name_pretty, Category = var_type, Type = var_data_type, - var_model_type ) %>% mutate( Category = recode( @@ -106,13 +109,15 @@ ccao::vars_dict %>% ) ) %>% mutate(`Unique to Condo Model` = ifelse( - var_model_type == "condo" | + var_name_model != "loc_tax_municipality_name" & ( + var_name_model %in% condo_unique_preds | `Feature Name` %in% - c("Condominium Building Year Built", "Condominium % Ownership"), + c("Condominium Building Year Built", "Condominium % Ownership") + ), "X", "" )) %>% arrange(desc(`Unique to Condo Model`), Category) %>% - select(-var_model_type) %>% + select(-var_name_model) %>% knitr::kable(format = "markdown") ``` diff --git a/README.md b/README.md index 81e7aed..ba42876 100644 --- a/README.md +++ b/README.md @@ -152,12 +152,12 @@ the 2023 assessment model. | Percent Population Mobility, Moved From Within Same County in Past Year | acs5 | numeric | | | Longitude | loc | numeric | | | Latitude | loc | numeric | | -| Municipality Name | loc | character | | | FEMA Special Flood Hazard Area | loc | logical | | | First Street Factor | loc | numeric | | | First Street Risk Direction | loc | numeric | | | School Elementary District GEOID | loc | character | | | School Secondary District GEOID | loc | character | | +| Municipality Name | loc | character | | | CMAP Walkability Score (No Transit) | loc | numeric | | | CMAP Walkability Total Score | loc | numeric | | | Airport Noise DNL | loc | numeric | | From 8e9be9dc842b697a776d13a91c00947d0436c49e Mon Sep 17 00:00:00 2001 From: Jean Cochrane Date: Thu, 12 Oct 2023 16:26:56 +0000 Subject: [PATCH 2/3] Lint README.Rmd --- README.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.Rmd b/README.Rmd index fcf24de..a54e88a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -111,8 +111,8 @@ ccao::vars_dict %>% mutate(`Unique to Condo Model` = ifelse( var_name_model != "loc_tax_municipality_name" & ( var_name_model %in% condo_unique_preds | - `Feature Name` %in% - c("Condominium Building Year Built", "Condominium % Ownership") + `Feature Name` %in% + c("Condominium Building Year Built", "Condominium % Ownership") ), "X", "" )) %>% From 7572d02ef89f9b2caf5575bbb8ca43034567ae1d Mon Sep 17 00:00:00 2001 From: Jean Cochrane Date: Fri, 13 Oct 2023 16:19:31 +0000 Subject: [PATCH 3/3] Simplify res_params assignment in README.Rmd --- README.Rmd | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.Rmd b/README.Rmd index a54e88a..667cd9c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -67,16 +67,13 @@ Because our office (mostly) cannot observe individual condo unit characteristics library(dplyr) library(tidyr) library(yaml) -library(httr) condo_params <- read_yaml("params.yaml") condo_preds <- condo_params$model$predictor$all -res_params_text <- GET( +res_params <- read_yaml( "https://raw.githubusercontent.com/ccao-data/model-res-avm/master/params.yaml" -) %>% - content(as = "text") -res_params <- read_yaml(text = res_params_text) +) res_preds <- res_params$model$predictor$all condo_unique_preds <- setdiff(condo_preds, res_preds)