jessecambon / tidygeocoder

Geocoding Made Easy
https://jessecambon.github.io/tidygeocoder
Other
283 stars 20 forks source link

need hipaa compliant geocodio endpoint #137

Closed groliver-pcci closed 3 years ago

groliver-pcci commented 3 years ago

geocodio service has a separate hipaa compliant endpoint, access is restricted to this address only.

Can future release add a geocodio-hipaa, flag or api-url alias in api_url "geocodio" = get_geocodio_url(geocodio_v, reverse = reverse , hipaa= F),

or

get_geocodio_hipaa_url <- function(api_v ='1.6', reverse = FALSE) {

return API URL based on api version (ex. 1.6)

url_keyword <- if (reverse == TRUE) 'reverse' else 'geocode' return(paste0("https://api-hipaa.geocod.io/v", as.character(api_v), "/", url_keyword)) }

jessecambon commented 3 years ago

Hi @groliver-pcci, yes we could add a geocodio_hipaa = TRUE/FALSE parameter. Just to make sure, you are currently able to use the HIPAA endpoint with api_url = https://api-hipaa.geocod.io/v1.6/geocode and api_url = https://api-hipaa.geocod.io/v1.6/reverse, correct?

groliver-pcci commented 3 years ago

Yes, by subbing the url out manually, but I did not rebuild from base code so some helper functions weren't full working

if you make a branch with it added I can test with my API key

