Skip to content

get_spd(): get spd archived files #19

Merged
Nic-Chr merged 14 commits into
mainfrom
get_spd_archive
May 13, 2025
Merged

get_spd(): get spd archived files #19
Nic-Chr merged 14 commits into
mainfrom
get_spd_archive

Conversation

@bnowok

@bnowok bnowok commented May 7, 2025

Copy link
Copy Markdown
Contributor
  1. Reading in older versions of SPD file regardless of file format.
  2. Some additional error messages.
  3. Small changes to help file.

@bnowok bnowok requested review from Moohan and Nic-Chr May 7, 2025 10:42
# Conflicts:
#	.github/workflows/document.yaml
#	.github/workflows/pkgdown.yaml
#	.github/workflows/style.yaml
#	R/data.R
#	R/read_file.R
#	data-raw/hscp_locality_variables.R
#	data-raw/simd_datazone_variables.R
#	data-raw/simd_postcode_variables.R
#	data-raw/spd_variables.R
#	data/hscp_locality_variables.rda
#	data/simd_datazone_variables.rda
#	data/simd_postcode_variables.rda
#	data/spd_variables.rda
#	man/find_latest_file.Rd
#	man/hscp_locality_variables.Rd
#	man/read_file.Rd
#	man/simd_datazone_variables.Rd
#	man/simd_postcode_variables.Rd
#	man/spd_variables.Rd

@Moohan Moohan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and seems to work for me. Some minor suggestions + a suggestion to refactor out a function.

It would also be great to add tests for reading various archive files, at least:

  • An archive file that works
  • An archive date that is valid but doesn't exist
  • An invalid archive date

Comment thread R/read_file.R Outdated
Comment thread R/get_spd.R Outdated
Comment thread R/get_spd.R Outdated
bnowok and others added 2 commits May 7, 2025 14:38
Co-authored-by: James McMahon <james.mcmahon@phs.scot>
Co-authored-by: James McMahon <james.mcmahon@phs.scot>
Comment thread R/read_file.R Outdated
@Nic-Chr

Nic-Chr commented May 8, 2025

Copy link
Copy Markdown
Contributor

It's working well for me! It would be good to give users a way to check the available archive versions that exist in the archive folder. While there is an example in the documentation indicating that '2023_2' exists, I as a user am not aware of any of the other versions without delving into the archive folder, of which the location is not advertised anywhere.

In the future we could include helper functions that return file paths, including file paths for archived files to allow for user meta-programming where they might for example want to check for the existence of files and perform actions based on that.

@Moohan

Moohan commented May 8, 2025

Copy link
Copy Markdown
Member

Just off the back of @Nic-Chr's comment: It might be nice to include the code for the current version in the message:
So instead of "Using version xx for other versions use the version arg".
Something like: "Using version xx, to fix this use get_spd(version = "xx")" (this maybe implies that you can use version for older ones, or maybe it needs to be longer/more explicit...

@Moohan Moohan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy that this all works as expected. Tests also cover enough cases for now!

@Nic-Chr Nic-Chr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@Nic-Chr Nic-Chr merged commit 89fc87a into main May 13, 2025
3 of 4 checks passed
@Nic-Chr Nic-Chr deleted the get_spd_archive branch May 13, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants