Changelog
migbirdHIP 2026.0.1
Minor changes / bug fixes
- Exclude North Dakota from being evaluated by
qIssueDateRange(). - Updated
REF_BAGSfor ARcranes,band_tailed_pigeon,brant, andseaducksto expect state bag value of0. - Updated
REF_DATESfor SD issue window start date to be5/6/2026. - Edited
regYearEditMessage()message text to contain sum of affected registrations.
migbirdHIP 2026.0.0
Versioning scheme change
Starting with the 2026-2027 season, version numbers will follow a calendar versioning scheme (YEAR.STAGE.PATCH) instead of semantic versioning (MAJOR.MINOR.PATCH). The new convention will be more informative to users looking to downgrade migbirdHIP, since release tags will be based on the applicable migratory game bird hunting season rather than arbitrary numbers. Previous releases will retain their original version numbers, which are still defined in variables.R.
Version component definitions:
-
YEAR- the year of the migratory game bird hunting season (e.g.2026for the2026-2027season). -
STAGE- the maturity of the season’s release, either0or1:-
0= the season is ongoing; used for releases between July and the following April, approximately (e.g.2026.0.12). -
1= the definitive package version for the entire season, indicating a stable build that should be used if downgrading (e.g.,2026.1.0for an April 2027 definitive version).
-
-
PATCH- incremental fixes within the current stage:- For an ongoing season, a bug fix would be released as
2026.0.3and subsequent new feature would be released as2026.0.4. - For critical fixes after a definitive season release, to be avoided unless necessary (e.g.,
2026.1.1).
- For an ongoing season, a bug fix would be released as
Use of artificial intelligence
AI tools approved and offered by the U.S. Department of the Interior were used to aid in the development of v2026.0.0. All AI-generated and AI-assisted code, tests, and review were checked, approved, and often re-worded or changed by the migbirdHIP package author before inclusion. The only fully AI-generated code included in the package is new unit tests, which are clearly labeled in code comments. Anthropic’s Claude Opus 4.8 and Opus 5 (both via Perplexity) were the primary models used to generate and review code, with the occasional use of other available models in Perplexity (chosen by Perplexity Computer’s default orchestration), in July 2026.
AI was used for tasks such as:
- Identifying gaps in unit test coverage and subsequently writing new unit tests, which are labeled in code comments.
- Assisting in function refactoring (but not independently rewriting functions).
- Agentic code review to help find typos and errors.
Major changes & new features
- GitHub Actions
- Run
R CMD checknightly at 11pm Eastern and for every release. - Run a quick check that
migbirdHIPcan be installed and all unit tests pass with each push. - Added
pkgdownbuild.
- Run
- Constants and variables
- Changed
REF_CURRENT_SEASONto"2026" - Added
REF_STATES_AF,REF_STATES_MF,REF_STATES_CF, andREF_STATES_PF
- Changed
- DESCRIPTION
- Added dtplyr to Imports
-
constants.R-
LOGIC_BAD_TITLE_ASSIGNMENTadded
-
- Functions
- Deduplication functions now use dtplyr for sizable speed improvements (see #45)
- Failure functions
- Since
read_hip()already checks the file names that sourcedl_stateanddl_date, it seems redundant to usedlStateNAMessage()anddlDateNAMessage(). Instead of moving them toquality.Rwith the rest of the quality check helpers, they were moved tofails.Rand help inside ofwrite_hip(), since the most critical use of these fields is in the data export step.-
failDLstate()- refactoreddlStateNAMessage() -
failDLdate()- refactoreddlDateNAMessage()
-
-
failWidths()- NEW (see #72)
- Since
- Data proofing helper functions in
proof.R- New helper functions help split
proof()into smaller parts. They filter to bad values, and some are reused byqualityMessages()helper functions.-
getBadTitle()- also checks title assignments (new) in addition to value expectations getBadFirstName()getBadMiddle()getBadLastName()getBadSuffix()getBadAddress()getBadCity()getBadState()getBadZIP()getBadBirthDate()getBadHuntMigBirds()getBadRegYear()
-
- New helper functions help split
- Data quality checking functions in
quality.R-
qualityMessages()- Refactored from function previously named
readMessages(). This function is intended to be used afterread_hip()and beforeclean(). - Uses new, existing, and refactored helper functions:
-
qTitle()- NEW -
qFirstName()- NEW -
qMiddle()- NEW -
qLastName()- NEW -
qSuffix()- NEW -
qAddress()- NEW -
qCity()- NEW -
qState()- NEW -
qZIP()- NEW -
qBirthDate()- NEW -
qBirthDateRange()- NEW -
qIssueDateRange()- NEW -
qHuntMigBirds()- previouslyhuntMigBirdsMessage() -
qBags()- umbrella for existingzeroBagsMessage(),naBagsMessage()andnonDigitBagsMessage() -
qRegistrationYear()- previouslybadRegYearMessage() -
nonResidentMessage()- NEW - returns a message for files with 10% or more ofstatevalues that do not matchdl_state. -
interStateDuplicatesMessage()- NEW - returns a message if inter-state duplicates are detected. -
missingPIIMessage()- existing -
missingEmailsMessage()- existing, edited to evaluate only files with more than 10 registrations to avoid small files returning false positives. -
testRecordMessage()- existing -
inLinePermitDNHMessage()- existing -
permitFileBagsMessage()- existing
-
- Note: All issue checking functions and messages remain in
issuance.RunderissueMessages()
- Refactored from function previously named
-
-
read_hip()- Reduce the column naming step to one line
- New helper functions:
-
dropBlankLines()- delete blank lines or lines that contain only"Result"(see #27) -
readTimeMessage()- moved theread_hip()code chunk pertaining to read time duration to its own internal function.
-
- Bag checking functions
-
bagCheck()was refactored to be more efficient, and as a result, internal functionsummarizeBadBags()was deleted because it is no longer needed. - Run time of
bagCheck()decreased marginally. -
bagCheck()now reports count and proportion forNAbag values; previously,NAbag values were reported but not counted.
-
-
questionYear()- New function that questions if the user intends to supply a year value different than the current season year; replaces a duplicated code chunk in
proof()andcorrect(), and added toissueCheck().
- New function that questions if the user intends to supply a year value different than the current season year; replaces a duplicated code chunk in
-
issuePlot()- Updated to conform to ggplot2 version updates
- Replaced
geom_segment()sizetolinewidth - Replaced
geom_boxplot()size = 3withlinewidth = 2ANDoutlier.size = 2, which is narrower than previously. - Increased size of issue window segment width to make it easier for users to see if issue dates fall in, out, or across a season.
- Updated colors.
- Changed subtitle text for clarity.
- Created
issuePlotDateLabel()helper function to:- Avoid error with labeling dates in x-axis (see #88)
- Avoid using
scales::label_date_short()which would require adding scales to Imports
- Replaced
- Updated to conform to ggplot2 version updates
- Deduplication functions
- Using
duplicateFix()on season data took a long time to run; about 7 minutes for 3.17 million records. Changes to deduplication helper functions reduced run time to 1.23 minutes! See #45 for more details. Modifications used include:- Require dtplyr and use
dtplyr::lazy_dt - Use a vectorized row sum rather than
purrr::pmap_chr()induplicateAllOnes() - Parse and format dates once, rather than inside each group, in
duplicateNewest() - Fully vectorize
duplicateRecordType()by avoiding repeatedacross(matches(...), as.numeric)conversions by doing one conversion and tworowSums()
- Require dtplyr and use
- Using
- Helper functions
- New
assignFlyway()function added, mainly to be used by the HIP dashboard. -
errorLevelErrorsByState()edited to calculate based on 13 possible errors per record, not 14 (proof()dropped"test_record").
- New
- Download report template
- Add a plot of all issue dates received per state on the issuance tab.
- Add a bullet point for total number of sample eligible registrations to the agenda tab.
- Minor miscellaneous updates to match function changes,
ggplot2deprecations, typos, etc.
Minor changes / bug fixes
- Dependency updates
- Following dplyr
1.2.0release notes, updatecase_when()withrecode_values()andreplace_when()as appropriate.
- Following dplyr
- Internal package data
- Updated internal package test data to create character
titlevalues rather than numeric.
- Updated internal package test data to create character
- Functions
- Fail gracefully if input provided contains 0 rows (or data are dropped to result in 0 rows) for
clean(),proof(), andwrite_hip(). - Changed
issuePlot()legend to say “Registration year provided” to be clear that the value has not been changed/edited yet. -
proof()no longer filters out test records, since this step is completed upstream inclean(). -
write_hip(split = FALSE)had a bug in the file naming technique that is now resolved. -
issueDecide()rendersmdy(issue_date)only once, and then deselects the column, rather than calling it seven times in thecase_when() -
fileCheck()now runslist.files()only once per path - Reduced repetition in
errorPlotDL() - Reduced
geom_vline()repetition inissuePlot()
- Fail gracefully if input provided contains 0 rows (or data are dropped to result in 0 rows) for
- Testing
- Added test files
- Added:
test-quality.R,test-write_hip.R,test-writeReport.R,test-errorPlots.R,test-errorTables.R, andtest-files.R - Added
test-edge-inputs.Rto test empty (0-row), all-NA-in-key-columns, and single-row inputs.
- Added:
- Expanded unit testing
-
correctEmail()testing and thatcorrect()changes values toNAas expected intest-correct.R -
duplicateFinder()andduplicatePlot()testing intest-duplicates.R - Testing passing messages in
test-glyphs.Randtest-shifts.R - Added tests for
registration_yrfield,birth_datefield, andzipfield intest-proof.R - Added tests for
unique = FALSEandseason = TRUEintest-read_hip.R - Updated
test-proof.Rto usegetBadfamily of functions - Updated
test-fails.Rto evaluatefailWidths() - Added
bagCheck()tests totest-bags.R - Added
zipCheck()tests totext-clean.R
-
- Added test files
- DESCRIPTION
- Require R version
>= 4.5.0 - Imports
- Update
lubridateto>=1.9.5 - Update
purrrto>= 1.2.1 - Update
data.tableto>= 1.18.2 - Update
stringrto>= 1.6.0 - Update
readrto>= 2.2.0 - Update
dplyrto>= 1.2.0 - Update
rlangto>= 1.1.7 - Update
ggplot2to>= 4.0.2
- Update
- Suggests
- Update
rmarkdownto>= 2.30 - Update
sfto>= 1.1-0
- Update
- Require R version
- Recommend installation in
READMEand vignette changed topak::pak()now thatdevtools::install_github()has been deprecated. - Updated package startup message in
zzz.R- Version checking is now more robust; messages are more reliable and clear if a package version is out of date.
migbirdHIP 1.4.13
Final definitive version for the 2025-2026 season.
Minor changes / bug fixes
- Fix
duplicatePlot()bar order
migbirdHIP 1.4.12
Minor changes / bug fixes
- Fixed
fileRename()bug that returned a message if dir contained subfolder. - Updated
REF_BAGSfor FLgeese_bagto only include0 - Download report template
- Removed double spaces.
- Moved missing email figure legend to the bottom; gives more space for x-axis state abbreviations.
- Comma formatting for long numbers
- Bag check table for
Countfield - Non-current records table for
Count outside windowfield - Future records table for
Number of records - Bar labels for plot of errors by field for both before and after correction
- Causes of errors for top 3 fields table for
countfield - Causes of errors by state for
countfield
- Bag check table for
-
errorPlotStates()anderrorPlotFields()- Use
format.default()for bar labels to add commas to big numbers, which fixes the Errors by Field Before Correction plot and the Errors by State before and after correction plots in the download report.
- Use
migbirdHIP 1.4.11
Minor changes / bug fixes
- Updated
REF_BAGSfor IDdove_bagand MAwoodcock_bag, changing5to4 - Bug fix for
duplicatePlot()to show correct bar labels and y position
migbirdHIP 1.4.10
Minor changes / bug fixes
- Replaced ID start date with
12/1/2024. - Fixed time to read in files message returned by
read_hip().
migbirdHIP 1.4.9
Minor changes / bug fixes
-
issueDecide()was returning"overlap"as a result in thedecisionfield, and the"overlap"records were being dropped. This should not happen;"overlap"records should be assigned"future"or"current"and only"past"records are to be dropped.
migbirdHIP 1.4.8
Major changes & new features
- Evaluate Mississippi issue dates
- Add MS to
REF_DATES - No longer assign
"MS"as decision inissueCheck() - No longer exclude
"MS"fromnDropped()ordl_report.qmd
- Add MS to
- Added 3 new internal functions:
-
permitFileBagsMessage()- Used by
readMessages(). - Checks for non-zero bag values from permit file state/species combinations and returns a message to the console if they are detected.
- Used by
-
failBTPI()andfailCR()- Used by
write_hip(). - Moved checks from
write_hip()tofailBTPI()andfailCR()to reduce maintenance of repeated assertions. - Added warning to
failBTPI()to return message to console if any BTPI permit records contain0fordove_bag.
- Used by
-
Minor changes / bug fixes
-
write_hip()- Minor changes to match modern tidyverse syntax
- Add check to ensure
REF_PMT_FILESstates are not inzero_translations
-
REF_BAGSchanges:- Bug fixes
- Add lines for missing, existing, and expected bag values
-
UTband_tailed_pigeonbag2-> stratum2 -
MNcranesbag2-> stratum2
-
- Add lines for missing, existing, and expected bag values
- Update
- Add line for
FLgeese_bagbag0-> stratum0
- Add line for
- Bug fixes
migbirdHIP 1.4.5
Minor changes / bug fixes
- Edited
nDroppedClean()function to capture records if they contain anNAvalue in any one bag field, in addition to existing rule that captures records if all bag fields areNA.
migbirdHIP 1.4.3
Minor changes / bug fixes
- Edited
proofBadEmails()to allow all variations of ccTLDs to be accepted foryahoo,hotmail,outlook, andliveemail domains.- The previously strict filter only accepted
.com,.co.uk,.fr,.es,.ca, and .deforyahooandhotmailemail addresses. In addition, only.comwas accepted forliveandoutlookemail addresses. - Now,
liveEuropean ccTLDs andyahooemails with Indian and Australian ccTLDs, to name a few examples, will pass without being flagged as errors.
- The previously strict filter only accepted
migbirdHIP 1.4.2
Minor changes / bug fixes
-
NAemails are not errors!- Updated
proofBadEmails()to allowNAvalues inemailfield. - Updated
proofBadEmails()function description so that the criteria for good emails is clear on the help page. - Updated
test-proof.Runit testing. - Edited
create_fake_HIP_data.Rand overwrote internal test data stored in/inst/extdata/DL0901/,/tests/testthat/data/DL0902/, andDF_TESTobjects by introducingNAvalues toemailfield.
- Updated
- Edited
zzz.Rto return a startup error message in case the package version in theDESCRIPTIONwas modified before appendingREF_RELEASESinvariables.R.
migbirdHIP 1.4.1
Major changes & new features
- Import ggnewscale for use of
ggnewscale::new_scale_color()inissue_plot(). - New internal
nDropped()function (with helpersnDroppedClean()andnDroppedCurrent()) to summarize the number of dropped HIP registrations (by state or not) at each step of pre-processing. - Eliminated issue template.
Minor changes / bug fixes
- Updated
DESCRIPTIONwith updatedImportsandSuggestspackage versions. - Updated
sysdata.rda-
REF_DATESupdated using 2025-2026 issue window dates. -
REF_ZIP_CODEandREF_BAGSremain the same, using 2024-2025 zip codes and bag/strata conversions.
-
- Functions
-
read_hip(): add message that reports how long it took to read inNnumber of files -
writeReport(): add more dependency checks -
badRegYearMessage(): summarize by source file because it is more informative -
invalidDateMessage(): created and added toissueMessages() -
huntMigBirdsMessage(): created and added toreadMessages() -
duplicateFix(): bug fix, stopped returningduplicate_idfield in the output tibble -
issuePlot()- Improved plot appearance for clarity of interpretation
- Added more colors to the registration year palette to avoid an error of insufficient values in case of outliers
- Refined message text for
zipCheck(),cranePermitBagFix(),btpiPermitBagFix(),regYearEditMessage(),zeroDateMessage(),missingPIIMessage(),missingEmailsMessage(),testRecordMessage(),zeroBagsMessage(),naBagsMessage(),nonDigitBagsMessage(),huntMigBirdsMessage(),dlStateNAMessage(),dlDateNAMessage(),inLinePermitDNHMessage(), andbadRegYearMessage()
-
- Changes to
dl_report.qmdtemplate- Add
nDropped()summary to the Agenda tab - Refined excluded messages in
important_statistics - Split data processing into smaller chunks to waste less time debugging
- Add
- Unit tests
- Suppress verbose messages in
test-clean.R - Add
test-nDropped.R
- Suppress verbose messages in
- Linted all files
- Updated
WORDLIST
migbirdHIP 1.4.0
Major changes & new features
- Changed contents of
R/sysdata.rda- Fewer objects are now stored in
sysdata.rda(reduced from 14 to 7). This enhances transparency and reduces the number of objects that must be generated outside of the R package itself. -
sysdata.rdanow contains:REF_ZIP_CODE,REF_BAGS,REF_DATES,REF_STATES_2SEASON,REF_STATES_1SEASON,REF_EMAIL_TLDS, andSF_HEXMAP - Seven objects were moved to
constants.R:-
ref_bagfields,abbr_usa,abbr_canada,pmt_inline,pmt_files,states_sdbr, andstates_seaduckswere moved and renamedREF_FIELDS_BAG,REF_ABBR_USA,REF_ABBR_CANADA,REF_PMT_INLINE,REF_PMT_FILES,REF_STATES_SD_BR, andREF_STATES_SD_ONLY, respectively.
-
- Two objects were dropped entirely.
MS_firstdayandMS_lastdayare no longer needed byissueCheck(). - Five internal data objects were renamed:
-
REF_BAGS(previouslyhip_bags_ref),REF_DATES(previouslylicenses_ref),REF_ZIP_CODE(previouslyzip_code_ref),REF_STATES_2SEASON(previouslystates_twoseason) andSF_HEXMAP(previouslyhexmap).
-
- Two new objects were added:
REF_STATES_1SEASONandREF_EMAIL_TLDS -
REF_DATESwas changed to no longer includelast_day_migbird_huntingandcategoryfields.
- Fewer objects are now stored in
- Added test data
- Fake HIP test data creation script stored under
data-raw/ - Test data containing fake HIP registrations stored as fixed-width
.txtfiles underinst/extdata/DL0901/, to be used in testing or simulatingread_hip() - Miniature and tiny test data stored as exported
.rdafiles underdata/, to make it easier to demonstrate functions and run unit tests-
DF_TEST_MINIcontains 1,606 rows from 7 states (OR records to represent solo permit state, ME records to represent SD-only state, DE records to represent SD and BR state, ND records to represent CR state, UT records to represent BT state, CO records to represent CR and BT state, and IA records to represent non-BT, CR, SD, or BR state) and is formatted as though the data were just read in. - Six tiny test data objects:
-
DF_TEST_TINI_READis a subset ofDF_TEST_MINI, and contains 3 rows formatted as though the data were just read in -
DF_TEST_TINI_CLEANEDis the result of runningclean()onDF_TEST_TINI_READ -
DF_TEST_TINI_CURRENTis the result of runningissueCheck()onDF_TEST_TINI_CLEANED -
DF_TEST_TINI_DEDUPEDis the result of runningduplicateFix()onDF_TEST_TINI_CURRENT -
DF_TEST_TINI_PROOFEDis the result of runningproof()onDF_TEST_TINI_DEDUPED -
DF_TEST_TINI_CORRECTEDis the result of runningcorrect()onDF_TEST_TINI_PROOFED
-
-
- Fake HIP test data creation script stored under
- Created
variables.Rto define seasonally changing variables in a central place.-
REF_CURRENT_SEASONfor current HIP season. -
REF_RELEASESis a named vector of allmigbirdHIPpackage releases and the corresponding season of HIP data that the version was intended for.
-
- Created
constants.Rto define variables in a central place and thus evaluate data consistently.- Variables are used across functions (e.g.,
inLinePermitDNHMessage()andinLinePermitDNHFix()both useLOGIC_INLINE_PMT_DNH) and are shared between functions andtestthatfiles. - New naming convention helps users to use and find internal reference data objects more quickly by using uppercase letters and categorical prefixes (
REF_,LOGIC_,REGEX_, andSF_).
- Variables are used across functions (e.g.,
- New functions
-
testRecordMessage()added toread_hip()andtestRecordFilter()added toclean()to find and filter out any testing records mistakenly sent to us by the states. - New
duplicatePlot()function added;duplicateFinder()(previously namedfindDuplicates()) function no longer outputs a plot. - The
zeroBagsMessage()internal function is a new feature ofread_hip()that checks for records with all-zero bag values and returns a message to the console if they are detected. - Added
errorTableSummary()internal function to be used byerrorTable(). - Added four internal failure functions to reduce maintenance of assertions across other exported functions:
failYear(),failProofed(),failState(), andfailTF().
-
- Refactored and edited functions
- In an effort to improve the maintainability of the package code, steps were made toward modularity, clarity, and unit testing in some of the larger functions.
-
issueCheck()andissueAssign()- Edited to evaluate registrations differently:
-
last_day_migbird_huntingis no longer used. - Two-season states now use
registration_yrto assigndecisionas"overlap"(new label), and later"current"or"future", if theissue_datefor a registration occurred during the overlap window. -
registration_yris not changed for two-season states, only"future"assigned one-season states.
-
-
issueCheck()split into 9 new minor internal functions:issuePrint()- 8 functions for messages:
issueMessages(),regYearEditMessage(),zeroDateMessage(),badDateMessage(),timeTravelMessage(),futureDateMessage(),pastDateMessage(), andtwoSeasonMessage()
-
issueAssign()split to use an internalissueDecide()helper function.
- Edited to evaluate registrations differently:
-
proof()- Most logic used to identify and flag errors was moved to internal variables in the
constants.Rfile, which are used byproof()andtest-proof.R - First name and last name rules were slightly relaxed
- No limit on number of spaces, apostrophes, or hyphens as long as they are not consecutive
- For first name, apostrophe or letter allowed as first character
- Email proofing rules now more strict
- Most logic used to identify and flag errors was moved to internal variables in the
-
duplicateFinder()- New internal function
duplicateFields()usespurrrto significantly reduce redundancy induplicateFinder(); overall, refactoring reduced the function’s length from 151 lines to 50 lines and improved processing speed.
- New internal function
-
duplicateFix()- Broken down into 7 new minor internal functions (
duplicateID(),duplicateNewest(),duplicateAllOnes(),duplicateAllOnesGroupSize(),duplicateDecide(),duplicateRecordType()andduplicateSample()). - Overall, this refactor reduced deduplication run time by an average of 2 seconds on a frame with 270,000 records.
- Records are no longer evaluated for having all-zero bags or periods instead of bag values because these records are now filtered out upstream during
clean().
- Broken down into 7 new minor internal functions (
-
read_hip()- Broken down into 19 new minor internal functions (
listFiles(),ignorePermits(),ignoreHolds(),ignoreLifetime(),idBlankFiles(),dropBlankFiles(),checkFileNameDateFormat(),checkFileNameStateAbbr(),readMessages(),missingPIIMessage(),missingEmailsMessage(),testRecordMessage(),zeroBagsMessage(),naBagsMessage(),nonDigitBagsMessage(),inLinePermitDNHMessage(),badRegYearMessage(),dlStateNAMessage(), anddlDateNAMessage()). - More strict requirements must be met for data to be successfully read (e.g. instead of returning a message that file names are incorrectly formatted, this would stop the process).
- Broken down into 19 new minor internal functions (
-
clean()- Broken down into 8 minor internal functions (2 previously used:
strataFix()split intocranePermitBagFix()andbtpiPermitBagFix(); and 6 new functions:namesToUppercase(),missingPIIFilter(),moveSuffixes(),formatZip(),zipCheck(), andinLinePermitDNHFix()) - Middle initial values are no longer changed (this now happens in
correct()viacorrectMiddleInitial())
- Broken down into 8 minor internal functions (2 previously used:
-
correct()- Broken down into 4 minor internal functions (
correctEmail(),correctTitle(),correctSuffix(),correctMiddleInitial())) - No longer filters out all-0 bag records (this now happens in
clean()vianaAndZeroBagsFilter()) - Changes middle initial values if they are flagged in
proof()viacorrectMiddleInitial()(this step previously happened inclean())
- Broken down into 4 minor internal functions (
-
write_hip()- Edited to include more checks before files are written out.
- New
typeparam conditionally checksrecord_typefield andcranes,band_tailed_pigeon, anddove_bagfields depending on the user input. -
.xlsxand.xlsfile extensions are converted to.csv
- Renamed and moved functions
- Renamed
strataCheck()tobagCheck()and renamedstrata.Rtobags.R.-
bagCheck()split and now uses an internal function,summarizeBadBags(). - Standardized using the phrase “bag values” over the term “strata”; HIP records contain bag values until they are written out and strata are assigned.
-
- Renamed
renameFiles()tofileRename()and moved fromrenameFiles.Rtofiles.Rto be grouped withfileCheck()(previously infileCheck.R). -
findDuplicates()andfixDuplicates()renamed toduplicateFinder()andduplicateFix()to mirror naming conventions of other functions with the subject of the verb coming first (e.g.glyphFinder(),glyphCheck()). - All functions related to duplicates moved to
duplicates.R(previously separated intofindDuplicates.RandfixDuplicates.R) - Renamed functions using camel case except for
read_hip()andwrite_hip()-
errorPlot_fields(),errorPlot_states(), anderrorPlot_dl()now namederrorPlotFields(),errorPlotStates(),errorPlotDL() -
errorLevel_errors_state()anderrorLevel_errors_field()renamed toerrorLevelErrorsByState()anderrorLevelErrorsByField()
-
-
redFlags()no longer exported (used only in the download report), moved to theerrorPlots.Rscript instead of being in its own file
- Renamed
- Deleted functions
- Deleted
validate(),investigate(), andidenticalBags(). - Deleted demographic-oriented
outOfStateHunters()andyouthHunters()functions because they were not being used. - Deleted
recordLevel_errors_state()function since it was not being used. -
sumLines()deleted andread_hip()paramsumlineseliminated; no longer used and not considered useful moving forward.
- Deleted
Minor changes / bug fixes
- Vignette
- Since the package now contains comprehensive test data, there is no need to pre-compute the vignette using HIP data stored locally.
- The
vignettes/man/migbirdHIP_workflow.Rmd.origfile was deleted. - Unused files in the
vignettes/image/subdirectory were deleted; used files were moved toman/figures/.
- Template
dl_report.qmd:- Sorted errors by descending in “causes of errors by state” table.
- Eliminated breaking error in report rendering if there is no field exceeding the error threshold.
- Removed all-zero bag section from the Agenda tab.
- Added comma formatting to long numbers.
- On the Errors tab, moved the “Bad zip codes” section to its own sub-header after “Causes of errors for top 3 fields”.
- Add
zzz.R- Run package startup message which returns the installed
migbirdHIPpackage version and which season of HIP data the package version is compatible with.
- Run package startup message which returns the installed
- Deleted
globals.Rand switched to data masking with rlang pronoun.data. - Incorporated some linting with
lintrand added.lintrto.gitignoreand.Rbuildignore. - Almost all data params changed to be less ambiguous (e.g.
xnowcleaned_data,proofed_data, etc). - tibble no longer a required import
-
read_hip()now catches file names with incorrect MMDDYYYY or DDMMYYYY date format. -
issueCheck()now returns an error for NA values inrecord_keyfield. - Added release tags to README.
- Replace deprecated
~ .xanonymous function notation with\(x).
migbirdHIP 1.3.0
Major changes & new features
- Edited
shiftCheck()to return a summary of shift errors rather than just a table of record id values. - Edited
issueCheck(),issueAssign(), andissuePlot()to accommodate new rules in evaluating if a record is current. All records are now current unless theirissue_datefalls beforeissue_startor after the last day of migratory bird hunting in the record’s state. - Edited
proof()anderrorPlot_fields()to no longer flag and/or plot youth hunters (hunters with birth year < 16 years ago).
Minor changes / bug fixes
- Template
dl_report.qmd- Excluded future data line from agenda tab
- Minor adjustments for edge cases in which summary variables are
NULL - Added clarification to table captions
- Eliminated irrelevant error and warning message printouts from rendered report
- Remove inconsequential “bad bags” from Agenda tab; do not report 1s received instead of 0s, or 0s received instead of 1s
- Edited “bad bags” section of agenda tab to return a message in the edge case of 0% of a file containing bad bag values
- Edited the Issuance tab to reflect new rules in evaluating if a record is current
- Edited
identicalBags()function to exclude matching coots_snipe and rails_gallinules from MI in output; this state uses the response from one question to populate both fields. - Edited
read_hip()function to exclude “hold” subdirectories when reading season HIP data. - Updated R dependency to v4.4.0.
- Added programmatic stops to all functions to safeguard against running with incorrect/invalid parameters.
- Reduced variation in parameter names:
-
distinctchanged touniqueforpullErrors() -
outputchanged toreturnforoutOfStateHunters() -
assigned_datachanged toxforissuePlot() -
datachanged toxforglyphCheck(),glyphFinder(),issueAssign(),issueCheck(), andshiftCheck()
-
migbirdHIP 1.2.8
Major changes & new features
- Added a
NEWS.mdfile to track changes to the package. - Added package documentation page
man/migbirdHIP-package.Rd - New
fileCheck()function: checks if any files in the input folder have already been written to processed folder. - New
shiftCheck()function: find and print any rows that have a line shift error with number of positions shifted. - New
identicalBags()function: returns output if any columns are exactly the same in a file; does not return “no season” matches. - New
glyphCheck()function: pull and view any non-UTF-8 characters in the raw data; helps guide manual fixes to read in the HIP files without line shifts.-
glyphFinder()no longer exported, now used internally inside ofglyphCheck()
-
- Added 3 new internal package functions (
errorLevel_errors_field(),errorLevel_errors_state(), andrecordLevel_errors_state()), which are used insideredFlags(),errorPlot_fields(), anderrorPlot_states(). They reduce code redundancy and ensure updates happen universally. - Added 2 new internal package functions (
issueAssign()andissuePlot), which are used inside ofissueCheck()and by the download report (dl_report.qmd). - Added internal function
strataFix()to be used inside ofclean()to resolve false permit labels. This function edits strata values forband_tailed_pigeonandcranefrom states that submit permit files for crane and band-tailed pigeons; values changed from"2"to"0". - Edited
writeReport()to render quarto documents. - Edited
issueCheck()to place more emphasis onissue_dateto determine relevancy of a record. The function no longer exports future and past data as.csvfiles. Past data are still filtered out from the returned tibble. Output messages indicate if future data exist. - Edited
clean()function:- Filter out any rows that contain a bag value other than a single digit
- Eliminated address cleaning
- Moved zip code checking and messaging to
clean()fromproof(); now checks on entire zip code, not just prefix. Remove ending0whenzipvalue is 10 digits long. - Changed Oregon solo permit
hunt_mig_birdsfield when it equals"0"to"2". For context, a solo permit contains a"2"in at least one of theband_tailed_pigeon,brant, orseaduckfields and contains"0"in all other bag fields.
- Edited
correct()to remove any records with value of"0"orNAvalue in every bag field; improvedemailfield cleaning and repair. - Edited
strataCheck()to return two additional fields in output; 1) number of bad strata and 2) proportion of bad strata. The function now checks for permit species coming during regular HIP and returns them as erroneous (e.g. NMband_tailed_pigeon="2"). - Edited
write_hip()to set any state/species combinations without a season to have strata of"0"; bad bag values remain NA. - Edited
sumLines()to improve speed and efficiency. In addition, the function now returns a data table with the sum of lines per file instead of a single number. No longer exported; set as internal function. - Edited
read_hip()to eliminate encoding check and optionally usesumLines()function to ensure all lines were read in. Returns a message if any records contain a bag value other than a single digit. In addition, now converts blank strings toNA. - Edited
validate()to returnsource_filefield and filter out states and species with no season from function output. - Edited
investigate()to no longer be exported; it works inside ofvalidate()to return a more detailed output. This replaces the previous workflow of runninginvestigate()separately. - Removed
manualFix()function because it is no longer relevant to the package. - Removed
shiftFix()because line shift errors cannot be fixed programmatically on a reliable basis. - Templates
- New Quarto
dl_report.qmdreplaced RMarkdowndl_report.Rmd.- The new Quarto layout allows tabset panels which divides content into sections that can be more easily read and focused on by the user. Tabset panels were also incorporated for before and after plots to show proportion of errors that are corrected during pre-processing.
- A new summary section distills the findings of the functions overall for the user to discern the most important issues from the HIP files that were processed. This is partly accomplished with the use of a
catch_messages()function created only for use in thedl_report.qmdand is not exported or contained within themigbirdHIPpackage internally. Thecatch_messages()function wraps around pre-processing functions (such asread_hip(),clean(),issueCheck(), etc) and captures messages in a list so that they can be returned as readable bullet points. - A new map displays time lag of files received from 49 states in a hexagonal representation of the continental US.
- Emojis are printed with output text to quickly indicate to readers whether issues ❌ need attention or ✔️ are not concerning.
- Sections added as needed to report on new function output (see above for which new functions were added).
- A new section lists any states that were excluded from the output when they submitted data for that download (e.g. all records were issued in the past and are not eligible for the current season; perhaps sent by mistake).
- Eliminated
season_report.Rmdtemplate
- New Quarto
- Imports
- Removed
magrittrandrmarkdown - Added
quartoandsf
- Removed
- Suggests
- Added
spelling
- Added
- Internal package data (
sysdata.rda)- Added vectors of abbreviated US territories and Canada provinces/territories, both updated to include missing abbreviations from previous versions and remove redundant abbreviations
- Added vector of bag field names
- Added vector of two-season states
- Added vectors of seaduck and brant states, seaduck-only states, and two-season states
- Added hexmap grid for download report
- Added tibbles of permit file states/species and states/species of permits received inline
- Updated zip code reference table, bag reference table, license window reference table, and MS reference dates
Minor changes / bug fixes
- License changed to CC0 (previously Public Domain), which was causing a warning in
devtools::check() - Refactored
write_hip()to eliminate redundancy; replaced repeatedleft_join()with for loop - Refactored
findDuplicates()by throwing an error message for a bad string supplied to thereturnparameter at the start, which reduces wait time for failure.- Investigated replacing
findDuplicates()redundancy of searching for duplicate fields using aforloop orpurrr::map(), but this change added 20+ seconds of processing time so left the redundancy as-is.
- Investigated replacing
- Refactored all functions that take a path parameter to add a forward slash to the end each supplied path if not included by the user.
- Replaced superseded
tidyr::separate()withtidyr::separate_wider_delim()ortidyr::separate_wider_position() - Replaced
dplyr::summarize()withdplyr::reframe()since returning more than 1 row per group was deprecated indplyr 1.1.0 - Replaced
ggplot::stat()withggplot::after_stat(), since the former was deprecated inggplot2 3.4.0 - Replaced tidy pipes
%>%and%<>%with base R pipe|>for increased speed and reduced dependency on tidyverse packages. - Edited
DESCRIPTIONfile:- Changed package description
- Set language to
en-US - Added a URL to the Harvest Information Program website
- Incorporated
usethis::use_spell_check()to package checking workflow, which added aninst/WORDLISTfile (whitelisted words) to the package.
migbirdHIP 1.2.7
- Updated strata reference table in sysdata.rda
- Added kable summary tables to horizontal repetition checks in the download report template
- Due to new kables, updated DESCRIPTION to include kableExtra as a Suggests (and added other packages used in the dl_template.Rmd not previously included)
- Updated .Rbuildignore to reduce R CMD check notes
migbirdHIP 1.2.6
- Added
glyphFinder()function - Revisions to
issueCheck()andproof() - Revisions to
dl_report.Rmdtemplate