Skip to content

Commit

Permalink
Merge pull request nationalparkservice#130 from RobLBaker/main
Browse files Browse the repository at this point in the history
bugfixes for test_dates_parse and test_date_range
  • Loading branch information
RobLBaker authored Jan 26, 2024
2 parents 701598a + 2d8fe23 commit 516248a
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 152 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DPchecker development version

2024-01-26
* Bugfixes for `test_dates_parse()` and `test_date_range()`: now ignore files that have times but no dates or date times.
* Bugfixes for `test_valid_fieldnames()`, `test_valid_filenames()`, `test_numeric_fields()`, `test_dates_parse()`, and `test_date_range()` - all the same bug; must be something deep in a dependency chain changed.
* Bugfix attempt for `test_fields_match()` reportedly needs more testing
* Add function `test_missing_data()` which scans data for NAs not documented in metadata
Expand Down
20 changes: 14 additions & 6 deletions R/tabular_data_congruence.R
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,12 @@ test_dates_parse <- function(directory = here::here(),
}
# Get format string for each date/time column and filter out anything that doesn't have a year associated with it
dttm_formats <- dttm_attrs[[data_file]]$formatString
is_time <- grepl("Y", dttm_formats)
dttm_formats <- dttm_formats[is_time]
dttm_col_names <- dttm_col_names[is_time]
has_date <- grepl("Y", dttm_formats)
dttm_formats <- dttm_formats[has_date]
dttm_col_names <- dttm_col_names[has_date]

#ignore files that have only times, no dates or date-times:
if (length(seq_along(dttm_col_names)) == 0) { next }

# Convert date/time formats to be compatible with R, and put them in a list so we can use do.call(cols)
dttm_formats_r <- convert_datetime_format(dttm_formats)
Expand Down Expand Up @@ -1030,9 +1033,14 @@ test_date_range <- function(directory = here::here(),
}
# Get format string for each date/time column and filter out anything that doesn't have a year associated with it
dttm_formats <- dttm_attrs[[data_file]]$formatString
is_time <- grepl("Y", dttm_formats)
dttm_formats <- dttm_formats[is_time]
dttm_col_names <- dttm_col_names[is_time]
has_date <- grepl("Y", dttm_formats)
dttm_formats <- dttm_formats[has_date]
dttm_col_names <- dttm_col_names[has_date]

#ignore files that have only times, no dates or date-times:
if (length(seq_along(dttm_col_names)) == 0) {
return(NULL)
}

# Convert date/time formats to be compatible with R, and put them in a list so we can use do.call(cols)
dttm_formats_r <- convert_datetime_format(dttm_formats)
Expand Down
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
DPchecker: DPchecker.html
last_built: 2024-01-16T17:59Z
last_built: 2024-01-26T16:31Z

68 changes: 0 additions & 68 deletions docs/reference/run_congruence_checks.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 516248a

Please sign in to comment.