<commit_before>require 'models/concerns/geometry_concern'

class Country < ActiveRecord::Base
  include GeometryConcern

  belongs_to :region
  has_one :country_statistic
  has_one :pame_statistic

  has_many :sub_locations
  has_many :protected_areas
  has_many :designations, -> { uniq }, through: :protected_areas

  def designations_per_jurisdiction
    designations.group_by { |designation|
      designation.jurisdiction.name rescue "Not Reported"<commit_msg>add api_attributes to country model<commit_after>require 'models/concerns/geometry_concern'
require 'models/concerns/api_object'

class Country < ActiveRecord::Base
  include GeometryConcern
  include ApiObject

  self.api_attributes = [
    :name, :iso_3, :geometry,
    :country_statistic, :pame_statistic,
    :region, :designations,
    :iucn_categories, :governances
  ]

  belongs_to :region
  has_one :country_statistic
  has_one :pame_statistic

  has_many :sub_locations
  has_many :protected_areas
  has_many :designations, -> { uniq }, through: :protected_areas

  def designations_per_jurisdiction
    designations.group_by { |designation|
      designation.jurisdiction.name rescue "Not Reported"
{'fraction_non_alphanumeric': 0.075809199318569, 'fraction_numerical': 0.0008517887563884157, 'mean_word_length': 5.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5785878', 'n_tokens_mistral': 391, 'n_tokens_neox': 372, 'n_words': 77}