Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIx gis_connection() export #77

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: councilR
Title: Functions and Templates for the Metropolitan Council
Version: 0.2.5
Date: 2023-12-22
Version: 0.2.6
Date: 2024-03-26
Authors@R: c(
person("Metropolitan Council", role = "cph"),
person("Liz", "Roten", , "[email protected]", role = c("cre", "aut"),
Expand Down Expand Up @@ -63,5 +63,5 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Website: https://github.com/Metropolitan-Council/councilR
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(emissions_connection)
export(fetch_county_geo)
export(fetch_ctu_geo)
export(fred_connection)
export(gis_connection)
export(import_from_FRED)
export(import_from_emissions)
export(import_from_fred)
Expand Down
2 changes: 1 addition & 1 deletion R/db_gis.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#'
#' @rdname gis
#' @family database functions
#' @export
#'
#' @param dbname character, database name. Default is `"GISLibrary"`.
#' @param uid character, user ID. Default is `getOption("councilR.uid")`
Expand Down Expand Up @@ -164,7 +165,6 @@ import_from_gis <- function(query,
# if there are any geometry columns,
# pull as wkt
if ("geometry" %in% column_names$DATA_TYPE) {

# fetch column name with geometry
geo_column <- column_names %>%
dplyr::filter(DATA_TYPE == "geometry") %>%
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Please see our contribution guidelines [here](.github/CONTRIBUTING.md).
Thanks to all the folks who have contributed to this project in one way or another

[&#x0040;ashleyasmus](https://github.com/ashleyasmus), [&#x0040;ehesch](https://github.com/ehesch), [&#x0040;eroten](https://github.com/eroten),
[&#x0040;velicknd](https://github.com/velicknd), [&#x0040;Brandon-Whited](https://github.com/Brandon-Whited), [&#x0040;LimerickSam](https://github.com/LimerickSam), and [&#x0040;leonx075](https://github.com/leonx075).
[&#x0040;velicknd](https://github.com/velicknd), [&#x0040;schroeder-matt](https://github.com/schroeder-matt), [&#x0040;Brandon-Whited](https://github.com/Brandon-Whited), [&#x0040;LimerickSam](https://github.com/LimerickSam), and [&#x0040;leonx075](https://github.com/leonx075).



Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ or another
[@ehesch](https://github.com/ehesch),
[@eroten](https://github.com/eroten),
[@velicknd](https://github.com/velicknd),
[@schroeder-matt](https://github.com/schroeder-matt),
[@Brandon-Whited](https://github.com/Brandon-Whited),
[@LimerickSam](https://github.com/LimerickSam), and
[@leonx075](https://github.com/leonx075).
8 changes: 4 additions & 4 deletions tests/testthat/test-db_FRED.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ testthat::test_that("upercase group quarters table", {
table_name = "GQ_UNIT",
prod = TRUE,
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
db = "CD_RESEARCH_WEB"
)

Expand All @@ -33,7 +33,7 @@ testthat::test_that("lowercase group quarters table", {
table_name = "GQ_UNIT",
prod = TRUE,
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
db = "CD_RESEARCH_WEB"
)

Expand All @@ -48,7 +48,7 @@ testthat::test_that("lowercase group quarters table", {
testthat::test_that("lowercase park unit via SQL", {
fred <- fred_connection(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
db = "CD_RESEARCH_WEB"
)

Expand All @@ -68,7 +68,7 @@ testthat::test_that("lowercase park unit via SQL", {
testthat::test_that("uppercase park unit via SQL", {
fred <- FRED_connection(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
db = "CD_RESEARCH_WEB"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-db_emissions.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ testthat::skip_if(httr2::secret_has_key("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins"))
testthat::test_that("emissions connection returns connection object", {
test_conn <- emissions_connection(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY")
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY")
)

testthat::expect_s4_class(test_conn, "Microsoft SQL Server")
Expand All @@ -43,7 +43,7 @@ testthat::test_that("emissions connection returns connection object", {
testthat::test_that("Residential electricity data is returned", {
electric_residential <- import_from_emissions(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
table_name = "metro_energy.vw_electricity_residential_ctu"
)

Expand Down
11 changes: 8 additions & 3 deletions tests/testthat/test-db_gis.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ testthat::skip_if(

testthat::skip_if(httr2::secret_has_key("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins"))

testthat::test_that("gis_connection is exported", {
testthat::expect_true("gis_connection" %in% ls("package:councilR"))
})


testthat::test_that("GIS connection returns connection object", {
test_conn <- gis_connection(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY")
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY")
)

testthat::expect_s4_class(test_conn, "Microsoft SQL Server")
Expand All @@ -32,7 +37,7 @@ testthat::test_that("GIS connection returns connection object", {
testthat::test_that("airports spatial dataset", {
airport <- import_from_gis(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
query = "GISLibrary.dbo.AIRPORTS",
dbname = "GISLibrary",
.quiet = TRUE
Expand All @@ -50,7 +55,7 @@ testthat::test_that("airports spatial dataset", {
testthat::test_that("county ctu lookup table", {
lookup_table <- import_from_gis(
uid = httr2::secret_decrypt("QUHBRb_yoy2RRj59qno8NVXA7mW402xkins", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("rQHk4S39pjfJ6yoKWUUNpQUDk2i9XA3d", "COUNCILR_KEY"),
pwd = httr2::secret_decrypt("tsGlVlM0KBdLcUPNLX5f0Hll2_6HFF_rQx62cw", "COUNCILR_KEY"),
query = "GISLibrary.dbo.CountyCTULookupTable",
dbname = "GISLibrary",
.quiet = TRUE
Expand Down
Loading