Natixar / natixar-frontend

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

Top Level Groups of Categories not Listed #61

Closed lepeuvedic closed 1 month ago

lepeuvedic commented 1 month ago

Problem

Top level groups of category not listed correctly as objects in BEGESv5 mode. Only two are listed and the appearance is blocky and problematic. The behavior could be explained by an error in the data (see the backend folder and emissions file), or a bug in the algorithm (likely). Missing scopes on BEGESv5 If necessary, the data can be checked in the backend/src/sampleEmissions.js (samples folder as well for pure JSON).

Steps to Reproduce:

  1. Authenticate and enter the Dashboard
  2. Switch to BEGESv5 représentation mode
  3. Observe that only two objects are shown, deformed, instead of 6 expected

Desired Behavior

The donut card must display the 6 direct children of "BEGES v5", together with the total emissions of each group of categories.

astowny commented 1 month ago

image

While receiving data I see no era set on the scopes while the algorithm is based on the era to genereate the rows.

astowny commented 1 month ago

If we use the code, we obtains this : image

because the color is set in function of the era.

astowny commented 1 month ago

@lepeuvedic est-ce que ce fix est correct et je peux le merge dans dev ?

lepeuvedic-natixar commented 1 month ago

Non, bien sûr! Même dans BEGES il n'y a pas de bijection entre scope et era. C'est donc probablement un hasard que les secteurs du donut soient de couleur différente.

Ce dont on a besoin c'est que les secteurs du donut représentent les 3 ou 6 groupes de haut niveau et que les couleurs tiennent lieu de légende, comme dans un bon vieux pie chart ordinaire.

Presque toutes les utilisations de "era" dans le code sont des bugs. C'est au mieux un filtre. Le seul endroit où il devait être utilisé est comme filtre sur la carte. Par contre l'absence de filtre hiérarchique par catégorie me semble un manque criant qui est mal comblé par le filtre scope.

lepeuvedic-natixar commented 1 month ago

Ca n'explique pas pourquoi la même donnée, dans une catégorie très similaire avec le même code "era", ne donne pas la même couleur. Mais il vaut mieux attendre. J'ai une modif en cours sur ce back-end qui corrige certains index.

lepeuvedic-natixar commented 1 month ago

In the current state of the code, there is no provision to keep some level of continuity in the colors when switching from BEGES to BEGESv5 ? Some groups cannot have a definite era, because they group things belonging to different eras, like upstream and downstream transportation (group 3 of BEGESv5, or scope 3 in GHG Protocol and BEGES). BEGESv5 has a garbage category 6-1, that is intrinsically undefined in terms of era (not "O").

lepeuvedic-natixar commented 1 month ago

What I have in mind is, that since we have a function which returns a color as a function of category attributes, we might have a range of colors for era "O" (at last two shades of the same tint) another for the era "D" (same) and another for the era "U" (same) and a last one for mixed categories (usually U/D but could be own in some cases (transportation). This solution would have the advantage of giving always the same tint to similar data, irrespective of the category groups.

astowny commented 1 month ago

Ok, and how do we manage the BEGESv5 as that is intrinsically undefined in terms of era ?

lepeuvedic-natixar commented 1 month ago

Good enough for a merge. There are 4 possibilities for era: "U"/"O"/"D" and "" (empty string). I made sure it's always defined but we will keep the code that equates undefined to "". Further work will be done in issue #5, which is about the donut and colors.