Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 21 forks source link

GWP use impact value is "not implemented" in last version for at least desktop and laptop #280

Closed gderamecourt closed 3 months ago

gderamecourt commented 3 months ago

Bug description

When requesting for the GWP impact values for laptops and desktops (at least), the value returned is "not implemented" in version 1.2.2. In version 1.1.0, the values were correctly retrieved.

To Reproduce

12/03/2024 : Web API : https://api.boavizta.org/v1/terminal/laptop?verbose=false&duration=200&archetype=laptop-pro&criteria=gwp Or docker : docker run -p 5000:5000 ghcr.io/boavizta/boaviztapi:latest

Expected behavior

For pro laptop : {"impacts":{"gwp":{"embedded":{"value":1.033,"min":1.033,"max":1.033,"warnings":["Generic data used for impact calculation."]},"use":{"value":1.7,"min":0.069,"max":6.79},"unit":"kgCO2eq","description":"Total climate change"}}}

JSON OUTPUT

{"impacts":{"gwp":{"unit":"kgCO2eq","description":"Total climate change","embedded":{"value":181.0,"min":181.0,"max":181.0,"warnings":["Generic data used for impact calculation."]},"use":"not implemented"}}}

Additional context

N/A

da-ekchajzer commented 3 months ago

Thank you for your bug report. This is indeed a bug due to the new implementation of the internal impact assessment functions.

Instead of testing whether a value for the electrical power of the device was available, we tested whether the value was set (i.e. supplied by the user). The API did not fetch the default archetype value and returned not implemented. If you test version 1.2.2 on the post route by specifying {"usage":{"avg_power":3}} the API returns an impact for usage.

This has been fixed in the latest commit in the main branch. The release should arrive within the week. I let you test to validate.

We are interested in the uses of the API. If you wish, could you tell us your use case? Thanks in advance.

gderamecourt commented 3 months ago

Hello, thank you for the quick fix 👍 It is OK on the web version, and with Docker image 1.2.3.