-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Analysis tables - jobs, items, scripts. Added seed data. Added …
…byte range implementation, but it is disbaled and needs work. modified: Gemfile modified: Gemfile.lock new file: app/assets/stylesheets/analysis_items.css.scss new file: app/assets/stylesheets/analysis_jobs.css.scss new file: app/assets/stylesheets/analysis_scripts.css.scss new file: app/controllers/analysis_items_controller.rb new file: app/controllers/analysis_jobs_controller.rb new file: app/controllers/analysis_scripts_controller.rb modified: app/controllers/api/callbacks_controller.rb modified: app/controllers/api/sessions_controller.rb modified: app/controllers/application_controller.rb modified: app/controllers/media_controller.rb new file: app/helpers/analysis_items_helper.rb new file: app/helpers/analysis_jobs_helper.rb new file: app/helpers/analysis_scripts_helper.rb new file: app/models/analysis_item.rb new file: app/models/analysis_job.rb new file: app/models/analysis_script.rb modified: app/models/user.rb new file: app/serializers/analysis_item_serializer.rb new file: app/serializers/analysis_job_serializer.rb new file: app/serializers/analysis_script_serializer.rb new file: app/views/analysis_items/_form.html.erb new file: app/views/analysis_items/edit.html.erb new file: app/views/analysis_items/index.html.erb new file: app/views/analysis_items/new.html.erb new file: app/views/analysis_items/show.html.erb new file: app/views/analysis_jobs/_form.html.erb new file: app/views/analysis_jobs/edit.html.erb new file: app/views/analysis_jobs/index.html.erb new file: app/views/analysis_jobs/new.html.erb new file: app/views/analysis_jobs/show.html.erb new file: app/views/analysis_scripts/_form.html.erb new file: app/views/analysis_scripts/edit.html.erb new file: app/views/analysis_scripts/index.html.erb new file: app/views/analysis_scripts/new.html.erb new file: app/views/analysis_scripts/show.html.erb modified: config/application.rb modified: config/initializers/custom_configs.rb modified: config/initializers/devise.rb modified: config/initializers/secret_token.rb modified: config/routes.rb modified: db/development_seeds.rb new file: db/migrate/20121211011323_create_analysis_jobs.rb new file: db/migrate/20121211013133_create_analysis_scripts.rb new file: db/migrate/20121211020323_create_analysis_items.rb modified: db/schema.rb modified: lib/external/analysis_runner.rb new file: lib/modules/byte_range.rb new file: test/fixtures/analysis_items.yml new file: test/fixtures/analysis_jobs.yml new file: test/fixtures/analysis_scripts.yml new file: test/functional/analysis_items_controller_test.rb new file: test/functional/analysis_jobs_controller_test.rb new file: test/functional/analysis_scripts_controller_test.rb new file: test/unit/analysis_item_test.rb new file: test/unit/analysis_job_test.rb new file: test/unit/analysis_script_test.rb new file: test/unit/helpers/analysis_items_helper_test.rb new file: test/unit/helpers/analysis_jobs_helper_test.rb new file: test/unit/helpers/analysis_scripts_helper_test.rb
- Loading branch information
Mark Cottman-Fields
committed
Dec 11, 2012
1 parent
9b63fc5
commit 28121b9
Showing
37 changed files
with
882 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the AnalysisItems controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the AnalysisJobs controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the AnalysisScripts controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class AnalysisItemsController < ApplicationController | ||
# GET /analysis_items | ||
# GET /analysis_items.json | ||
def index | ||
@analysis_items = AnalysisItem.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @analysis_items } | ||
end | ||
end | ||
|
||
# GET /analysis_items/1 | ||
# GET /analysis_items/1.json | ||
def show | ||
@analysis_item = AnalysisItem.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @analysis_item } | ||
end | ||
end | ||
|
||
# GET /analysis_items/new | ||
# GET /analysis_items/new.json | ||
def new | ||
@analysis_item = AnalysisItem.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @analysis_item } | ||
end | ||
end | ||
|
||
# GET /analysis_items/1/edit | ||
def edit | ||
@analysis_item = AnalysisItem.find(params[:id]) | ||
end | ||
|
||
# POST /analysis_items | ||
# POST /analysis_items.json | ||
def create | ||
@analysis_item = AnalysisItem.new(params[:analysis_item]) | ||
|
||
respond_to do |format| | ||
if @analysis_item.save | ||
format.html { redirect_to @analysis_item, notice: 'Analysis item was successfully created.' } | ||
format.json { render json: @analysis_item, status: :created, location: @analysis_item } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @analysis_item.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /analysis_items/1 | ||
# PUT /analysis_items/1.json | ||
def update | ||
@analysis_item = AnalysisItem.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @analysis_item.update_attributes(params[:analysis_item]) | ||
format.html { redirect_to @analysis_item, notice: 'Analysis item was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @analysis_item.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /analysis_items/1 | ||
# DELETE /analysis_items/1.json | ||
def destroy | ||
@analysis_item = AnalysisItem.find(params[:id]) | ||
@analysis_item.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to analysis_items_url } | ||
format.json { head :no_content } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class AnalysisJobsController < ApplicationController | ||
# GET /analysis_jobs | ||
# GET /analysis_jobs.json | ||
def index | ||
@analysis_jobs = AnalysisJob.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @analysis_jobs } | ||
end | ||
end | ||
|
||
# GET /analysis_jobs/1 | ||
# GET /analysis_jobs/1.json | ||
def show | ||
@analysis_job = AnalysisJob.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @analysis_job } | ||
end | ||
end | ||
|
||
# GET /analysis_jobs/new | ||
# GET /analysis_jobs/new.json | ||
def new | ||
@analysis_job = AnalysisJob.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @analysis_job } | ||
end | ||
end | ||
|
||
# GET /analysis_jobs/1/edit | ||
def edit | ||
@analysis_job = AnalysisJob.find(params[:id]) | ||
end | ||
|
||
# POST /analysis_jobs | ||
# POST /analysis_jobs.json | ||
def create | ||
@analysis_job = AnalysisJob.new(params[:analysis_job]) | ||
|
||
respond_to do |format| | ||
if @analysis_job.save | ||
format.html { redirect_to @analysis_job, notice: 'Analysis job was successfully created.' } | ||
format.json { render json: @analysis_job, status: :created, location: @analysis_job } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @analysis_job.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /analysis_jobs/1 | ||
# PUT /analysis_jobs/1.json | ||
def update | ||
@analysis_job = AnalysisJob.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @analysis_job.update_attributes(params[:analysis_job]) | ||
format.html { redirect_to @analysis_job, notice: 'Analysis job was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @analysis_job.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /analysis_jobs/1 | ||
# DELETE /analysis_jobs/1.json | ||
def destroy | ||
@analysis_job = AnalysisJob.find(params[:id]) | ||
@analysis_job.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to analysis_jobs_url } | ||
format.json { head :no_content } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class AnalysisScriptsController < ApplicationController | ||
# GET /analysis_scripts | ||
# GET /analysis_scripts.json | ||
def index | ||
@analysis_scripts = AnalysisScript.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @analysis_scripts } | ||
end | ||
end | ||
|
||
# GET /analysis_scripts/1 | ||
# GET /analysis_scripts/1.json | ||
def show | ||
@analysis_script = AnalysisScript.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @analysis_script } | ||
end | ||
end | ||
|
||
# GET /analysis_scripts/new | ||
# GET /analysis_scripts/new.json | ||
def new | ||
@analysis_script = AnalysisScript.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @analysis_script } | ||
end | ||
end | ||
|
||
# GET /analysis_scripts/1/edit | ||
def edit | ||
@analysis_script = AnalysisScript.find(params[:id]) | ||
end | ||
|
||
# POST /analysis_scripts | ||
# POST /analysis_scripts.json | ||
def create | ||
@analysis_script = AnalysisScript.new(params[:analysis_script]) | ||
|
||
respond_to do |format| | ||
if @analysis_script.save | ||
format.html { redirect_to @analysis_script, notice: 'Analysis script was successfully created.' } | ||
format.json { render json: @analysis_script, status: :created, location: @analysis_script } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @analysis_script.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /analysis_scripts/1 | ||
# PUT /analysis_scripts/1.json | ||
def update | ||
@analysis_script = AnalysisScript.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @analysis_script.update_attributes(params[:analysis_script]) | ||
format.html { redirect_to @analysis_script, notice: 'Analysis script was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @analysis_script.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /analysis_scripts/1 | ||
# DELETE /analysis_scripts/1.json | ||
def destroy | ||
@analysis_script = AnalysisScript.find(params[:id]) | ||
@analysis_script.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to analysis_scripts_url } | ||
format.json { head :no_content } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AnalysisItemsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AnalysisJobsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AnalysisScriptsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class AnalysisItem < ActiveRecord::Base | ||
# relations | ||
belongs_to :audio_recording | ||
belongs_to :analysis_job | ||
|
||
# attr | ||
attr_accessible :offset_end_seconds, :offset_start_seconds, :status, :worker_info, :worker_run_details, :worker_started_utc | ||
|
||
accepts_nested_attributes_for :analysis_job, :audio_recording | ||
|
||
# validations | ||
validates :offset_start_seconds, :presence => true, :numericality => true | ||
validates :offset_end_seconds, :presence => true, :numericality => true | ||
validates :audio_recording_id, :presence => true | ||
# documentation for timeliness: https://github.com/adzap/validates_timeliness | ||
validates :worker_started_utc, :timeliness => { :type => :datetime, :allow_blank => true } | ||
validates :status, :inclusion => { :in => [:ready, :running, :complete, :error] } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class AnalysisJob < ActiveRecord::Base | ||
# flex store | ||
store :notes | ||
|
||
# relations | ||
belongs_to :saved_search | ||
|
||
# attr | ||
attr_accessible :data_set_identifier, :description, :name, :notes, | ||
:script_description, :script_display_name, :script_extra_data, :script_name, | ||
:script_settings, :script_version, | ||
:process_new | ||
|
||
accepts_nested_attributes_for :saved_search | ||
|
||
# userstamp | ||
stampable | ||
belongs_to :user, :class_name => 'User', :foreign_key => :creator_id | ||
|
||
# validations | ||
validates :name, :presence => true, :length => { :minimum => 2, :maximum => 100 }, :uniqueness => { :case_sensitive => false } | ||
validates :script_name, :presence => true | ||
validates :script_settings, :presence => true | ||
validates :script_version, :presence => true | ||
validates :script_display_name, :presence => true | ||
validates :process_new, :inclusion => { :in => [true, false] } | ||
validate :data_set_cannot_process_new | ||
|
||
# custom validation methods | ||
def data_set_cannot_process_new | ||
errors.add(:level, "An analysis job that references a data set cannot process new recordings.") if self.data_set_identifier && self.process_new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class AnalysisScript < ActiveRecord::Base | ||
# flex store | ||
store :notes | ||
|
||
# attr | ||
attr_accessible :description, :display_name, :extra_data, :name, :settings, :version, :notes, :verified | ||
|
||
# userstamp | ||
stampable | ||
belongs_to :user, :class_name => 'User', :foreign_key => :creator_id | ||
acts_as_paranoid | ||
validates_as_paranoid | ||
|
||
# validations | ||
validates :name, :presence => true, :length => { :minimum => 2, :maximum => 100 }, :uniqueness => { :case_sensitive => false } | ||
validates :display_name, :presence => true | ||
validates :settings, :presence => true | ||
validates :version, :presence => true | ||
validates :display_name, :presence => true | ||
validates :verified, :inclusion => { :in => [true, false] } | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.