summaryrefslogtreecommitdiff
path: root/helper.rb
blob: e4f91e5bea5c3dd8bf078c9fdc122641ac38f217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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