As I start to use tiltPlot I identify some issues that I see. I record them here so I don't forget. Later I'll polish and follow up.
map
[ ] Handle postcodes
# Fails
without_financial |>
transform(postcode = as.character(postcode)) |>
map_region_risk(country_code = "DE", benchmark = "unit")
#> Error in map_region_risk(transform(without_financial, postcode = as.character(postcode)), : could not find function "map_region_risk"
# This seems like an easy solution
without_financial |>
transform(postcode = as.integer(as.character(postcode))) |>
map_region_risk(country_code = "DE", benchmark = "unit")
#> Error in map_region_risk(transform(without_financial, postcode = as.integer(as.character(postcode))), : could not find function "map_region_risk"
# Note some postcodes may include letters, and this "solution" turns then to NA
as.integer(c("1234", "5678netherlands"))
#> Warning: NAs introduced by coercion
#> [1] 1234 NA
library(tiltWebTool)
library(tiltPlot)
# All of this fails in a similar way
emissions |> unnest_company() |> tiltPlot::map_region_risk()
#> Error in `mutate()`:
#> ℹ In argument: `risk_category_var = as_risk_category(data[[risk_var]])`.
#> Caused by error in `data[[risk_var]]`:
#> ! Can't extract column with `risk_var`.
#> ✖ Subscript `risk_var` must be size 1, not 2.
sector |> unnest_company() |> tiltPlot::map_region_risk()
#> Error in `mutate()`:
#> ℹ In argument: `risk_category_var = as_risk_category(data[[risk_var]])`.
#> Caused by error in `data[[risk_var]]`:
#> ! Can't extract column with `risk_var`.
#> ✖ Subscript `risk_var` must be size 1, not 0.
sector |> unnest_product() |> tiltPlot::map_region_risk()
#> Error in `mutate()`:
#> ℹ In argument: `risk_category_var = as_risk_category(data[[risk_var]])`.
#> Caused by error in `data[[risk_var]]`:
#> ! Can't extract column with `risk_var`.
#> ✖ Subscript `risk_var` must be size 1, not 0.
[ ] Download all the data we need to map the companies we have
Start with the toy data, then with the real data.
This ensures to request what we need only once and avoid saturating the kind service of the API. Also make us fully independent from failures of the server, and we can drop any dependencies related to making those requests. This all means easier maintainance, easier and faster deployments, and a snappier experience for the user.
Notice it takes close to 10 seconds with only 100 companies
[ ] In general the interfaces don't communicate the type of "standard tilt input" they work with -- i.e. which iindicator and level -- neither they still handle the class "tilt_profile".
[ ] Study (again) what system-level requirements we need
I think last time I figured that installing tiltPlot with pak::pak() solved the problem because it discovered the required system dependencies.
Deployments to shinyapps.io failed with what I show below. I think we faced similar problems with system level libraries. TODO revisit those conversations to find the solution.
- Installing units ... FAILED
================================================================================
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/runner/work/tiltWebTool/tiltWebTool/renv/staging/1/units/libs/units.so':
libudunits2.so.0: cannot open shared object file: No such file or directory
Calls: loadNamespace -> library.dynam -> dyn.load
Execution halted
Error: Error: error testing if 'units' can be loaded [error code 1]
ss
SystemRequirements: libudunits2-dev
As I start to use tiltPlot I identify some issues that I see. I record them here so I don't forget. Later I'll polish and follow up.
map
Start with the toy data, then with the real data.
This ensures to request what we need only once and avoid saturating the kind service of the API. Also make us fully independent from failures of the server, and we can drop any dependencies related to making those requests. This all means easier maintainance, easier and faster deployments, and a snappier experience for the user.
Notice it takes close to 10 seconds with only 100 companies
This is likely because of the time it takes to make requests. Here we see a message that suggests we're making a request:
In addition to having a local copy of the data, we can also avoid recomputations by memoising the function.
Created on 2024-06-01 with reprex v2.1.0
barplot
Created on 2024-06-01 with reprex v2.1.0
[ ] In general the interfaces don't communicate the type of "standard tilt input" they work with -- i.e. which iindicator and level -- neither they still handle the class "tilt_profile".
[ ] Study (again) what system-level requirements we need
I think last time I figured that installing tiltPlot with
pak::pak()
solved the problem because it discovered the required system dependencies.Deployments to shinyapps.io failed with what I show below. I think we faced similar problems with system level libraries. TODO revisit those conversations to find the solution.