Skip to content

Conversation

@tsgfan07
Copy link

@tsgfan07 tsgfan07 commented Jun 6, 2025

Resolves #1167
Show only relevant databases for activity relink
Uses bw2data function as previously, but provides keyword arguments to the db.dependents() function.
Also avoids error of non-existing failed variable for opening relink dialogue for activities without exchanges.Lastly, updated relink dialogue to use safe_open_activity_tab signal (unsafe open is broken)

Checklist

If you have write access (otherwise a maintainer will do this for you):

  • Categorize the PR by setting a good title and adding one of the labels:
    bug, feature, ui, change, documentation, breaking, ci
    as they show up in the changelog.
  • Add a milestone to the PR (and related issues, if any) for the intended release.
  • Request a review from another developer.

databases and avoid unsafe activity opening
in relink dialogue.
Avoid error of undefined failed variable in relink
Resolves LCA-ActivityBrowser#1167
@marc-vdm marc-vdm added the change PRs related to minor changes to AB label Jun 6, 2025
@marc-vdm marc-vdm requested a review from mrvisscher June 6, 2025 08:01
@marc-vdm
Copy link
Member

marc-vdm commented Jun 6, 2025

Hi @tsgfan07 Thanks a lot for taking the time to contribute to AB! @mrvisscher is currently out-of-office until ~half July, he will have a look at this once he's back. Sorry for the delay, but we haven't forgotten this PR :)

@coveralls
Copy link

Coverage Status

coverage: 53.129% (-0.02%) from 53.151%
when pulling c7b4be6 on tsgfan07:activity_relinking_update
into 0bbfa0d on LCA-ActivityBrowser:main.

@mrvisscher
Copy link
Collaborator

Hi @tsgfan07,

Thank you so much for your PR, it is much appreciated! It seems to be working perfectly, I've made one remark that could improve the functioning of the action significantly. Would you take a look?

Kind regards,

Marin

depends = db.find_dependents()
# find the dependents for the activity using bw2data method and construct the alternatives in tuple format
data = {}
data[activity.key] = db.load()[activity.key]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am slightly worried about this. db.load() is a very intensive function, and although I realize db.find_dependents() also uses this method, it will be very VERY slow for a database the size of ecoinvent.

The data we need is already there in activity.exchanges(). It should be a lot quicker to just iterate over them and make a set of their input databases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change PRs related to minor changes to AB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relink activity improvement

4 participants