LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
148 stars 57 forks source link

Add warning when creating circular exchanges between databases #1353

Open marc-vdm opened 2 months ago

marc-vdm commented 2 months ago

Feature request

Databases can have input exchanges from other databases (whichs adds them to the dependends column for databases)

There is nothing stopping users from creating circular exchanges between databases, making it impossible to use them again outside of that project.

Suppose the following situation: Database 1 with activity A and B Database 2 with activity C Database 3 with activity D

The above situation is a problem when user exports both databases and tries to import them. This is a problem because both databases refer to eachother as dependent, so neither can be imported first as the dependency is not in the project yet.

This could be complicated by indirectly creating this circular dependency through n databases, e.g. including activity D from db3.

When trying to create an exchange, AB should check the full database dependency chain and give a warning if user is trying to create a circular dependency. IMO this should still be allowed if user wishes to do this, but they should be informed that their data cannot be imported in other projects anymore.

mrvisscher commented 2 months ago

I think the core of this issue is that we currently do not support importing unlinked exchanges. This is something we should add in the feature as it's an important part of project/database management: giving users the flexibility to later link these exchanges manually.