Closed karpfen closed 4 months ago
@goergen95 I noticed one potential issue when I played around with this approach yesterday.
Ideally, everything that's set under params
should be validated against the package imho.
This means in the case above:
get_key_biodiversity_areas
existsget_key_biodiversity_areas
has a parameter named path
get_gfw_treecover
existsget_gfw_treecover
has a parameter named version
However, available_resources()
does not give us the actual function name (e.g. get_gfw_treecover
), but instead the "alias" gfw_treecover
. We need the alias to check against available_resources()$name
, but for the actual call we then need the real function name; so we would need to get that mapping somewhere. I don't think that's possible right now, no?
We will require validation, but I see this happening in two stages:
mapme.biodiversity
function calls, so from your example we would construct get_key_biodiversity__areas(path = "./kbas.gpkg")
. If errors occur here we should expose those to the userIn summary, I do not see the need to go over available_resources()
for this to work.
Something like this should get the job done:
f <- getFromNamespace("get_key_biodiversity_areas", "mapme.biodiversity")
f(path = "./kbas.gpkg")
Taking first steps here. Validating the configuration via JSON Schema looks fine. Next steps are to figure out how to represent resources/indicators as objects in JSON Schema.
Update: That seems to work now, too. Next up is some R logic to construct proper function calls from the validated yaml and start the processing.
I think the schema
branch is ready for testing now. :crossed_fingers:
Currently, most indicator parameters (e.g.
min_size
insrc/gfw.R
) are hard coded in the individual scripts insrc
. I propose to extend theconfig.yml
file to include these parameters. I'm thinking of something that looks like this in the end:Does that make sense to you, @goergen95?