Giter Club home page Giter Club logo

migbirdhip's People

Contributors

lawalter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

migbirdhip's Issues

Refactory suffix identification in clean()

This code which extracts suffixes from the firstname and last name

clean() line 56

           str_detect(lastname, "(?<=\\s)JR\\.?$") ~ "JR",
            str_detect(lastname, "(?<=\\s)SR\\.?$") ~ "SR",
            str_detect(lastname, "(?<=\\s)I\\.?$") ~ "I",
            str_detect(lastname, "(?<=\\s)II\\.?$") ~ "II",
            str_detect(lastname, "(?<=\\s)III\\.?$") ~ "III",
            str_detect(lastname, "(?<=\\s)IV\\.?$") ~ "IV",
            str_detect(lastname, "(?<=\\s)V\\.?$") ~ "V",
            str_detect(lastname, "(?<=\\s)VI\\.?$") ~ "VI",
            str_detect(lastname, "(?<=\\s)VII\\.?$") ~ "VII",
            str_detect(lastname, "(?<=\\s)1ST\\.?$") ~ "1ST",
            str_detect(lastname, "(?<=\\s)2ND\\.?$") ~ "2ND",
            str_detect(lastname, "(?<=\\s)3RD\\.?$") ~ "3RD",
            str_detect(lastname, "(?<=\\s)4TH\\.?$") ~ "4TH",
            str_detect(lastname, "(?<=\\s)5TH\\.?$") ~ "5TH",
            str_detect(lastname, "(?<=\\s)6TH\\.?$") ~ "6TH",
            str_detect(lastname, "(?<=\\s)7TH\\.?$") ~ "7TH",
            str_detect(lastname, "(?<=\\s)8TH\\.?$") ~ "8TH",
            str_detect(lastname, "(?<=\\s)9TH\\.?$") ~ "9TH",

can be replaced with

str_match(lastname, '(?<=\s)(JR|SR|I{1,3}V?|VI{0,2}|1ST|2ND|3RD|[4-9]TH)\.?$')[2]`

Error while generating report.

Quitting from lines 282-313 (dl_report.Rmd)
Error in group_by():
! Must group by variables found in .data.
x Column issue_id is not found.
Backtrace:

  1. ... %>% arrange(desc(n))
  2. dplyr:::group_by.data.frame(., dl_state, registration_yr, issue_id)

I hacked the report to run it manually, removing the issue_id from the grouping and it runs, but I can't figure out what issue_id represents, and if grouping by it is necessary.

Strip out IAD record assignment

Remove code from findDuplicates that assigns Iowa dove to its own record type.. They should have shifted away from this in December 2021.

Bad spp value in the hip_bags_ref table.

In the strataCheck function I was getting a number of rows for states that was telling me that the coot_snipe & rail_gallinule values were "bad" and that the normal strata was NA. To make this, I'm guessing that you join it on the hip_bags_ref object.. When I query the hip_bags_ref table the spp values is coots_snipe_bag, and rails_gallinules_bag, when the column names in the data are coots_snipe and rails_gallinules which is causing a join issue?

This appears to be isolated to the strataCheck function. The output files have the correct stratification for these columns, and states.

record_type assignment for BT permit files

This at the moment appears to be specific to the CO and NM Band-tailed pigeon permit files.. These are uniquely different in that in addition to the permit file, there should be a dove response attached to it. This differs from the Crane files which are just a positive indicator that a crane permit was purchased.

In 2024, a record_type of PMT was attached for each of these records, when creating the output transfer file. These should have been tagged as HIP since they include "non-permit information". The impact appears that a hip registration was not created to capture the dove stratification. However, this may have been limited to those records in which the state could not match the permit to a hunter with a HIP registration, which means we would have been creating a HIP registration with a dove stratum of 0..

Options:
A. update code to just make sure these are assigned to HIP
B. Discuss whether we can do away with the record_type column altogether since I can identify what columns in what states are permit fields, and just process accordingly.

dl_report.rmd

report template is missing

library(lubridate)

needed because of the call to %within%

Refactor reading files

In places where you use this code.. read_hip and one other function

 	     list.files(path, recursive = FALSE)  %>%
       	         as_tibble() %>%
	          transmute(filepath = as.character(value)) %>%
	          mutate(filepath = str_replace(filepath, "TXT", "txt")) %>%
	          filter(str_detect(filepath, "(?<=\\.)txt$")) %>%	   
	          mutate(filepath = paste0(path, filepath)) %>%

can effectively be replaced with

list.files(path, recursive=TRUE, pattern= '*\\.txt', ignore.case=TRUE, full.names=TRUE) %>%
as_tibble()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.