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

Missing expected flows in FEDEFL_INV #120

Open
dt-woods opened this issue Aug 29, 2024 · 8 comments
Open

Missing expected flows in FEDEFL_INV #120

dt-woods opened this issue Aug 29, 2024 · 8 comments

Comments

@dt-woods
Copy link

Working snippet using Python 3.11.7 and lciafmt v.1.1.3:

from lciafmt import Method as LM
from lciafmt import get_method

df = get_method(LM.FEDEFL_INV)
'Carbon dioxide' in sorted(list(df['Flowable'].unique()))

The output is false. Visual inspection confirms this. Is that right?

I just want a simple method to pull CAS Number, Formula, Synonyms for a flow in Federal Elementary Flow List to bulk up my flow metadata.

@bl-young
Copy link
Collaborator

Yes, correct that should be False.

The FEDEFL Inventory Methods create a set of inventory methods that only use a subset of flows. The logic for each indicator showing the list of flows included are available here: https://github.com/USEPA/fedelemflowlist/blob/master/fedelemflowlist/subset_list.py#L13-L21

If you want that flow metadata I would go to fedelemflowlist itself.

And if you are writing flows to JSON, you can probably leverage the fedelemflowlist writing functions to do that automatically (let me look for the right functions...)

@dt-woods
Copy link
Author

Okay. Does the version of FEDELEM INV live on the fedelemflowlist repo? Cause I've only seen it here.

@bl-young
Copy link
Collaborator

e.g., this writes flow objects from a dataframe of flows:

log.info("writing flows from the fedelemflowlist ...")
flowlist = fedelemflowlist.get_flows(preferred_only)
flow_dict = self.__flows
flows = flowlist.query('`Flow UUID` in @flow_dict.keys()')
if preferred_only:
log.info("writing only preferred flows ...")
elif len(flows) != len(flow_dict):
log.warning("not all flows written...")
fedelemflowlist.write_jsonld(flows, path=None,
zw = self.__writer)

@dt-woods
Copy link
Author

e.g., this writes flow objects from a dataframe of flows:

log.info("writing flows from the fedelemflowlist ...")
flowlist = fedelemflowlist.get_flows(preferred_only)
flow_dict = self.__flows
flows = flowlist.query('`Flow UUID` in @flow_dict.keys()')
if preferred_only:
log.info("writing only preferred flows ...")
elif len(flows) != len(flow_dict):
log.warning("not all flows written...")
fedelemflowlist.write_jsonld(flows, path=None,
zw = self.__writer)

I'm already handling the writing of JSON-LD. I just to query for the missing metadata. Thanks for the snippet. I'll try to adapt from that.

@bl-young
Copy link
Collaborator

Okay. Does the version of FEDELEM INV live on the fedelemflowlist repo? Cause I've only seen it here.

subset_list.py in fedelemflowlist is really only used by the LCIAfmt, as far as I know. It probably could have just as easily been a module of LCIAfmt, but for better or worse that's where it is. does that answer your question?

@bl-young
Copy link
Collaborator

I'm already handling the writing of JSON-LD.

certainly up to you how to handle it - I've been trying to route flow writing through fedelemflowlist so that if metadata options change/expand I only have to change it in one spot. For example, until recently our LCIA methods did not include full flow metadata when they were written to JSON.

@dt-woods
Copy link
Author

Okay. Does the version of FEDELEM INV live on the fedelemflowlist repo? Cause I've only seen it here.

subset_list.py in fedelemflowlist is really only used by the LCIAfmt, as far as I know. It probably could have just as easily been a module of LCIAfmt, but for better or worse that's where it is. does that answer your question?

Not exactly. Can I assume that fedelemflowlist is version 1.0.0 of FEDEFL? Where does this version number originate?

"version": "1.0.0",

@bl-young
Copy link
Collaborator

No it would use the latest version in fedelemflowlist (v1.2.4):
https://github.com/USEPA/fedelemflowlist/blob/7f2550a383a026ade3d23c8b0e3f6d1ba411bdd3/fedelemflowlist/globals.py#L56

Good point on that version number on the FEDEFL inventory method itself - I suppose that would change if we add/adjust the logic on what flows get included

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