<commit_before>class Person
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Versioning
  include Mongoid::Paranoia

  extend Mongorder

  attr_accessor :relationship

  field :name_pfx, type: String, default: ""
  field :name_first, type: String
  field :name_middle, type: String, default: ""
  field :name_last, type: String
  field :name_sfx, type: String, default: ""
  field :name_full, type: String
  field :updated_by, type: String, default: "system_service"

  field :authority_member_id, type: String, default: nil
  index({"authority_member_id" => 1})

  before_create :initialize_authority_member
  before_save :initialize_name_full
  before_save :invalidate_find_caches

  validates_presence_of :name_first, :name_last
  index({name_last:  1})
  index({name_first: 1})

  belongs_to :broker
  belongs_to :employer
  belongs_to :application_group
  belongs_to :household

  embeds_many :addresses, :inverse_of => :person
  accepts_nested_attributes_for :addresses, reject_if: proc { |attribs| attribs['address_1'].blank? }, allow_destroy: true

  embeds_many :phones, :inverse_of => :person
  accepts_nested_attributes_for :phones, reject_if: proc { |attribs| attribs['phone_number'].blank? }, allow_destroy: true

  embeds_many :emails, :inverse_of => :person
  accepts_nested_attributes_for :emails, reject_if: proc { |attribs| attribs['email_address'].blank? }, allow_destroy: true

  # embeds_many :members, after_add: :generate_hbx_member_id
  embeds_many :members, cascade_callbacks: true

  index({"members.hbx_member_id" =>1})
  index({"members.ssn" => 1})
  index({"members.dob" => 1})
  accepts_nested_attributes_for :members, reject_if: :all_blank, allow_destroy: true

  embeds_many :responsible_parties
#  accepts_nested_attributes_for :responsible_parties, reject_if: :all_blank, allow_destroy: true

  scope :all_under_age_twenty_six, ->{ gt(:'members.dob' => (Date.today - 26.years))}
  scope :all_over_age_twenty_six,  ->{lte(:'members.dob' => (Date.today - 26.years))}<commit_msg>Add embedded income<commit_after>class Person
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Versioning
  include Mongoid::Paranoia

  extend Mongorder

  attr_accessor :relationship

  field :name_pfx, type: String, default: ""
  field :name_first, type: String
  field :name_middle, type: String, default: ""
  field :name_last, type: String
  field :name_sfx, type: String, default: ""
  field :name_full, type: String
  field :updated_by, type: String, default: "system_service"

  field :authority_member_id, type: String, default: nil
  index({"authority_member_id" => 1})

  before_create :initialize_authority_member
  before_save :initialize_name_full
  before_save :invalidate_find_caches

  validates_presence_of :name_first, :name_last
  index({name_last:  1})
  index({name_first: 1})

  belongs_to :broker
  belongs_to :employer
  belongs_to :application_group
  belongs_to :household

  embeds_many :addresses, :inverse_of => :person
  accepts_nested_attributes_for :addresses, reject_if: proc { |attribs| attribs['address_1'].blank? }, allow_destroy: true

  embeds_many :phones, :inverse_of => :person
  accepts_nested_attributes_for :phones, reject_if: proc { |attribs| attribs['phone_number'].blank? }, allow_destroy: true

  embeds_many :emails, :inverse_of => :person
  accepts_nested_attributes_for :emails, reject_if: proc { |attribs| attribs['email_address'].blank? }, allow_destroy: true

  # embeds_many :members, after_add: :generate_hbx_member_id
  embeds_many :members, cascade_callbacks: true

  embeds_many :incomes, :inverse_of => :person
  accepts_nested_attributes_for :incomes, allow_destroy: true

  index({"members.hbx_member_id" =>1})
  index({"members.ssn" => 1})
  index({"members.dob" => 1})
  accepts_nested_attributes_for :members, reject_if: :all_blank, allow_destroy: true

  embeds_many :responsible_parties
#  accepts_nested_attributes_for :responsible_parties, reject_if: :all_blank, allow_destroy: true

  scope :all_under_age_twenty_six, ->{ gt(:'members.dob' => (Date.today - 26.years))}
  scope :all_over_age_twenty_six,  ->{lte(:'members.dob' => (Date.today - 26.years))}
{'fraction_non_alphanumeric': 0.11283396946564886, 'fraction_numerical': 0.005248091603053435, 'mean_word_length': 6.167521367521368, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '2183415', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1431, 'n_words': 309}