Green-Software-Foundation / if

Impact Framework
https://if.greensoftware.foundation/
MIT License
149 stars 40 forks source link

Update explain behavior to support the visualizer flyout function. #1058

Open jawache opened 3 days ago

jawache commented 3 days ago

The vizualizer fly out needs to be able to show inputs and outputs properly, e.g. in this example I'm hovering over a pipeline and two outputs are highlighted. One is an input and one is an output, the current underlying data in the manifest file doesn't show inputs/outputs (yes, I know I asked for it in this way, I was wrong!) so we need to add them back in.

Can we also call the field in the manifest, "key" or something other than "explain", I feel explain should do more than just describe the fields.

Screenshot 2024-10-23 at 13 22 04

Details for Narek

We basically want to revert the changes in this PR https://github.com/Green-Software-Foundation/if/issues/971

So instead of returning

param-name
  plugins: //what plugins use this param?
  unit: 
  description:
  aggregation-method:

we should instead return:

plugin-name:
  inputs:
    param-1:
      description:
      unit: 
      aggregation-method:

So the parameter details are organized by plugin, then inputs/outputs. The aggregation method should still be returned. It is understood that this will lead to repetition of the parameters in the explain block if theyare used in multiple plugins. This is fine, as long as the aggregation method and unit are the same for identically named parameters.

Example

Here's a snippet of the explain block from a manifest I just ran:

explain:
  data-transferred:
    plugins:
      - network-energy-to-transfer-call-data
    unit: GB
    description: >-
      Data transferred over network, in GB. Estimated from values here
      https://tactiq.io/learn/zoom-data-usage-facts.
    aggregation-method:
      time: sum
      component: sum
  kwh-per-gb-network:
    plugins:
      - network-energy-to-transfer-call-data
    unit: kWh/GB
    description: >-
      Coefficient relating energy expendidture to 1GB of data transferred over
      network. Taken from Orbinger et al 2021
      (https://www.sciencedirect.com/science/article/abs/pii/S0921344920307072)
    aggregation-method:
      time: copy
      component: copy
  energy:
    plugins:
      - network-energy-to-transfer-call-data
      - energy-to-carbon
      - sum-energy-components
    unit: kWh
    description: >-
      Total Energy consumed by the server to handle zoom call, for the given
      timestep.
    aggregation-method:
      time: sum
      component: sum

and this is what it should look like after the proposed changes have been made:

explain:
  network-energy-to-transfer-call-data:
    inputs:
      data-transferred:
        unit: GB
        aggregation-method:
          time: sum
          component: sum
        description: >-
          Data transferred over network, in GB. Estimated from values here
          https://tactiq.io/learn/zoom-data-usage-facts.
      kwh-per-gb-network:
        unit: kWh/GB
        aggregation-method:
          time: copy
          component: copy
        description: >-
          Coefficient relating energy expendidture to 1GB of data transferred over
          network. Taken from Orbinger et al 2021
          (https://www.sciencedirect.com/science/article/abs/pii/S0921344920307072)
    outputs:
      energy:
        unit: kWh
        description: >-
          Total Energy consumed by the server to handle zoom call, for the given
          timestep.
        aggregation-method:
          time: sum
          component: sum

  next-plugin...

If two instances of the same parameter are seen with different units or aggregation methods then we should error out.

zanete commented 3 days ago

@jawache assuming this is one is for @narekhovhannisyan ?

jawache commented 3 days ago

@zanete yes, but let's make sure whatever format we come up with works for @osamajandali

zanete commented 2 days ago

@jmcook1186 please refine this with acceptance criteria so @narekhovhannisyan could work on this, and after that it will be easier for @osamajandali to adjust visualiser code

jmcook1186 commented 2 days ago

@narekhovhannisyan @zanete added detail to the ticket for the IF side of this.