Thanks for your interest Holt Oliver From: Jesse Cambon @.> Sent: Monday, September 20, 2021 8:47 AM To: jessecambon/tidygeocoder @.> Cc: George 'Holt' Oliver @.>; Mention @.> Subject: Re: [jessecambon/tidygeocoder] need hipaa compliant geocodio endpoint (#137)

Hi @groliver-pccihttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgroliver-pcci&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7C7cf18015cd274476e30808d97c3d1c9c%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677424172820098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wM0qGf7QAGCOE8N4q4d7nEqad7sW9dxbHTljbz86s2Y%3D&reserved=0, yes we could add a geocodio_hipaa = TRUE/FALSE parameter. Just to make sure, you are currently able to use the HIPAA endpoint with api_url = https://api-hipaa.geocod.io/v1.6/geocode, correct?

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjessecambon%2Ftidygeocoder%2Fissues%2F137%23issuecomment-922943435&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7C7cf18015cd274476e30808d97c3d1c9c%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677424172830087%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JS6L5Y%2F%2FS0nnhrlRZRcUEG337TvBYwyVR3OvtKpObJI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANJMAWO7Y6CKJ3VRTZ4MG5LUC43M7ANCNFSM5EK7OYPQ&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7C7cf18015cd274476e30808d97c3d1c9c%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677424172830087%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vIAWNMdvYJF6663lAxEJkkGp5BmT7HcnOmE0C2hJ1xg%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7C7cf18015cd274476e30808d97c3d1c9c%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677424172840082%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yGykoSWdESgKIp8fUD5bOKtAslWMeD5eEAbi0%2BuMe5g%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7C7cf18015cd274476e30808d97c3d1c9c%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677424172840082%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=WnF3%2BkEghwi9XpkIDzf5ljPtoPU2eLnU%2FWGQoAHVXF8%3D&reserved=0.

jessecambon commented 3 years ago

Sounds good, I'll let you know when I have a branch ready for you to test.

However, I'm not sure I'm following the issue you are running into. You should be able to just use the api_url parameter to specify the HIPAA endpoint without modifying the current tidygeocoder package code. If this isn't working, could you post a reprex? https://reprex.tidyverse.org/

groliver-pcci commented 3 years ago

Just saw the api_url option which allows to function, but I don't quite under stand why the base geocodio wouldn't work

The initial problem I had without that was an error rm_quote(deparse(substitute(address))) : could not find function "rm_quote" which is from the utils.r, I didn't manually load I suppose.

I had tried to just paste the URL into some helpers and see if it would work

get_geocodio_url <- function(api_v ='1.6', reverse = FALSE) {

return API URL based on api version (ex. 1.6)

url_keyword <- if (reverse == TRUE) 'reverse' else 'geocode' return(paste0("https://api-hipaa.geocod.io/v", as.character(api_v), "/", url_keyword)) }

get_api_url <- function(method, reverse = FALSE, return_type = 'locations', search = 'onelineaddress', geocodio_v = 1.6, iq_region = 'us', mapbox_permanent = FALSE, mapquest_open = FALSE) {

api_url <- switch(method, "osm" = get_osm_url(reverse = reverse), "census" = get_census_url(return_type, search), "geocodio" = get_geocodio_url(geocodio_v, reverse = reverse), "iq" = get_iq_url(iq_region, reverse = reverse), "opencage" = get_opencage_url(), # same url as forward geocoding "google" = get_google_url(), # same url as forward geocoding "mapbox" = get_mapbox_url(mapbox_permanent), # same url as fwd geocoding "here" = get_here_url(reverse = reverse), "tomtom" = get_tomtom_url(reverse = reverse), "mapquest" = get_mapquest_url(mapquest_open, reverse = reverse), "bing" = get_bing_url(), "arcgis" = get_arcgis_url(reverse = reverse), "geoapify" = get_geoapify_url(reverse = reverse) )

if (length(api_url) == 0) stop('API URL not found', call. = FALSE) return(api_url) }

plugging in the api_url directly does seem to work

library(dplyr)

>

> Attaching package: 'dplyr'

> The following objects are masked from 'package:stats':

>

> filter, lag

> The following objects are masked from 'package:base':

>

> intersect, setdiff, setequal, union

library(tidygeocoder) library(tibble) library(dplyr) library(tidygeocoder)

address_single <- tibble(singlelineaddress = c( "11 Wall St, NY, NY", "600 Peachtree Street NE, Atlanta, Georgia" )) address_components <- tribble( ~street, ~cty, ~st, "11 Wall St", "NY", "NY", "600 Peachtree Street NE", "Atlanta", "GA" )

sample_addresses %>% slice(1:2) %>% geocode(addr, method = 'geocodio')

> Warning in query_api(api_url, query_parameters, mode = "list", input_list =

> address_list, : Forbidden (HTTP 403).

> Error: Can't subset columns that don't exist.

> x Columns lat and long don't exist.

geocodio

Sys.getenv("GEOCODIO_API_KEY")

see if updated

system curl works

system(paste("curl", paste0("https://api-hipaa.geocod.io/v1.6/geocode?q=Philadelphia&api_key=", Sys.getenv("GEOCODIO_API_KEY"))))

> [1] 0

osm_s1 <- geo( address = address_single$singlelineaddress, method = "osm", lat = latitude, long = longitude )

error In addition: Warning message:

In query_api(api_url, query_parameters, mode = "list", input_list = address_list, :

Forbidden (HTTP 403).

geo( address = address_single$singlelineaddress, method = "geocodio", lat = latitude, long = longitude )

> Warning in query_api(api_url, query_parameters, mode = "list", input_list =

> address_list, : Forbidden (HTTP 403).

> Error: Can't subset columns that don't exist.

> x Columns latitude and longitude don't exist.

works

geo( address = address_single$singlelineaddress, lat = latitude, long = longitude, method='geocodio', api_url ="https://api-hipaa.geocod.io/v1.6/geocode" )

> # A tibble: 2 x 3

> address latitude longitude

>

> 1 11 Wall St, NY, NY 40.7 -74.0

> 2 600 Peachtree Street NE, Atlanta, Georgia 33.8 -84.4

geo( address = address_single$singlelineaddress, lat = latitude, long = longitude, method='geocodio',geocodio_v ="1.6" )

> Warning in query_api(api_url, query_parameters, mode = "list", input_list =

> address_list, : Forbidden (HTTP 403).

> Error: Can't subset columns that don't exist.

> x Columns latitude and longitude don't exist.

From: Jesse Cambon @.> Sent: Monday, September 20, 2021 10:53 AM To: jessecambon/tidygeocoder @.> Cc: George 'Holt' Oliver @.>; Mention @.> Subject: Re: [jessecambon/tidygeocoder] need hipaa compliant geocodio endpoint (#137)

Sounds good, I'll let you know when I have a branch ready for you to test.

However, I'm not sure I'm following the issue you are running into. You should be able to just use the api_url parameter to specify the HIPAA endpoint without modifying the current tidygeocoder package code. If this isn't working, could you post a reprex? https://reprex.tidyverse.org/https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Freprex.tidyverse.org%2F&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Ca9c6e6f4b0e24a42a11408d97c4eabba%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677499607542058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ZX9L%2Bl4sR1hntYZwEHrIIsMFZDxkKsZIL1x2%2BX%2BL%2BfI%3D&reserved=0

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjessecambon%2Ftidygeocoder%2Fissues%2F137%23issuecomment-923054265&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Ca9c6e6f4b0e24a42a11408d97c4eabba%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677499607552052%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bUL%2BvYbLRGzOVxdN24Cpn6N1%2BFZu%2FiOBwAM1xUGjZmI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANJMAWJOFH3LMVXMB65O7O3UC5KELANCNFSM5EK7OYPQ&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Ca9c6e6f4b0e24a42a11408d97c4eabba%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677499607552052%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HIEQn%2BwJDH6dygEs4w244xX3FmT30joUPGstPvTLBYk%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Ca9c6e6f4b0e24a42a11408d97c4eabba%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677499607562043%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=N5Mgds2GS14g4YAKVSBfHicOCx1QYClRrKv7Bsxie%2Fc%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Ca9c6e6f4b0e24a42a11408d97c4eabba%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677499607562043%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5CG6rk6u9ybDoALZbLMUM6U3AqDGw4YAdfLn1itOpFQ%3D&reserved=0.

jessecambon commented 3 years ago

I see, I typically click the Install and Restart button in the "Build" panel of RStudio to load new code changes I've made on the package. That might be the step you're missing (for loading the rm_quote function, etc.).

In any case, I have a branch ready for you to try. You can install it with this command:

devtools::install_github("jessecambon/tidygeocoder", ref = "geocodio-hipaa")

After that installs you should be able to use the geocodio_hipaa argument like this:

library(tidygeocoder)
results <- geo(address = "Toronto", method = 'geocodio', geocodio_hipaa = TRUE, verbose = TRUE)

Let me know if you run into any issues.

groliver-pcci commented 3 years ago

It works in the simple case! Thanks hope this helps the package lifecycle Holt

devtools::install_github("jessecambon/tidygeocoder", ref = "geocodio-hipaa") library(tidygeocoder) results <- geo(address = "Toronto", method = 'geocodio', geocodio_hipaa = TRUE, verbose = TRUE)

From: Jesse Cambon @.> Sent: Monday, September 20, 2021 4:30 PM To: jessecambon/tidygeocoder @.> Cc: George 'Holt' Oliver @.>; Mention @.> Subject: Re: [jessecambon/tidygeocoder] need hipaa compliant geocodio endpoint (#137)

I see, I typically click the Install and Restart button in the "Build" panel of RStudio to load new code changes I've made on the package (I think that might . That might be the step you're missing (for loading the rm_quote function, etc.).

In any case, I have a branch ready for you to try. You can install it with this command:

devtools::install_github("jessecambon/tidygeocoder", ref = "geocodio-hipaa")

After that installs you should be able to use the geocodio_hipaa argument like this:

library(tidygeocoder)

results <- geo(address = "Toronto", method = 'geocodio', geocodio_hipaa = TRUE, verbose = TRUE)

Let me know if you run into any issues.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjessecambon%2Ftidygeocoder%2Fissues%2F137%23issuecomment-923330159&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Cd25e14519422459d93db08d97c7dd6ca%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677702192697270%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jYqfzDiw2CG%2B4htn78jfdLHHBQ%2FQRZK4XNkP6XCMvvI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANJMAWMJOVSZFFQRM5LGAUDUC6RWRANCNFSM5EK7OYPQ&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Cd25e14519422459d93db08d97c7dd6ca%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677702192707267%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ITtqJyIrnJQnBqjBTS%2BhqtxqADa%2F7hpINsyEp2Hxmeo%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Cd25e14519422459d93db08d97c7dd6ca%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677702192707267%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xaBtsp0XMXsdfSx5jYGWccKR%2BDvOdYW5FPTG%2BKh7tLw%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cgeorge.oliver%40pccinnovation.org%7Cd25e14519422459d93db08d97c7dd6ca%7C9a2a9ade704f4416b09447b8a504ad39%7C0%7C0%7C637677702192717262%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g5QANtb0Jcra8XQPYTIgO1q%2BCFQtNWNlXkQoM5VxEPo%3D&reserved=0.

dpprdan commented 3 years ago

Since it is possible to query the HIPAA geocod.io API with the api_url parameter, I am wondering whether an additional parameter is really necessary. One could use purrr::partial to save some typing in case geo() is called more than once in a script.

library(tidygeocoder)
library(purrr)

address <- "600 Peachtree Street NE, Atlanta, GA"

# Query to the main geocod.io API
geo(address, method = "geocodio", verbose = TRUE)
#> Number of Unique Addresses: 1
#> Querying API URL: https://api.geocod.io/v1.6/geocode
#> Passing the following parameters to the API:
#> q : "600 Peachtree Street NE, Atlanta, GA"
#> api_key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> limit : "1"
#> HTTP Status Code: 200
#> Query completed in: 1 seconds
#> 
#> # A tibble: 1 x 3
#>   address                                lat  long
#>   <chr>                                <dbl> <dbl>
#> 1 600 Peachtree Street NE, Atlanta, GA  33.8 -84.4
# use purrr:partial to build a custom geo() function. 
hipaa_geo <- partial(geo, method = "geocodio", api_url = "https://api-hipaa.geocod.io/v1.6/geocode")

# hipaa_geo() works just like geo(method = "geocodio", api_url = "https://api-hipaa.geocod.io/v1.6/geocode") would
# The query fails here, because I don't have a key for the HIPAA geocod.io API, 
# which is different from the main geocod.io key
hipaa_geo(address, verbose = TRUE)
#> Number of Unique Addresses: 1
#> Querying API URL: https://api-hipaa.geocod.io/v1.6/geocode
#> Passing the following parameters to the API:
#> q : "600 Peachtree Street NE, Atlanta, GA"
#> api_key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> limit : "1"
#> Warning in query_api(api_url, api_query_parameters, method = method): Forbidden
#> (HTTP 403).
#> HTTP Status Code: 403
#> Error: Invalid API key
#> Query completed in: 0.5 seconds
#> 
#> # A tibble: 1 x 3
#>   address                                lat  long
#>   <chr>                                <dbl> <dbl>
#> 1 600 Peachtree Street NE, Atlanta, GA    NA    NA

Maybe we should advertise the purrr::partial approach a bit for this use-case.

Session info ``` r sessioninfo::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 4.1.1 (2021-08-10) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language en #> collate German_Germany.1252 #> ctype German_Germany.1252 #> tz Europe/Berlin #> date 2021-09-29 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] standard (@0.2.1) #> backports 1.2.1 2020-12-09 [1] standard (@1.2.1) #> cli 3.0.1 2021-07-17 [1] standard (@3.0.1) #> crayon 1.4.1 2021-02-08 [1] standard (@1.4.1) #> curl 4.3.2 2021-06-23 [1] standard (@4.3.2) #> DBI 1.1.1 2021-01-15 [1] standard (@1.1.1) #> digest 0.6.27 2020-10-24 [1] standard (@0.6.27) #> dplyr 1.0.7 2021-06-18 [1] standard (@1.0.7) #> ellipsis 0.3.2 2021-04-29 [1] standard (@0.3.2) #> evaluate 0.14 2019-05-28 [1] standard (@0.14) #> fansi 0.5.0 2021-05-25 [1] standard (@0.5.0) #> fastmap 1.1.0 2021-01-25 [1] standard (@1.1.0) #> fs 1.5.0 2020-07-31 [1] standard (@1.5.0) #> generics 0.1.0 2020-10-31 [1] standard (@0.1.0) #> glue 1.4.2 2020-08-27 [1] standard (@1.4.2) #> highr 0.9 2021-04-16 [1] standard (@0.9) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1) #> httr 1.4.2 2020-07-20 [1] standard (@1.4.2) #> jsonlite 1.7.2 2020-12-09 [1] standard (@1.7.2) #> knitr 1.34 2021-09-09 [1] standard (@1.34) #> lifecycle 1.0.0 2021-02-15 [1] standard (@1.0.0) #> magrittr 2.0.1 2020-11-17 [1] standard (@2.0.1) #> pillar 1.6.2 2021-07-29 [1] standard (@1.6.2) #> pkgconfig 2.0.3 2019-09-22 [1] standard (@2.0.3) #> purrr * 0.3.4 2020-04-17 [1] standard (@0.3.4) #> R6 2.5.1 2021-08-19 [1] standard (@2.5.1) #> reprex 2.0.1 2021-08-05 [1] standard (@2.0.1) #> rlang 0.4.11 2021-04-30 [1] standard (@0.4.11) #> rmarkdown 2.11 2021-09-14 [1] standard (@2.11) #> rstudioapi 0.13 2020-11-12 [1] standard (@0.13) #> sessioninfo 1.1.1 2018-11-05 [1] standard (@1.1.1) #> stringi 1.7.4 2021-08-25 [1] CRAN (R 4.1.1) #> stringr 1.4.0 2019-02-10 [1] standard (@1.4.0) #> styler 1.6.1 2021-09-17 [1] standard (@1.6.1) #> tibble 3.1.4 2021-08-25 [1] standard (@3.1.4) #> tidygeocoder * 1.0.3 2021-04-19 [1] standard (@1.0.3) #> tidyselect 1.1.1 2021-04-30 [1] standard (@1.1.1) #> utf8 1.2.2 2021-07-24 [1] standard (@1.2.2) #> vctrs 0.3.8 2021-04-29 [1] standard (@0.3.8) #> withr 2.4.2 2021-04-18 [1] standard (@2.4.2) #> xfun 0.26 2021-09-14 [1] standard (@0.26) #> yaml 2.2.1 2020-02-01 [1] standard (@2.2.1) #> #> [1] C:/Users/Daniel.AK-HAMBURG/Documents/R/win-library/4.1 #> [2] C:/Program Files/R/R-4.1.1/library ```
jessecambon commented 3 years ago

@dpprdan that's a nice approach for customizing the API endpoint that we could offer.

In geo() we already have a number of parameters that are there to facilitate changing the API endpoint: geocodio_v (Geocodio API version number), mapbox_permanent, iq_region, return_type (for US Census), and mapquest_open. One solution could be to wrap all of these parameters into a single named list parameter api_options. For instance:

geo(address = 'Seoul', method = 'geocodio', api_options = list(geocodio_v = 1.6, geocodio_hipaa = TRUE))

This would allow us to accommodate some API endpoint customization shortcuts while reducing the number of parameters in geo() (and reverse_geo()). For additional API endpoint customization that we aren't offering a shortcut for, we could offer your purrr::partial approach.

jessecambon commented 3 years ago

The api_options parameter described above is now implemented in the development version (main branch). See the geo function documentation for details.