-
Notifications
You must be signed in to change notification settings - Fork 0
Vectorize povline #403
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
Vectorize povline #403
Conversation
|
Hi @shahronak47 , I tested the output and it is looking very nice. Yes, this is what I had in mind. Thank you. So, These would be the next steps
|
randrescastaneda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shahronak47 ,
There seems to be a problem when more than one poverty line is requested for the case of CHN. See code below
out <- pip(country = "CHN",
year = c(2010, 2018),
povline = c(1.675, 1.9),
lkup = lkup)Thanks.
proposed change with grouped by poverty_line
|
Hi @randrescastaneda , I have pushed the fixes and now all the test cases from #413 pass. You can do some more round of testing if you have time or else we will wait till mid-September before merging this PR. Thank you for providing with the test file, it was very helpful. |
|
hi @shahronak47 , |
|
Thanks @randrescastaneda for catching that and adding the test. I have done the necessary changes and now the tests should pass. |
…Team/pipapi into vectorize-povline
…Team/pipapi into vectorize-povline
|
Switch to |
|
Hi @shahronak47 , I tested this version and it is faling on adding new lines to the master when old lines are present in the request. See the examples below. Thanks. # SET UP
devtools::load_all(".")
library(fastverse)
force <- FALSE
if (!"lkups" %in% ls() || isTRUE(force)) {
data_dir <- Sys.getenv("PIPAPI_DATA_ROOT_FOLDER_LOCAL") |>
fs::path()
fs::dir_ls(data_dir, recurse = FALSE)
}
latest_version <-
available_versions(data_dir) |>
max()
lkups <- create_versioned_lkups(data_dir,
vintage_pattern = "2025")
lkup <- lkups$versions_paths[[lkups$latest_release]]
# PROBLEM
# this works because all numbers are new
pls <- runif(20, min = 5, max = 25)
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
waldo::compare(unique(col$poverty_line),
pls,
tolerance = 1e-10)
# thus, it saves the data correctly and retunrs from cache
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
# however, when new pov lines and old povlines are included in the request,
# only the old ones are returned and the new ones are NOT saved
pls <- seq(10, 30, .1)
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
waldo::compare(unique(col$poverty_line),
pls,
tolerance = 1e-10)
# So this is processed again and still does not work
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
unique(col$poverty_line)
|
randrescastaneda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shahronak47 ,
Thank you for the changes. Unfortunately, it is still not working. Pleas take a look at the code below. You can see that both calls take almost the same time. it seems as if the duckdb file is not updated, the same call is processed again. also, note that I modified a little de DESCRIPTION file, but it is completely independent from this. THANKS.
# remotes::install_github("PIP-Technical-Team/pipapi@vectorize-povline")
# SET UP
devtools::load_all(".")
library(fastverse)
force <- FALSE
if (!"lkups" %in% ls() || isTRUE(force)) {
data_dir <- Sys.getenv("PIPAPI_DATA_ROOT_FOLDER_LOCAL") |>
fs::path()
fs::dir_ls(data_dir, recurse = FALSE)
}
latest_version <-
available_versions(data_dir) |>
max()
lkups <- create_versioned_lkups(data_dir,
vintage_pattern = "2025")
lkup <- lkups$versions_paths[[lkups$latest_release]]
# PROBLEM
# this works because all numbers are new
pls <- runif(20, min = 5, max = 25)
tictoc::tic()
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
t1 <- tictoc::toc()
waldo::compare(unique(col$poverty_line),
pls,
tolerance = 1e-10)
# It takes the same time to process everything again.
tictoc::tic()
col <- pip(country = "COL",
year = 2020:2025,
povline = pls,
lkup = lkup)
t2 <- tictoc::toc()
t1$callback_msg
t2$callback_msg
Hi Andres,
This is the first draft of vectorize povline. I just want to confirm the expected output. To test this install
vectorize-povlinebranch inwbpipusing -You can then test -