diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-01-20 13:43:15 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-01-20 13:43:15 +0100 |
commit | a63e80ccfd1c6747169e79ab610d719435be8557 (patch) | |
tree | 0d2bd216fcea19153c28bc502fd405927f4f640f /application.rb | |
parent | b90e598248489797456fee4c6661cfbe62b8e8ec (diff) |
Sinatra app skeleton with predictions
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/application.rb b/application.rb index add7646..1cb0e13 100644 --- a/application.rb +++ b/application.rb @@ -4,18 +4,18 @@ require_relative 'protein_corona.rb' also_reload './protein_corona.rb' get '/?' do - @data = JSON.parse(File.read("./data.json")).select{|id,features| features["composition"]["Core composition"] == '[Au]'} # Silver has too may missing values + @data = JSON.parse(File.read("./data.json")) @example = @data[@data.keys.sample]["physchem"] - content_type :json - JSON.pretty_generate(@example) + # create a data entry form with @example as default values + #content_type :json + #JSON.pretty_generate(@example) end -get '/predict/?' do -end - -post '/predict/?' do - @features = params - @neighbors = neighbors params - @features[@endpoint_name] = prediction @neighbors +post '/?' do @prediction = predict params + # display prediction with + # query + prediction (or match if available) + # neighbors: id, composition, physchem, tox, similarity + #content_type :json + #JSON.pretty_generate(@example) end |