summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-05-10 12:27:42 +0200
committermguetlein <martin.guetlein@gmail.com>2011-05-10 12:27:42 +0200
commitb012dc2c3299a829e9fa1bc45b5134c90db451d0 (patch)
treeb48a2aadcba3eda7467e12a204c7cefe7c4126e3
parent4951f2181a7f2c9c6e04431ff244a6a528dc245a (diff)
set date when creating validations/crossvalidtions/reports
-rwxr-xr-xlib/validation_db.rb24
-rwxr-xr-xreport/report_persistance.rb17
2 files changed, 21 insertions, 20 deletions
diff --git a/lib/validation_db.rb b/lib/validation_db.rb
index 0beb73d..e2595c5 100755
--- a/lib/validation_db.rb
+++ b/lib/validation_db.rb
@@ -58,7 +58,7 @@ module Validation
attribute :test_dataset_uri
attribute :prediction_dataset_uri
attribute :prediction_feature
- attribute :created_at
+ attribute :date
attribute :num_instances
attribute :num_without_class
attribute :num_unpredicted
@@ -77,6 +77,11 @@ module Validation
attr_accessor :subjectid
+ def self.create(params={})
+ params[:date] = Time.new
+ super params
+ end
+
def classification_statistics
YAML.load(self.classification_statistics_yaml) if self.classification_statistics_yaml
end
@@ -99,10 +104,6 @@ module Validation
end
public
- def date
- created_at
- end
-
def validation_uri
raise "no id" if self.id==nil
$url_provider.url_for("/"+self.id.to_s, :full)
@@ -130,7 +131,7 @@ module Validation
attribute :algorithm_uri
attribute :dataset_uri
- attribute :created_at
+ attribute :date
attribute :num_folds
attribute :random_seed
attribute :finished
@@ -144,17 +145,18 @@ module Validation
index :random_seed
index :stratified
index :finished
-
+
+ def self.create(params={})
+ params[:date] = Time.new
+ super params
+ end
+
def save
super
OpenTox::Authorization.check_policy(crossvalidation_uri, subjectid)
end
public
- def date
- created_at
- end
-
def crossvalidation_uri
raise "no id" if self.id==nil
$url_provider.url_for("/crossvalidation/"+self.id.to_s, :full) if self.id
diff --git a/report/report_persistance.rb b/report/report_persistance.rb
index 113c81b..c85ad68 100755
--- a/report/report_persistance.rb
+++ b/report/report_persistance.rb
@@ -191,7 +191,7 @@ module Reports
class ReportData < Ohm::Model
attribute :report_type
- attribute :created_at
+ attribute :date
attribute :validation_uris
attribute :crossvalidation_uris
attribute :model_uris
@@ -203,16 +203,16 @@ module Reports
attr_accessor :subjectid
+ def self.create(params={})
+ params[:date] = Time.new
+ super params
+ end
+
def save
super
OpenTox::Authorization.check_policy(report_uri, subjectid)
end
- public
- def date
- created_at
- end
-
def report_uri
raise "no id" if self.id==nil
Reports::ReportService.instance.get_uri(self.report_type, self.id)
@@ -242,10 +242,9 @@ module Reports
def new_report(report_content, type, meta_data, uri_provider, subjectid=nil)
raise "report meta data missing" unless meta_data
- report = ReportData.new(meta_data)
+ meta_data[:report_type] = type
+ report = ReportData.create(meta_data)
report.subjectid = subjectid
- report.report_type = type
- report.save
OpenTox::Authorization.check_policy(report.report_uri, subjectid)
new_report_with_id(report_content, type, report.id)
end