<commit_before># NTD Report
# Modify an existing blank template

class NtdReport

  TEMPLATE_PATH = "#{Rails.root}/public/ntd_template.xlsx"
  
  attr_reader :workbook

  def initialize(provider, year, month)
    @provider = provider
    @year = year
    @month = month
    @start_date = Date.new(year, 1, 1)
    @end_date = Date.new(year, month, 1).at_end_of_month + 1.day
  end

  def export!
    @workbook = RubyXL::Parser.parse(TEMPLATE_PATH)
    @worksheet = @workbook[0] #first worksheet

    get_base_data

    process_periods_of_service
    process_year_month_headers
    process_operations
    process_miles_and_hours

    @workbook
  end<commit_msg>Recalulate formulas in exported excel<commit_after># NTD Report
# Modify an existing blank template

class NtdReport

  TEMPLATE_PATH = "#{Rails.root}/public/ntd_template.xlsx"
  
  attr_reader :workbook

  def initialize(provider, year, month)
    @provider = provider
    @year = year
    @month = month
    @start_date = Date.new(year, 1, 1)
    @end_date = Date.new(year, month, 1).at_end_of_month + 1.day
  end

  def export!
    @workbook = RubyXL::Parser.parse(TEMPLATE_PATH)
    @worksheet = @workbook[0] #first worksheet

    get_base_data

    process_periods_of_service
    process_year_month_headers
    process_operations
    process_miles_and_hours
    
    @workbook.calc_pr.full_calc_on_load = true
    @workbook
  end
{'fraction_non_alphanumeric': 0.08614501076812635, 'fraction_numerical': 0.007178750897343862, 'mean_word_length': 3.6466666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '742505', 'n_tokens_mistral': 512, 'n_tokens_neox': 483, 'n_words': 103}