<commit_before>class init-labs.rb < ActiveRecord::Migration
  def self.up
#
# This migration adds the laborator and test results capability to the
# UT-NEDSS database for the CMR in Release 1 Iteration 1. Disease plans
# and LIMS integration will add additional tables and columns to flesh out
# the data model.
#
    create_table  :laboratories do |t|
      t.integer	  :entity_id
      t.string	  :laboratory_name, :limit => 50

      t.timestamps
    end

  execute "ALTER TABLE laboratories
		ADD CONSTRAINT  fk_EntityId 
		FOREIGN KEY (entity_id) 
		REFERENCES entities(id)"
	    

    create_table :lab_results do |t|
      t.integer    :specimen_source_id
      t.timestamp  :collection_date
      t.timestamp  :lab_test_date
      t.string	   :tested_at_UPHL,  :limit => 1
      t.string	   :lab_result_text, :limit => 20
    end

  execute "ALTER TABLE lab_results
		ADD CONSTRAINT  fk_SpecimenSourceId 
		FOREIGN KEY (specimen_source_id) 
		REFERENCES codes(id)"
	
  def self.down
      drop_table :laboratories
      drop_table :lab_results
  end
end<commit_msg>Associates lab_results as an event.<commit_after>class init-labs.rb < ActiveRecord::Migration
  def self.up
#
# This migration adds the laborator and test results capability to the
# UT-NEDSS database for the CMR in Release 1 Iteration 1. Disease plans
# and LIMS integration will add additional tables and columns to flesh out
# the data model.
#
    create_table  :laboratories do |t|
      t.integer	  :entity_id
      t.string	  :laboratory_name, :limit => 50

      t.timestamps
    end

  execute "ALTER TABLE laboratories
		ADD CONSTRAINT  fk_EntityId 
		FOREIGN KEY (entity_id) 
		REFERENCES entities(id)"
	    

    create_table :lab_results do |t|
      t.integer    :event_id
      t.integer    :specimen_source_id
      t.timestamp  :collection_date
      t.timestamp  :lab_test_date
      t.string	   :tested_at_UPHL,  :limit => 1
      t.string	   :lab_result_text, :limit => 20
    end

  execute "ALTER TABLE lab_results
		ADD CONSTRAINT  fk_EventId 
		FOREIGN KEY (event_id) 
		REFERENCES event(id)"
	
  execute "ALTER TABLE lab_results
		ADD CONSTRAINT  fk_SpecimenSourceId 
		FOREIGN KEY (specimen_source_id) 
		REFERENCES codes(id)"
	
  def self.down
      drop_table :laboratories
      drop_table :lab_results
  end
end
{'fraction_non_alphanumeric': 0.060933448573898014, 'fraction_numerical': 0.006050129645635264, 'mean_word_length': 3.0685413005272406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7549088', 'n_tokens_mistral': 826, 'n_tokens_neox': 755, 'n_words': 229}