Dear @ocni-dtu,
thank you so much for your quick and resolution regarding #85! For several of the remaining EPDs (~40 for my use case, identified through the Eco-Platform API by filtering for Cambodia, Indonesia, India, Thailand, and Vietnam) I get the error PanicException: called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }. From my understanding, for most of these issue is that several anies have {"value": "ND"} or other strings (MNA), which the string parse cannot convert into a float. I'm not sure what a sensible default handling of this is (or if there even is any). As a workaround I'm using a regex on the stringified dictionary to convert all NDs to zeros. However, there are also 2 EPDs for which I couldn't immediately identify the issue (see list below).
"""
ARRANGE: Load EPD from Node and dump into string format
ACT: read with LCAx `convert_ilcd` (with RUST_BACKTRACE=1)
ASSERT: fails with TypeError: missing field `other` at line 1 column 863
"""
import json
import lcax
import requests
# Arrange
uri = "https://data.environdec.com/resource/datastocks/a6c533b3-502e-47b9-885d-31304bf15c64/processes/1bf3e138-54a4-4155-7116-08da598ce856?version=07.01.004"
response = requests.get(f"{uri}&format=json&view=extended", headers=headers)
response.raise_for_status()
data = response.json()
data["source"] = uri
# Act
RUST_BACKTRACE=1
lcax.convert_ilcd(json.dumps(data), as_type=lcax.EPD)
# Assert
thread '<unnamed>' panicked at modules/convert/src/ilcd/ilcd.rs:147:52:
called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }
---------------------------------------------------------------------------
PanicException Traceback (most recent call last)
Cell In[18], [line 3](vscode-notebook-cell:?execution_count=18&line=3)
[1](vscode-notebook-cell:?execution_count=18&line=1) RUST_BACKTRACE=1
----> [3](vscode-notebook-cell:?execution_count=18&line=3) lcax.convert_ilcd(json.dumps(failing_epd))
File ~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:64, in convert_ilcd(data, as_type)
[61](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/pschreiber/okobau_example/~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:61) data = json.dumps(data)
[63](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/pschreiber/okobau_example/~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:63) try:
---> [64](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/pschreiber/okobau_example/~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:64) _epd = _convert_ilcd(data)
[65](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/pschreiber/okobau_example/~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:65) except Exception as err:
[66](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/pschreiber/okobau_example/~/okobau_example/.venv2/lib/python3.12/site-packages/lcax/__init__.py:66) raise ParsingException(err)
PanicException: called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }
For "ND" and "MNA" examples see :
For the ones where I couldn't identify the problem, see:
- https://data.environdec.com/resource/datastocks/a6c533b3-502e-47b9-885d-31304bf15c64/processes/881b28b9-aaf3-4d80-aea5-08db7e36184f?version=07.01.003
- https://ibudata.lca-data.com/resource/datastocks/7f92c48a-07c6-4a0c-91fd-4166e6138402/processes/e7ff6cf1-d493-4cf0-ba82-6b3f1f6f71e7?version=00.01.000
Dear @ocni-dtu,
thank you so much for your quick and resolution regarding #85! For several of the remaining EPDs (~40 for my use case, identified through the Eco-Platform API by filtering for Cambodia, Indonesia, India, Thailand, and Vietnam) I get the error
PanicException: called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }. From my understanding, for most of these issue is that several anies have{"value": "ND"}or other strings (MNA), which the string parse cannot convert into a float. I'm not sure what a sensible default handling of this is (or if there even is any). As a workaround I'm using a regex on the stringified dictionary to convert all NDs to zeros. However, there are also 2 EPDs for which I couldn't immediately identify the issue (see list below).For "ND" and "MNA" examples see :
For the ones where I couldn't identify the problem, see: