<commit_before>#------------------------------------------------------------------------------
#
# Fta Agency
#
# Represents a TransitAgency that reports to FTA and must track
# NTD reporting characteristics
#
#------------------------------------------------------------------------------
class FtaAgency < TransitAgency

  #------------------------------------------------------------------------------
  # Callbacks
  #------------------------------------------------------------------------------
  after_initialize :set_defaults

  #------------------------------------------------------------------------------
  # Associations
  #------------------------------------------------------------------------------

  # must have a single FTA agency type
  belongs_to                :fta_agency_type

  # must have a single service area type
  belongs_to                :fta_service_area_type

  # Every transit agency has one or more fta mode types
  has_and_belongs_to_many   :fta_mode_types, :foreign_key => 'organization_id'

  # every transit agency services a set of geographies
  has_and_belongs_to_many   :districts,      :foreign_key => 'organization_id', :join_table => 'organizations_districts'

  #------------------------------------------------------------------------------
  # Validations
  #------------------------------------------------------------------------------
  validates               :fta_agency_type_id,        :presence => :true
  validates               :fta_service_area_type_id,  :presence => :true
  #validates              :subrecipient_number,       :presence => :true
  validates_format_of     :ntd_id_number,             :allow_nil => true,   :with => /\A\d{4}\z/<commit_msg>[fixes#98230110] allow ntd id num to be blank<commit_after>#------------------------------------------------------------------------------
#
# Fta Agency
#
# Represents a TransitAgency that reports to FTA and must track
# NTD reporting characteristics
#
#------------------------------------------------------------------------------
class FtaAgency < TransitAgency

  #------------------------------------------------------------------------------
  # Callbacks
  #------------------------------------------------------------------------------
  after_initialize :set_defaults

  #------------------------------------------------------------------------------
  # Associations
  #------------------------------------------------------------------------------

  # must have a single FTA agency type
  belongs_to                :fta_agency_type

  # must have a single service area type
  belongs_to                :fta_service_area_type

  # Every transit agency has one or more fta mode types
  has_and_belongs_to_many   :fta_mode_types, :foreign_key => 'organization_id'

  # every transit agency services a set of geographies
  has_and_belongs_to_many   :districts,      :foreign_key => 'organization_id', :join_table => 'organizations_districts'

  #------------------------------------------------------------------------------
  # Validations
  #------------------------------------------------------------------------------
  validates               :fta_agency_type_id,        :presence => :true
  validates               :fta_service_area_type_id,  :presence => :true
  #validates              :subrecipient_number,       :presence => :true
  validates_format_of     :ntd_id_number,             :allow_nil => true, :allow_blank => true, :with => /\A\d{4}\z/
{'fraction_non_alphanumeric': 0.4080987937966686, 'fraction_numerical': 0.002871912693854107, 'mean_word_length': 0.9084931506849315, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '2065077', 'n_tokens_mistral': 779, 'n_tokens_neox': 733, 'n_words': 184}