summaryrefslogtreecommitdiff
path: root/helper.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-06-25 20:14:51 +0200
committerChristoph Helma <helma@in-silico.ch>2010-06-25 20:14:51 +0200
commitd8aa6f493d2e74678c7268cc0d7f2ab6ce7ac6de (patch)
tree1d8b371be6b3461ecc2f7803e58a5536fb983d65 /helper.rb
parent160cf6bf6fd21759e665a37002ad5d8504bb36bf (diff)
regression initially working
Diffstat (limited to 'helper.rb')
-rw-r--r--helper.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/helper.rb b/helper.rb
new file mode 100644
index 0000000..e4f91e5
--- /dev/null
+++ b/helper.rb
@@ -0,0 +1,36 @@
+helpers do
+ def activity(a)
+ case a.to_s
+ when "true"
+ act = "active"
+ when "false"
+ act = "inactive"
+ else
+ act = "not available"
+ end
+ act
+ end
+
+ def process_model(model)
+ if !model.uri and model.status == "Completed"
+ model.uri = RestClient.get(File.join(model.task_uri, 'resultURI')).body
+ model.save
+ end
+ unless @@config[:services]["opentox-model"].match(/localhost/)
+ if !model.validation_uri and model.validation_status == "Completed"
+ begin
+ model.validation_uri = RestClient.get(File.join(model.validation_task_uri, 'resultURI')).body
+ LOGGER.debug "Validation URI: #{model.validation_uri}"
+ model.validation_report_task_uri = RestClient.post(File.join(@@config[:services]["opentox-validation"],"/report/crossvalidation"), :validation_uris => model.validation_uri).body
+ LOGGER.debug "Validation Report Task URI: #{model.validation_report_task_uri}"
+ model.save
+ rescue
+ end
+ end
+ if model.validation_report_task_uri and !model.validation_report_uri and model.validation_report_status == 'Completed'
+ model.validation_report_uri = RestClient.get(File.join(model.validation_report_task_uri, 'resultURI')).body
+ end
+ end
+ end
+end
+