<commit_before># The Record model is an extension of Record as defined by HealthDataStandards.

class Record
  include Mongoid::Document
  # field :bundle_id
  field :measures, type: Hash
  index test_id: 1
  index bundle_id: 1

  def calcuation_results
    HealthDataStandards::CQM::PatientCache.where('value.patient_id' => id)
                                          .order_by(['value.last', :asc])
  end

  def destroy
    calcuation_results.destroy
    delete
  end

  def product_test
    ProductTest.where('_id' => test_id).first
  end

  def bundle
    if !self['bundle_id'].nil?
      HealthDataStandards::CQM::Bundle.find(self['bundle_id'])
    elsif !self['test_id'].nil?
      ProductTest.find(self['test_id']).bundle
    end
  end

  def age_at(date)
    dob = Time.at(birthdate).in_time_zone
    date.year - dob.year - ((date.month > dob.month || (date.month == dob.month && date.day >= dob.day)) ? 0 : 1)
  end<commit_msg>Remove incorrectly spelled and redundant calcuation_results function<commit_after># The Record model is an extension of Record as defined by HealthDataStandards.

class Record
  include Mongoid::Document
  # field :bundle_id
  field :measures, type: Hash
  index test_id: 1
  index bundle_id: 1

  def destroy
    calculation_results.destroy
    delete
  end

  def product_test
    ProductTest.where('_id' => test_id).first
  end

  def bundle
    if !self['bundle_id'].nil?
      HealthDataStandards::CQM::Bundle.find(self['bundle_id'])
    elsif !self['test_id'].nil?
      ProductTest.find(self['test_id']).bundle
    end
  end

  def age_at(date)
    dob = Time.at(birthdate).in_time_zone
    date.year - dob.year - ((date.month > dob.month || (date.month == dob.month && date.day >= dob.day)) ? 0 : 1)
  end
{'fraction_non_alphanumeric': 0.11536264991433466, 'fraction_numerical': 0.004568817818389492, 'mean_word_length': 3.2524271844660193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5065483', 'n_tokens_mistral': 600, 'n_tokens_neox': 571, 'n_words': 140}