<commit_before>module Api
  module V3
    # This module defines which attributes and methods should be shown in the
    # converter detail popup. The API converter detail requests shows this stuff
    #
    module ConverterPresenterData
      FORMAT_KILO = ->(n) { (n / 1000).to_i }
      FORMAT_1DP  = ->(n) { '%.1f' % n }

      # If the converter belongs to the :cost_electricity_production group then
      # add these
      ELECTRICITY_PRODUCTION_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :electricity_output_capacity =>
            { label: 'Electrical capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :electricity_output_conversion  =>
            { label: 'Electrical efficiency', unit: '%',
              formatter: FORMAT_1DP },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            { label: 'Heat efficiency', unit: '%',
              formatter: FORMAT_1DP }
        },
        :cost => {
          'initial_investment_per(:mw_electricity)' =>
            { label: 'Initial investment (excl CCS)', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'ccs_investment_per(:mw_electricity)' =>
            { label: 'Additional inititial investment for CCS', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'decommissioning_costs_per(:mw_electricity)' =>
            { label: 'Decommissioning costs', unit:'kEUR / MWe',
              formatter: FORMAT_KILO },
          'fixed_operation_and_maintenance_costs_per(:mw_electricity)' =>
            { label: 'Fixed operation and maintenance costs', unit:'kEUR / MWe / year',
              formatter: ->(n) { '%.2f' % (n / 1000) } },
          :variable_operation_and_maintenance_costs_per_full_load_hour  =>
            { label: 'Variable operation and maintenance costs (excl CCS)', unit: 'EUR / full load hour',
              formatter: ->(n) { n.to_i } },
          :variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour  =>
            { label: 'Additional variable operation and maintenance costs for CCS', unit: 'EUR / full load hour',
              formatter: ->(n) { n.to_i } },
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :construction_time  =>
            { label: 'Construction time', unit: 'years',
              formatter: FORMAT_1DP },
          :technical_lifetime  =>
            { label: 'Technical lifetime', unit: 'years',
              formatter: ->(n) { n.to_i } }
        }
      }

      # If the converter belongs to the :cost_traditional_heat group then
      # add these
      HEAT_PRODUCTION_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :heat_output_capacity =>
            { label: 'Heat capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            {label: 'Heat efficiency', unit: '%'}
        },
        :cost => {
          'initial_investment_per(:plant)' =>
            {label: 'Initial purchase price', unit: 'EUR'},
          'cost_of_installing_per(:plant)' =>
            {label: 'Cost of installing', unit:'EUR'},
          'decommissioning_costs_per(:plant)' =>
            {label: 'Decommissioning costs', unit:'EUR'},
          'fixed_operation_and_maintenance_costs_per(:plant)' =>
            {label: 'Fixed operation and maintenance costs', unit:'EUR / year'},
          'variable_operation_and_maintenance_costs_per(:full_load_hour)'  =>
            {label: 'Variable operation and maintenance costs', unit: 'EUR / full load hour'},
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :technical_lifetime  =>
            {label: 'Technical lifetime', unit: 'years'}
        }
      }

      # If the converter belongs to the :cost_heat_pumps group then
      # add these
      HEAT_PUMP_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :heat_output_capacity =>
            {label: 'Heat capacity', unit:'MW'},
          :coefficient_of_performance =>
            {label: 'Coefficient of Performance',  unit:''},
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_and_cold_output_conversion  =>
            {label: 'Efficiency (after COP)', unit: '%'}
        },
        :cost => {
          'initial_investment_per(:plant)' =>
            {label: 'Initial purchase price', unit: 'EUR'},
          'cost_of_installing_per(:plant)' =>
            {label: 'Cost of installing', unit:'EUR'},
          'decommissioning_costs_per(:plant)' =>
            {label: 'Decommissioning costs', unit:'EUR'},
          'fixed_operation_and_maintenance_costs_per(:plant)' =>
            {label: 'Fixed operation and maintenance costs', unit:'EUR / year'},
          'variable_operation_and_maintenance_costs_per(:full_load_hour)'  =>
            {label: 'Variable operation and maintenance costs', unit: 'EUR / full load hour'},
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :technical_lifetime  =>
            {label: 'Technical lifetime', unit: 'years'}
        }
      }

      # If the converter belongs to the :cost_chps group then
      # add these
      CHP_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :electricity_output_capacity =>
            { label: 'Electrical capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :electricity_output_conversion  =>
            { label: 'Electrical efficiency', unit: '%',
              formatter: FORMAT_1DP },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            { label: 'Heat efficiency', unit: '%',
              formatter: FORMAT_1DP }
        },
        :cost => {
          'initial_investment_per(:mw_electricity)' =>
            { label: 'Initial investment (excl CCS)', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'ccs_investment_per(:mw_electricity)' =>
            { label: 'Additional inititial investment for CCS', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'decommissioning_costs_per(:mw_electricity)' =>
            { label: 'Decommissioning costs', unit:'kEUR / MWe',
              formatter: FORMAT_KILO },
          'fixed_operation_and_maintenance_costs_per(:mw_electricity)' =>
            { label: 'Fixed operation and maintenance costs', unit:'kEUR / MWe / year',<commit_msg>Fix formatting of percentages in converter data<commit_after>module Api
  module V3
    # This module defines which attributes and methods should be shown in the
    # converter detail popup. The API converter detail requests shows this stuff
    #
    module ConverterPresenterData
      FORMAT_KILO           = ->(n) { (n / 1000).to_i }
      FORMAT_1DP            = ->(n) { '%.1f' % n }
      FORMAT_FAC_TO_PERCENT = ->(n) { FORMAT_1DP.call(n * 100) }

      # If the converter belongs to the :cost_electricity_production group then
      # add these
      ELECTRICITY_PRODUCTION_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :electricity_output_capacity =>
            { label: 'Electrical capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :electricity_output_conversion  =>
            { label: 'Electrical efficiency', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            { label: 'Heat efficiency', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT }
        },
        :cost => {
          'initial_investment_per(:mw_electricity)' =>
            { label: 'Initial investment (excl CCS)', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'ccs_investment_per(:mw_electricity)' =>
            { label: 'Additional inititial investment for CCS', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'decommissioning_costs_per(:mw_electricity)' =>
            { label: 'Decommissioning costs', unit:'kEUR / MWe',
              formatter: FORMAT_KILO },
          'fixed_operation_and_maintenance_costs_per(:mw_electricity)' =>
            { label: 'Fixed operation and maintenance costs', unit:'kEUR / MWe / year',
              formatter: ->(n) { '%.2f' % (n / 1000) } },
          :variable_operation_and_maintenance_costs_per_full_load_hour  =>
            { label: 'Variable operation and maintenance costs (excl CCS)', unit: 'EUR / full load hour',
              formatter: ->(n) { n.to_i } },
          :variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour  =>
            { label: 'Additional variable operation and maintenance costs for CCS', unit: 'EUR / full load hour',
              formatter: ->(n) { n.to_i } },
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :construction_time  =>
            { label: 'Construction time', unit: 'years',
              formatter: FORMAT_1DP },
          :technical_lifetime  =>
            { label: 'Technical lifetime', unit: 'years',
              formatter: ->(n) { n.to_i } }
        }
      }

      # If the converter belongs to the :cost_traditional_heat group then
      # add these
      HEAT_PRODUCTION_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :heat_output_capacity =>
            { label: 'Heat capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            { label: 'Heat efficiency', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT }
        },
        :cost => {
          'initial_investment_per(:plant)' =>
            {label: 'Initial purchase price', unit: 'EUR'},
          'cost_of_installing_per(:plant)' =>
            {label: 'Cost of installing', unit:'EUR'},
          'decommissioning_costs_per(:plant)' =>
            {label: 'Decommissioning costs', unit:'EUR'},
          'fixed_operation_and_maintenance_costs_per(:plant)' =>
            {label: 'Fixed operation and maintenance costs', unit:'EUR / year'},
          'variable_operation_and_maintenance_costs_per(:full_load_hour)'  =>
            {label: 'Variable operation and maintenance costs', unit: 'EUR / full load hour'},
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :technical_lifetime  =>
            {label: 'Technical lifetime', unit: 'years'}
        }
      }

      # If the converter belongs to the :cost_heat_pumps group then
      # add these
      HEAT_PUMP_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :heat_output_capacity =>
            {label: 'Heat capacity', unit:'MW'},
          :coefficient_of_performance =>
            {label: 'Coefficient of Performance',  unit:''},
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_and_cold_output_conversion  =>
            { label: 'Efficiency (after COP)', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT }
        },
        :cost => {
          'initial_investment_per(:plant)' =>
            {label: 'Initial purchase price', unit: 'EUR'},
          'cost_of_installing_per(:plant)' =>
            {label: 'Cost of installing', unit:'EUR'},
          'decommissioning_costs_per(:plant)' =>
            {label: 'Decommissioning costs', unit:'EUR'},
          'fixed_operation_and_maintenance_costs_per(:plant)' =>
            {label: 'Fixed operation and maintenance costs', unit:'EUR / year'},
          'variable_operation_and_maintenance_costs_per(:full_load_hour)'  =>
            {label: 'Variable operation and maintenance costs', unit: 'EUR / full load hour'},
          :wacc  =>
            {label: 'Weighted average cost of capital', unit: '%'},
          :takes_part_in_ets  =>
            {label: 'Do emissions have to be paid through the ETS?', unit: 'yes / no', formatter: lambda{|x| x == 1 ? 'yes' : 'no'}}
        },
        :other => {
          :land_use_per_unit  =>
            {label: 'Land use per unit', unit: 'km2'},
          :technical_lifetime  =>
            {label: 'Technical lifetime', unit: 'years'}
        }
      }

      # If the converter belongs to the :cost_chps group then
      # add these
      CHP_ATTRIBUTES_AND_METHODS = {
        :technical => {
          :electricity_output_capacity =>
            { label: 'Electrical capacity', unit:'MW',
              formatter: FORMAT_1DP },
          :electricity_output_conversion  =>
            { label: 'Electrical efficiency', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT },
          :full_load_hours  =>
            {label: 'Full load hours', unit: 'hour / year'},
          :heat_output_conversion  =>
            { label: 'Heat efficiency', unit: '%',
              formatter: FORMAT_FAC_TO_PERCENT }
        },
        :cost => {
          'initial_investment_per(:mw_electricity)' =>
            { label: 'Initial investment (excl CCS)', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'ccs_investment_per(:mw_electricity)' =>
            { label: 'Additional inititial investment for CCS', unit: 'kEUR / MWe',
              formatter: FORMAT_KILO },
          'decommissioning_costs_per(:mw_electricity)' =>
            { label: 'Decommissioning costs', unit:'kEUR / MWe',
              formatter: FORMAT_KILO },
          'fixed_operation_and_maintenance_costs_per(:mw_electricity)' =>
            { label: 'Fixed operation and maintenance costs', unit:'kEUR / MWe / year',
{'fraction_non_alphanumeric': 0.12574302697759487, 'fraction_numerical': 0.0033966947547194462, 'mean_word_length': 2.1379381020700965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '665469', 'n_tokens_mistral': 4724, 'n_tokens_neox': 4454, 'n_words': 1085}