add search with model in crossvalidation and qmrf report as discussed with nina in...
authormguetlein <martin.guetlein@gmail.com>
Mon, 15 Aug 2011 07:15:56 +0000 (09:15 +0200)
committermguetlein <martin.guetlein@gmail.com>
Mon, 15 Aug 2011 07:15:56 +0000 (09:15 +0200)
reach_reports/reach_application.rb
reach_reports/reach_service.rb
validation/validation_application.rb

index e35df7b..d77906d 100755 (executable)
@@ -48,6 +48,7 @@ end
 get '/reach_report/:type' do
   type = extract_type(params)
   LOGGER.info "list all "+type+" reports"
+  uris = ReachReports.list_reports(type,params[:model] || params[:model_uri])
   if request.env['HTTP_ACCEPT'] =~ /text\/html/
     content_type "text/html"
     related_links = 
@@ -66,10 +67,10 @@ get '/reach_report/:type' do
     when /(?i)QPRF/
       #TODO
     end
-    OpenTox.text_to_html ReachReports.list_reports(type),@subjectid,related_links,description,post_command
+    OpenTox.text_to_html uris,@subjectid,related_links,description,post_command
   else
     content_type "text/uri-list"
-    ReachReports.list_reports(type)
+    uris
   end
 end
 
index fa4c0d7..2030dbd 100755 (executable)
@@ -12,10 +12,12 @@ end
   
 module ReachReports
   
-  def self.list_reports(type)
+  def self.list_reports(type, model_uri=nil)
     case type
     when /(?i)QMRF/
-      ReachReports::QmrfReport.all.collect{ |r| r.report_uri }.join("\n")+"\n"
+      params = {}
+      params[:model_uri]=model_uri if model_uri
+      ReachReports::QmrfReport.all(params).collect{ |r| r.report_uri }.join("\n")+"\n"
     when /(?i)QPRF/
       ReachReports::QprfReport.all.collect{ |r| r.report_uri }.join("\n")+"\n"
     end
index 0658309..d652de4 100755 (executable)
@@ -8,6 +8,12 @@ require 'validation/validation_service.rb'
 
 get '/crossvalidation/?' do
   LOGGER.info "list all crossvalidations"
+  model_uri = params.delete("model") || params.delete("model_uri")
+  if model_uri
+    model = OpenTox::Model::Generic.find(model_uri)
+    params[:algorithm] = model.metadata[OT.algorithm]
+    params[:dataset] = model.metadata[OT.trainingDataset]
+  end
   uri_list = Lib::OhmUtil.find( Validation::Crossvalidation, params ).sort.collect{|v| v.crossvalidation_uri}.join("\n") + "\n"
   if request.env['HTTP_ACCEPT'] =~ /text\/html/
     related_links =