Skip to content
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

Feature Brainstorm: Automatic model diagrams #10

Open
billdenney opened this issue Jun 12, 2022 · 5 comments
Open

Feature Brainstorm: Automatic model diagrams #10

billdenney opened this issue Jun 12, 2022 · 5 comments

Comments

@billdenney
Copy link
Collaborator

Automatic model diagrams would be hard to get right, but I think that we could possibly get close (good enough for most reports and giving the user something to work from in any case). This will be oriented toward PK/PD models, and it should work okay with PK combined to a single PD model, I think.

Here is how I'm thinking of it:

  • Any dosing compartment goes on the top (detected based on dosing records in the data. Compartments then connect down from there.
  • The next row would follow compartments that receive transport from the dosing compartment (detected by being in the differential equations and having a plus sign on the term with the dosing compartment amount)
  • Anything with bidirectional transport from the central compartment goes to the left of the central compartment (fanning up and down if there are more than one)
  • Any unidirectional transport out of the central compartment should be clearance, and it should go below that.
  • Any interaction with the central compartment that does not affect mass transport (e.g. an effect compartment) would go to the right. These would be assumed to be a PD model.
  • Input compartments to the PD model would go above and outputs would go below.

I think that all of this could be automated. The way that I'm doing it right now would add dependencies of tidygraph and ggraph.

An example is in thomasp85/ggraph#316 (comment)

@mattfidler
Copy link
Member

I had this feature when I first started working with rxode but used regular expressions. I thought if was to fragile. I thinj if we do it it should be with parsing.

@mattfidler
Copy link
Member

Should it be in nlmixr2plot?

@billdenney billdenney transferred this issue from nlmixr2/nlmixr2extra Jun 12, 2022
@billdenney
Copy link
Collaborator Author

@mattfidler , Good point that it should be in nlmixr2plot. I moved the issue.

I think that it can be done with parsing and that it can be robust for what it does. As I'm thinking about it now, there will be some specific limitations about how the model equations will have to be formatted. It should be possible to loosen those with time.

@mattfidler
Copy link
Member

mattfidler commented Jun 13, 2022

Perhaps this can also be looked at in another direction. Using shiny+diagram to create models. It would be less fragile? And perhaps more useful for some...

@billdenney
Copy link
Collaborator Author

Once we have the ability to make a graph (in the "set of nodes and vertices" sense), it should be straight-forward to visualize the diagram in many different ways. To me, the fragility will be in the creation of the graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants