Преглед на файлове

fix candidate deduping by contest name

main
Garrick Aden-Buie преди 2 години
родител
ревизия
e26a8d48a1
No known key found for this signature in database
променени са 2 файла, в които са добавени 15 реда и са изтрити 17 реда
  1. +7
    -9
      process/R/out_candidate_listing.R
  2. +8
    -8
      process/_targets/meta/meta

+ 7
- 9
process/R/out_candidate_listing.R Целия файл

@@ -16,15 +16,7 @@ prep_dedupe_candidates <- function(candidate_listing_raw) {
# first, last, cleaned contest name
f_l_cleaned_contest <-
candidate_names |>
mutate(
contest_name_clean = if_else(
!is.na(city) & map2_lgl(city, contest_name, \(c, cn) grepl(paste("TOWN OF", c), cn)),
map2_chr(city, contest_name, \(c, cn) sub(paste("TOWN OF", c, ""), "", cn)),
contest_name
),
contest_name_clean = sub("([A-Z]+ ){1,2}COUNTY ", "", contest_name_clean)
) |>
group_by(first_name, last_name, contest_name_clean) |>
group_by(first_name, last_name, contest_name) |>
mutate(candidate_group = dplyr::cur_group_id(), .after = 1) |>
ungroup()

@@ -140,6 +132,12 @@ prep_candidate_listing <- function(
current_contact <-
candidate_listing_current_contact_info(candidate_address)

candidate_contest_count <-
cl_raw |>
distinct(candidate_id, election_dt, contest_name) |>
slice_max(election_dt, by = candidate_id, n = 1)


current_name_on_ballot <-
candidate_name_on_ballot |>
slice_max(election_dt, by = candidate_id, n = 1, with_ties = FALSE) |>

+ 8
- 8
process/_targets/meta/meta Целия файл

@@ -9,14 +9,14 @@ addresses_raw|stem|a8c239cff2fd56b5|396cb2f0bd613f13|1724a2047b0055cb|-140902334
amended_score|function|5c61b95fed292706|||||||||||||||
as_report_factor|function|36d1129ba7988043|||||||||||||||
calc_report_amended_score|function|59ad5afb0d7afcdd|||||||||||||||
candidate_listing|stem|2d29206012dd5a6e|ca3b1051baab2a4e|b1b10169f22e7895|1990518913||t19708.0958038563s|919bddc5b0c264cd|2443426|rds|local|vector|||17.819|Detected an unexpected manytomany relationship between x and y.ℹ Row 46 of x matches multiple rows in y.ℹ Row 1 of y matches multiple rows in x.ℹ If a manytomany relationship is expected, set relationship manytomany to silence this warning.. Detected an unexpected manytomany relationship between x and y.ℹ Row 14490 of x matches multiple rows in y.ℹ Row 68 of y matches multiple rows in x.ℹ If a manytomany relationship is expected, set relationship manytomany to silence this warning.|
candidate_listing|stem|690367d874282e76|ca3b1051baab2a4e|9b46b3c8e157bb16|1990518913||t19710.6003809515s|f93f00f280255d0c|2444453|rds|local|vector|||16.381|Detected an unexpected manytomany relationship between x and y.ℹ Row 46 of x matches multiple rows in y.ℹ Row 1 of y matches multiple rows in x.ℹ If a manytomany relationship is expected, set relationship manytomany to silence this warning.. Detected an unexpected manytomany relationship between x and y.ℹ Row 14514 of x matches multiple rows in y.ℹ Row 68 of y matches multiple rows in x.ℹ If a manytomany relationship is expected, set relationship manytomany to silence this warning.|
candidate_listing_current_contact_info|function|e601167e7641e8b3|||||||||||||||
candidate_listing_dedupe|stem|a26b36222b5573b7|abe88f559f4615fa|bc99c62e886d7ea2|-464242793||t19707.550437869s|c4aec4062028f459|887493|rds|local|vector|||302.363||
candidate_listing_for_matching|stem|a6d16521616c1897|6fdfaef3d1f25c51|81b8064552ef57ff|-577355067||t19708.095820139s|68e20938d3183134|750771|rds|local|vector|||0.385||
candidate_listing_dedupe|stem|bb4f425c36ce65b6|abe88f559f4615fa|752f19834207587b|-464242793||t19710.6001677782s|5047f6ab8b6a4c3e|887539|rds|local|vector|||311.272||
candidate_listing_for_matching|stem|3916211b4802cc40|6fdfaef3d1f25c51|5ea4ec16f8eb78de|-577355067||t19710.6003976427s|e5d18092b189d3ec|750421|rds|local|vector|||0.382||
candidate_listing_raw|stem|04ff27c1189c6935|97f430d4b14b167a|0e0ef311e96b6957|1186188557||t19703.0853911025s|5a86d1a43431a527|1440919|rds|local|vector|||8.573||
candidates|stem|b6768405150404c4|71001cadf25750e1|de8a72a396af78b4|1152396829||t19694.6016087732s|b322e3837fc533af|116166|rds|local|vector|||4.115||
candidates_for_matching|stem|bf89fef3bf386579|4ada25ee182a8664|2fa4ac553b68ed13|968106745||t19709.5515467732s|16d9babb80d48e31|120198|rds|local|vector|||7.958||
candidates_linked|stem|c6a05a0b206c28dc|abcd351c0f8d6c0b|16dca0f7195ebbc1|-1922179846||t19709.5540520063s|b37ad134c53baa2d|21320|rds|local|vector|||216.003|partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs|
candidates_linked|stem|771d4434b6bb865a|abcd351c0f8d6c0b|8b3eb4c7ca28de4f|-1922179846||t19710.6028757998s|b2d301b528b6ae4d|21322|rds|local|vector|||213.818|partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs. partial argument match of p to probs|
candidates_match|function|81d6299a59c8c42b|||||||||||||||
candidates_matched|stem|c6a2275e8b56b2d6|20bae987c9ff2e92|c48ac389be1bcc8c|-250178612||t19708.0140315185s|3132e98bbdd491d9|134791|rds|local|vector|||0.12|Detected an unexpected manytomany relationship between x and y.ℹ Row 9 of x matches multiple rows in y.ℹ Row 1117 of y matches multiple rows in x.ℹ If a manytomany relationship is expected, set relationship manytomany to silence this warning.|
cf_db_create|function|b4ebd44c9466fbf2|||||||||||||||
@@ -26,7 +26,7 @@ cf_prep_db_create|function|59e20e4427ec3eb6|||||||||||||||
cf_root|function|e7a66c4131d887c2|||||||||||||||
cluster_text|function|0585ec2a10dc9332|||||||||||||||
collect_full_addresses_from_parts|function|4036d15cdad60ede|||||||||||||||
committee_candidate|stem|f9e8ae5da4a9e6a1|20bae987c9ff2e92|f97405539986c7df|1681574645||t19709.554055942s|ec2ec7c5d07e0a9d|23446|rds|local|vector|||0.036||
committee_candidate|stem|bf9c773091f0d3ad|20bae987c9ff2e92|b7151535af008aa4|1681574645||t19710.6028795329s|962d8fcf3f7bb317|23462|rds|local|vector|||0.039||
committees|stem|fa467377df6b1326|672152cfa41781f1|5bf117c67cc27f88|-828971872||t19694.0609098714s|29dc1bf83a2d1a54|153990|rds|local|vector|||1.276||
count_receipt_types|function|ea6b25d6ab3486f6|||||||||||||||
cover_raw|stem|9ae721aa4d4398d6|aed65a62609940a9|b5913a9bada6de77|2002318961||t19693.830029799s|3fe0e852265c13f9|650023|rds|local|vector|||4.549||
@@ -23539,7 +23539,7 @@ path_out_cl_candidates|stem|df6a2869c32ec89e|530d2b80d22daa14|f4a90afa54039e41|-
path_out_cl_contact|stem|c2cf5470d3f92c0d|677f4afded3f56a0|f4a90afa54039e41|702194598|data-out/cl_contact|t19707.5829718281s|41200f7f0df0ebd3|96|file|local|vector|||0.053||
path_out_cl_elections|stem|293e98ff84ee8949|c937aeb5c46a5ebd|f4a90afa54039e41|-188564591|data-out/cl_elections|t19707.5809144635s|41200f7f0df0ebd3|96|file|local|vector|||0.927||
path_out_cl_party|stem|3aa7322eb580a25a|7714628695a675a4|f4a90afa54039e41|-915641666|data-out/cl_party|t19707.582973311s|41200f7f0df0ebd3|96|file|local|vector|||0.103||
path_out_committee_candidate|stem|0a64a99742ed8c9d|2dee0e4fbe71a657|5a3445fd829e0260|-2075049413|data-out/committee_candidate|t19709.5540569909s|32c3383b35da9c76|40487|file|local|vector|||0.053||
path_out_committee_candidate|stem|ecc6cc501f019506|2dee0e4fbe71a657|ab28470560700153|-2075049413|data-out/committee_candidate|t19710.6028844868s|bc5f9d6a2e374e27|40492|file|local|vector|||0.39||
path_out_committees|stem|bfd57182274f1d1c|05ef2bae5a77fb77|439ff45c020683f3|2056595834|data-out/committees|t19701.622756253s|41200f7f0df0ebd3|96|file|local|vector|||2.583||
path_out_cover|stem|9f12c3cb2d8d8f74|88239f9749ae64db|f8e35f7f8347afc6|1148338993|data-out/cover|t19701.6227467288s|41200f7f0df0ebd3|96|file|local|vector|||5.824||
path_out_elections|stem|5d18de4e325fb889|e3b344e58c525754|15a1dcca21694ff8|466215059|data-out/elections|t19702.073721828s|41200f7f0df0ebd3|96|file|local|vector|||0.982||
@@ -42283,11 +42283,11 @@ post_prepare_steps_for_table|function|cab3f88eebeb2f87|||||||||||||||
post_process_steps_for_table|function|cab3f88eebeb2f87|||||||||||||||
pre_prepare_table_body|function|437b34d31f233545|||||||||||||||
pre_process_table_body|function|437b34d31f233545|||||||||||||||
prep_candidate_listing|function|6d068fc765edf48b|||||||||||||||
prep_candidate_listing|function|b8255f434d6f6acf|||||||||||||||
prep_candidates_dedupe_mapping|function|fc219b85b321db70|||||||||||||||
prep_collect_addresses_raw|function|9d8af27d4d039c5b|||||||||||||||
prep_collect_addresses_raw_officers|function|748d8b26ffdd0273|||||||||||||||
prep_dedupe_candidates|function|8ed685453d511846|||||||||||||||
prep_dedupe_candidates|function|3ec607d1e3175329|||||||||||||||
prep_open_address_db|function|6736e9a9dc6a205e|||||||||||||||
prep_open_dataset|function|884d4c88e35ed513|||||||||||||||
prep_open_dataset_db|function|36942017bbca35a8|||||||||||||||

Loading…
Отказ
Запис