<commit_before># load the defaults file in the seed directory
require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')

module CaTissue
  # Declares the classes modified for migration.
  shims TissueSpecimen, CollectionProtocolRegistration, StorageContainer 
  
  class StorageContainer
    # Creates the migrated box in the database, if necessary.
    #
    # @param (see CaRuby::Migratable#migrate)
    def migrate(row, migrated)
      super
      find or StorageContainer.create_galena_box
    end
    
    private

    # Creates a new box of type {Galena::Seed::Defaults#box_type} in a freezer of type
    # {Galena::Seed::Defaults#freezer_type}.
    # 
    # @return [StorageContainer] the new box
    def self.create_galena_box
      defs = Galena::Seed.defaults
      self.storage_type = defs.box_type
      site = defs.tissue_bank
      # A freezer with a slot for the box.
      frz = defs.freezer_type.find_available(site, :create)
      # Add this box to the first open slot in the first unfilled rack in the freezer.
      frz << self
    end
  end
end<commit_msg>Set the Galena box site and container type.<commit_after># load the defaults file in the seed directory
require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')

module CaTissue
  # Declares the classes modified for migration.
  shims TissueSpecimen, CollectionProtocolRegistration, StorageContainer 
  
  class StorageContainer
    # Creates the migrated box in the database, if necessary.
    #
    # @param (see CaRuby::Migratable#migrate)
    def migrate(row, migrated)
      super
      find or create_galena_box
    end
    
    private

    # Creates a new box of type {Galena::Seed::Defaults#box_type} in a freezer of type
    # {Galena::Seed::Defaults#freezer_type}.
    # 
    # @return [StorageContainer] the new box
    def create_galena_box
      defs = Galena::Seed.defaults
      # the box container type
      self.container_type = defs.box_type
      # the required box site
      self.site = defs.tissue_bank
      # A freezer with a slot for the box.
      frz = defs.freezer_type.find_available(site, :create)
      # Add the box to the first open slot in the first unfilled rack in the freezer.
      frz << self
      logger.debug { "Placed the tissue box #{self} in freezer #{frz}." }
      logger.debug { "Creating the tissue box #{self}..." }
      create
    end
  end
end
{'fraction_non_alphanumeric': 0.08138564273789649, 'fraction_numerical': 0.0, 'mean_word_length': 3.0353535353535355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '371836', 'n_tokens_mistral': 736, 'n_tokens_neox': 705, 'n_words': 242}