Add fetch mp lookup and update Air functions to handle version updates - #147
Add fetch mp lookup and update Air functions to handle version updates#147cjrace wants to merge 9 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #147 +/- ##
==========================================
+ Coverage 56.27% 59.01% +2.73%
==========================================
Files 18 18
Lines 1642 1742 +100
==========================================
+ Hits 924 1028 +104
+ Misses 718 714 -4 Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new exported helper to fetch the latest Westminster constituency→MP lookup from the maintained mp-lookup repo (addressing #144), and updates the Air formatter utilities/tests to handle minimum supported Air versions (including a new force reinstall option).
Changes:
- Added
fetch_mp_lookup()(exported + documented) and associated tests, including a live-shape guard test. - Refactored Air installer/formatter helpers to detect installed Air versions and reinstall when below a minimum supported version; expanded test coverage.
- Regenerated/cleaned up Rd cross-links and small formatting changes across docs/NAMESPACE; updated package metadata/ignores.
Reviewed changes
Copilot reviewed 11 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-fetch_mp_lookup.R | Adds unit + live-shape tests for the new fetch_mp_lookup() helper. |
| tests/testthat/test-air_formatter.R | Expands tests to cover Air version detection and installer messaging/reinstall logic. |
| R/write_df_to_delta_utils.R | Minor formatting/line-wrapping changes in permission-error checks. |
| R/fetch.R | Introduces exported fetch_mp_lookup() with messaging and error handling. |
| R/air_formatter.R | Adds Air path/version helpers, minimum supported version constant, and updates air_install() behavior/args. |
| NEWS.md | Documents the new fetch_mp_lookup() and Air installer behavior changes. |
| NAMESPACE | Exports fetch_mp_lookup() and reformats importFrom() blocks. |
| man/write_df_to_delta.Rd | Fixes/normalizes Rd \seealso{} link formatting. |
| man/pretty_time.Rd | Normalizes Rd \seealso{} link formatting. |
| man/pretty_time_taken.Rd | Normalizes Rd \seealso{} link formatting. |
| man/pretty_num.Rd | Normalizes Rd \seealso{} link formatting. |
| man/pretty_num_table.Rd | Normalizes Rd \seealso{} link formatting. |
| man/pretty_filesize.Rd | Normalizes Rd \seealso{} link formatting. |
| man/get_air_version.Rd | Adds generated internal docs for get_air_version(). |
| man/get_air_path.Rd | Adds generated internal docs for get_air_path(). |
| man/format_fy.Rd | Normalizes Rd \seealso{} link formatting. |
| man/format_fy_reverse.Rd | Normalizes Rd \seealso{} link formatting. |
| man/format_ay.Rd | Normalizes Rd \seealso{} link formatting. |
| man/format_ay_reverse.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_wards.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_regions.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_mp_lookup.Rd | Adds generated docs for the new exported fetch_mp_lookup(). |
| man/fetch_mayoral.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_lsips.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_las.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_lads.Rd | Normalizes Rd \seealso{} link formatting. |
| man/fetch_countries.Rd | Normalizes Rd \seealso{} link formatting. |
| man/dfeR-package.Rd | Updates author listing. |
| man/dfer_min_air_version.Rd | Adds generated internal docs for dfer_min_air_version. |
| man/check_databricks_odbc.Rd | Fixes/normalizes Rd \seealso{} link formatting. |
| man/air_install.Rd | Updates docs for air_install() to include force and version behavior. |
| DESCRIPTION | Updates testthat minimum version and roxygen2 config metadata. |
| .Rbuildignore | Ignores the .posit/ directory in package builds. |
| .gitignore | Ignores the .posit/ directory in git. |
Files not reviewed (22)
- man/air_install.Rd: Generated file
- man/check_databricks_odbc.Rd: Generated file
- man/dfeR-package.Rd: Generated file
- man/dfer_min_air_version.Rd: Generated file
- man/fetch_countries.Rd: Generated file
- man/fetch_lads.Rd: Generated file
- man/fetch_las.Rd: Generated file
- man/fetch_lsips.Rd: Generated file
- man/fetch_mayoral.Rd: Generated file
- man/fetch_mp_lookup.Rd: Generated file
- man/fetch_regions.Rd: Generated file
- man/fetch_wards.Rd: Generated file
- man/format_ay.Rd: Generated file
- man/format_ay_reverse.Rd: Generated file
- man/format_fy.Rd: Generated file
- man/format_fy_reverse.Rd: Generated file
- man/get_air_path.Rd: Generated file
- man/get_air_version.Rd: Generated file
- man/pretty_filesize.Rd: Generated file
- man/pretty_num.Rd: Generated file
- man/pretty_num_table.Rd: Generated file
- man/pretty_time.Rd: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Brief overview of changes
Adds fetch_mp_lookup() to provide a convenient way to retrieve the latest MP lookup data from the maintained mp-lookup repository.
The function is exported, documented, supports optional progress messages, and provides an informative error if the data cannot be fetched.
Hit some issues with Air and decided this was the time to fix that and allow for updating of the Air version, given the recent breaking changes.
Why are these changes being made?
Resolves the request in #144 to make it easier for analysts in R so they don't have to memorise the URL.
Issue ticket number/s and link
Resolves #144