moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
403 stars 27 forks source link

Searching in loaded packages from flow_view_uses ? #190

Open llrs opened 1 week ago

llrs commented 1 week ago

I'm trying to use flow to see the dependencies of functions between several packages. I want to know if I change package function (A::func_a) how it will impact other packages (B::func_b, C::func_c).

I thought that by loading the other packages flow_view_uses would be able to find the function usage inside all of them. Based on the following example I need to specify which package namespace I want to search:

library("teal.logger") # Changed function log_shiny_input_changes
library("teal.modules.clinical") # From github, uses function here: https://github.com/insightsengineering/teal.modules.clinical/blob/5b9192679cf2e670584a81c815bb1ec4267c4c7a/R/tm_a_mmrm.R#L854
library("flow")
flow_view_uses(log_shiny_input_changes) # Doesn't show any node
flow_view_uses(log_shiny_input_changes, pkg = "teal.modules.clinical") # Works

Is it possible to extend flow_view_uses to look up in all the namespace?

moodymudskipper commented 1 week ago

I believe you mean pkg = "teal.modules.clinical", and by namespace you might mean workspace ?

Looking into several namespaces at the same time would open a can of worm because functions there might depend on each other too, though it could be a feature I guess, to see all indirect dependencies this way.

It seems feasible, we need several things though:

For multiple packages to work well, we need to actually check for fake friends (homonym functions), by checking if the searched items are accessible from the environment.

It is feasible and I see the value.

I'll start tagging the issues with help-wanted because I don't have so much time for flow these days

llrs commented 1 week ago

Yes, I meant pkg =, sorry.

That looks like a plan that could work, I thought that flow_view_uses already consider fake friends... but I see the issues it could face.

I'll see if I can understand better how flow works and help more. Thanks!!