<commit_before>=begin

Copyright 2012 Shared Learning Collaborative, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=end

require_relative "../data_utility.rb"
require_relative "baseEntity.rb"
require_relative "enum/EducationalEnvironmentType.rb"
require_relative "enum/MediumOfInstructionType.rb"
require_relative "enum/PopulationServedType.rb"

# creates section
class Section < BaseEntity

  attr_accessor :school_id

  def initialize(id, sequence, environment, medium, population, school_id, course_offering, session, program = nil)
    @id                                      = id
    @sequence                                = sequence
    @environment                             = environment
    @medium                                  = medium
    @population                              = population
    @school_id                               = school_id
    @course_offering                         = Hash.new
    @course_offering["code"]                 = course_offering[""] # probably need to use DataUtility.create_course_offering_id()
    @course_offering["ed_org_id"]            = course_offering[""]
    @course_offering["session"]              = Hash.new
    @course_offering["session"]["name"]      = course_offering["session"]["name"]
    @course_offering["session"]["ed_org_id"] = course_offering["session"]["ed_org_id"]
    @session                                 = Hash.new
    @session["name"]                         = session["name"]
    @session["ed_org_id"]                    = session["ed_org_id"]
    #@program              = program
    # --> programs are not currently implemented
  end

  def unique_section_code
    DataUtility.get_unique_section_id(@id)
  end 

  def sequence
    @sequence
  end

  def environment
    EducationalEnvironmentType.to_string(@environment)
  end

  def medium 
    MediumOfInstructionType.to_string(@medium)
  end

  def population
    PopulationServedType.to_string(@population)
  end

  def course_offering
    @course_offering
  end

  def session
    @session
  end

  def program
    @program
  end
end<commit_msg>simplify section<commit_after>=begin

Copyright 2012 Shared Learning Collaborative, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=end

require_relative "../data_utility.rb"
require_relative "baseEntity.rb"
require_relative "enum/EducationalEnvironmentType.rb"
require_relative "enum/MediumOfInstructionType.rb"
require_relative "enum/PopulationServedType.rb"

# creates section
class Section < BaseEntity

  attr_accessor :school_id, :id, :unique_section_code, :sequence, :environment, 
    :medium, :population, :course_offering, :session

  def initialize(id, school_id, offering, session = offering['session'], program = nil)
    @id = id
    @rand = Random.new(id)
    # move these to choices.yml eventually and have these be a weighted choice
    @sequence = 1  
    @environment = "Classroom"
    @medium = "Face-to-face instruction"
    @population = "Regular Students"
    @school_id = school_id
    @course_offering = {code: DataUtility.get_course_offering_code(offering["id"]),
                        ed_org_id: offering['ed_org_id'],
                        session: offering['session']}
    @session = offering['session']
    @unique_section_code = DataUtility.get_unique_section_id(@id)
    #@program              = program
    # --> programs are not currently implemented
  end
end
{'fraction_non_alphanumeric': 0.08022988505747126, 'fraction_numerical': 0.003908045977011494, 'mean_word_length': 2.9626593806921675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2132533', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1143, 'n_words': 357}