USEPA / LCIAformatter

MIT License
24 stars 9 forks source link

Missing expected flows in FEDEFL_INV #120

Open dt-woods opened 2 weeks ago

dt-woods commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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

bl-young commented 2 weeks ago

e.g., this writes flow objects from a dataframe of flows: https://github.com/USEPA/LCIAformatter/blob/b16f092a4ec4f23b56dabe6bfac86fa8a55fee71/lciafmt/jsonld.py#L90-L99

dt-woods commented 2 weeks ago

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

https://github.com/USEPA/LCIAformatter/blob/b16f092a4ec4f23b56dabe6bfac86fa8a55fee71/lciafmt/jsonld.py#L90-L99

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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?

https://github.com/USEPA/LCIAformatter/blob/b16f092a4ec4f23b56dabe6bfac86fa8a55fee71/lciafmt/data/methods.json#L36

bl-young commented 2 weeks ago

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