Natixar / natixar-frontend

The static front end of the Natixar SaaS platform
0 stars 5 forks source link

"No Data Found" in BEGESv5 Donut Even Though Other Charts Show Data #51

Closed lepeuvedic closed 4 months ago

lepeuvedic commented 4 months ago

Problem

When BEGESv5 is selected in the nomenclature selection menu, the donut chart goes to zero and disappears. Accessorily, all the charts turn green from their usual light blue color.

This is not correct behavior because at the same time, the two other charts show correct information with some emissions.

Steps to Reproduce

  1. Authenticate and enter Dashboard
  2. Select BEGES v5 from the nomenclature menu (top right BEGES button)
  3. Observe the donut go green and disappear.

Desired Behavior

astowny commented 4 months ago

For the colors, each is associated to a category. This is managed by the file CategoryColor.ts. The default color is green, that is displayed when there is no matching 'era' (see CategoryColor.ts). For me there is no issue on the colors, it is changing because it is another category displayed in function of the data returned.

ChrisNatixar commented 4 months ago

The data returned for BEGES V5 does not have the era set properly and this is why the donut is not displaying correctly. According to the json returned by the api the top-level ids category ids for Beges V5 are 86, 92, 95, 101,107,112.

The donut code only takes unique era. id 92 has an era defined so that is included in the donut, all the other ids have era set as "", so they just overwrite each other in the categoryaggregator so only the last id 112 is include in the donut. In the data set only id 86 has any emissions, and as it is not included in the donut set then the donut is empty.

The solution is that the era must be correctly set in the backend database for the Beges V5 category ids.

lepeuvedic-natixar commented 4 months ago

Good bug analysis. The donut has nothing to do with the era.

Between you @ChrisNatixar and @astowny , who is taking charge of this bug?

The donut is specified to show top-level groups of categories often called "scopes".

That was the spec (it's a bit out of date, BEGESv5 and its six groups was not widely known, but it's still clear enough):

This diagram is a breakdown of total GHG emissions by source synthesized in Scope 1, Scope 2, Scope

  1. The natural representation is a Pie Chart or a Donut Chart associated with a numeric KPI (metric) in kgCO2eq or tCO2eq (automatically scaled) with the variation from the previous year in absolute value and percentage. When the user clicks on a segment of the chart representing a scope, the side chart is replaced by a horizontal bar chart showing the detail: breakdown of that scope by source.

You will notice that the variation is missing, too, but it's shown in compare mode on the bar chart.

ChrisNatixar commented 4 months ago

I saw that you updated the backend data to include era for these categories. Do you still want me to go ahead and fix the code so that it ignores era and just uses the scopes?

Math712 commented 4 months ago

🇫🇷

Sur ma version il affiche des valeurs pour la v5 et quand je sélectionne le BEGES il n'affiche rien car les ids des catégorie du jeu de données ne match pas avec les ids des catégories du protocole, mais je trouve ça quand même bizarre car quand je lis la documentation fournis par l'état français sur les méthodes de calcul il y a une correspondance qui doit être fait entre les méthodes de calcul. Donc chaque émissions devraient être tagué pour tous les protocoles

🇬🇧

On my version it displays values ​​for v5 and when I select BEGES it displays nothing because the ids of the categories in the dataset do not match with the ids of the protocol categories, but I still find it strange because when I read the documentation provided by the French government on the calculation methods; there is a correspondence that must be made between the calculation methods. So each emissions should be tagged for all protocols

ChrisNatixar commented 4 months ago

Agree that this is an issue with the data from the api. The category ids for the returned data are all for the GHG protocol, not the Beges protocol, so there is no data to display.