diff --git a/VP/index-all.json b/VP/index-all.json
new file mode 100644
index 0000000..627df90
--- /dev/null
+++ b/VP/index-all.json
@@ -0,0 +1,93 @@
+[
+ {
+ "uuid": "8a38755f-e805-42a6-b872-5bb4c9df1a1d",
+ "clientUrl": "http://testbed.ejprd.semlab-leiden.nl:5000",
+ "state": "ACTIVE",
+ "registrationTime": "2024-02-13T10:48:35.596Z",
+ "modificationTime": "2024-10-15T11:34:03.062Z"
+ },
+ {
+ "uuid": "cd65140d-27f6-45f3-afc0-84b3047ac0e0",
+ "clientUrl": "http://testbed.ejprd.semlab-leiden.nl:10000",
+ "state": "ACTIVE",
+ "registrationTime": "2024-02-27T15:53:06.198Z",
+ "modificationTime": "2024-10-15T11:34:02.970Z"
+ },
+ {
+ "uuid": "67f26b17-bed5-4be5-a9d9-e6488923faf1",
+ "clientUrl": "http://152.228.212.152:9000",
+ "state": "ACTIVE",
+ "registrationTime": "2024-03-25T11:48:35.327Z",
+ "modificationTime": "2024-10-17T07:31:55.958Z"
+ },
+ {
+ "uuid": "30874e87-2179-4101-a1a0-8451c5ed4d7f",
+ "clientUrl": "https://w3id.org/duchenne-fdp",
+ "state": "ACTIVE",
+ "registrationTime": "2024-05-24T11:03:06.503Z",
+ "modificationTime": "2024-10-18T11:37:18.262Z"
+ },
+ {
+ "uuid": "33cfda82-ae8b-417a-a867-ae101132ade9",
+ "clientUrl": "https://w3id.org/bgv-fdp",
+ "state": "INACTIVE",
+ "registrationTime": "2024-06-01T12:27:23.645Z",
+ "modificationTime": "2024-10-03T05:43:10.141Z"
+ },
+ {
+ "uuid": "7e435bb3-72e7-46b6-a4f6-64c0850f3eee",
+ "clientUrl": "https://w3id.org/ERKNet/fdp",
+ "state": "ACTIVE",
+ "registrationTime": "2024-08-13T10:12:41.598Z",
+ "modificationTime": "2024-10-17T10:12:41.517Z"
+ },
+ {
+ "uuid": "a0f736d9-7d38-48fa-b241-c76b29d73d65",
+ "clientUrl": "https://w3id.org/ERKNet/fdp/",
+ "state": "INACTIVE",
+ "registrationTime": "2024-08-13T13:46:02.737Z",
+ "modificationTime": "2024-08-30T10:23:34.927Z"
+ },
+ {
+ "uuid": "ecdc9b94-7084-4aea-9176-29251c35552f",
+ "clientUrl": "https://jbo.bgv.cbgp.upm.es",
+ "state": "INACTIVE",
+ "registrationTime": "2024-08-13T13:49:21.616Z",
+ "modificationTime": "2024-10-03T05:43:01.999Z"
+ },
+ {
+ "uuid": "196ff4c1-efed-496e-b465-c0754ff418ad",
+ "clientUrl": "http://fairdatapointorphanet.info:7070/",
+ "state": "INACTIVE",
+ "registrationTime": "2024-08-30T09:33:53.970Z",
+ "modificationTime": "2024-10-03T05:42:59.333Z"
+ },
+ {
+ "uuid": "38067156-fe30-4f1b-a234-84e6d53f0e42",
+ "clientUrl": "https://ostrails.github.io/sandbox/fdp.ttl",
+ "state": "ACTIVE",
+ "registrationTime": "2024-10-16T14:25:29.953Z",
+ "modificationTime": "2024-10-16T14:25:2* Connection #0 to host testbed.ejprd.semlab-leiden.nl left intact9.953Z"
+ },
+ {
+ "uuid": "5abb940a-fdca-4ec0-b133-df252c2fe4cb",
+ "clientUrl": "https: //ostrails.github.io/sandbox/proxyfdp.ttl",
+ "state": "ACTIVE",
+ "registrationTime": "2024-10-18T11:46:18.829Z",
+ "modificationTime": "2024-10-18T11:46:18.829Z"
+ },
+ {
+ "uuid": "88618abe-bfff-4289-bef9-a49f4fc01a0b",
+ "clientUrl": "https://ostrails.github.io/sandbox/proxyservice.ttl",
+ "state": "ACTIVE",
+ "registrationTime": "2024-10-18T14:37:32.592Z",
+ "modificationTime": "2024-10-18T14:37:32.592Z"
+ },
+ {
+ "uuid": "98179f89-2cfa-4084-b1cd-f7cbb73cff70",
+ "clientUrl": "https://ostrails.github.io/sandbox/gobierno.ttl",
+ "state": "ACTIVE",
+ "registrationTime": "2024-10-19T12:03:27.685Z",
+ "modificationTime": "2024-10-19T12:03:27.685Z"
+ }
+]
\ No newline at end of file
diff --git a/VP/vp-interface/Gemfile b/VP/vp-interface/Gemfile
index a646401..a3653fb 100644
--- a/VP/vp-interface/Gemfile
+++ b/VP/vp-interface/Gemfile
@@ -1,60 +1,58 @@
# frozen_string_literal: false
-source "https://rubygems.org"
-#sinatra (2.2.4, 1.4.8)
-#sinatra-cross_origin (0.4.0)
-#sinatra-respond_to (0.9.0, 0.4.0)
+source 'https://rubygems.org'
gemspec
-ruby "~> 3.3.0"
-# gem 'activerecord', '~> 7', '>= 7', require: 'active_record'
-gem "bcrypt"
-gem "debase", git: "https://github.com/ruby-debug/debase.git", tag: "v0.2.5.beta2"
-gem "linkeddata", "~> 3.2.0"
-gem "metainspector", "~> 5-11-2"
-gem "parseconfig", "~>1.1.2"
-gem "pry"
-gem "rake", "~> 13.0"
-gem "rdf-raptor", "~> 3.1.0"
-gem "require_all"
-gem "rest-client", "~>2.1.0"
-gem "rspec", "~> 3.11.0"
-gem "rubocop"
-gem "ruby-debug-ide"
-gem "shotgun"
-gem "sinatra", "~> 2.2"
-#gem "sinatra", "~> 1.4.8"
-gem "cgi", "~> 0.4.1"
-gem "csv"
-gem "fileutils", "~>1.5.0"
-gem "json", "~> 2.7.1"
-gem "json-canonicalization", "~> 1.0.0"
-gem "openapi3_parser", "~> 0.10.0"
-gem "securerandom"
-gem "sinatra-cross_origin"
-gem "swagger-blocks", "~> 3.0.0"
-gem "tempfile"
-gem "thin"
-gem "tux"
-gem "xml-simple", "~>1.1.8"
+ruby '~> 3.3.0'
+gem 'bcrypt'
+gem 'debase', git: 'https://github.com/ruby-debug/debase.git', tag: 'v0.2.5.beta2'
+gem 'linkeddata', '~> 3.2.0'
+gem 'metainspector', '~> 5-11-2'
+gem 'parseconfig', '~>1.1.2'
+gem 'pry'
+gem 'rake', '~> 13.0'
+gem 'rdf-raptor', '~> 3.1.0'
+gem 'require_all'
+gem 'rest-client', '~>2.1.0'
+gem 'rubocop'
+gem 'ruby-debug-ide'
+gem 'shotgun'
+gem 'sinatra', '~> 2.2'
+# gem "sinatra", "~> 1.4.8"
+gem 'cgi', '~> 0.4.1'
+gem 'csv'
+gem 'fileutils', '~>1.5.0'
+gem 'json', '~> 2.7.1'
+gem 'json-canonicalization', '~> 1.0.0'
+gem 'openapi3_parser', '~> 0.10.0'
+gem 'securerandom'
+gem 'sinatra-cross_origin'
+gem 'swagger-blocks', '~> 3.0.0'
+gem 'tempfile'
+gem 'thin'
+gem 'tux'
+gem 'xml-simple', '~>1.1.8'
group :test do
- gem "capybara"
- gem "rack-test"
- # gem 'database_cleaner', git: 'https://github.com/bmabey/database_cleaner.git'
+ gem 'capybara'
+ gem 'rack-test'
+ gem 'rspec', '~> 3.11.0'
+ gem 'rspec-core', '~> 3.11'
+ gem "rspec-openapi", "~> 0.18.3"
+
end
-gem "dpop", "~> 0.1.3"
+gem 'dpop', '~> 0.1.3'
-gem "activesupport", "~> 7.0.3.1"
+gem 'activesupport', '~> 7.0.3.1'
-gem "erb", "~> 4.0"
+gem 'erb', '~> 4.0'
# gem "omniauth", "~> 1.1"
# gem "omniauth-openid-connect", "~> 0.2.3"
-gem "jwt", "~> 2.8"
+gem 'jwt', '~> 2.8'
+gem 'sinatra-respond_to', '~> 0.4.0'
-gem "sinatra-respond_to", "~> 0.4.0"
diff --git a/VP/vp-interface/Gemfile.lock b/VP/vp-interface/Gemfile.lock
index 25b6a1e..c5778ef 100644
--- a/VP/vp-interface/Gemfile.lock
+++ b/VP/vp-interface/Gemfile.lock
@@ -14,6 +14,19 @@ PATH
GEM
remote: https://rubygems.org/
specs:
+ actionpack (7.0.3.1)
+ actionview (= 7.0.3.1)
+ activesupport (= 7.0.3.1)
+ rack (~> 2.0, >= 2.2.0)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
+ actionview (7.0.3.1)
+ activesupport (= 7.0.3.1)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
@@ -43,6 +56,7 @@ GEM
commonmarker (1.1.5-x86_64-linux)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
+ crass (1.0.6)
csv (3.2.8)
daemons (1.4.1)
debase-ruby_core_source (3.2.1)
@@ -61,6 +75,7 @@ GEM
unicode-types (~> 1.8)
erb (4.0.4)
cgi (>= 0.3.3)
+ erubi (1.13.0)
eventmachine (1.2.7)
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
@@ -146,6 +161,9 @@ GEM
sparql-client (~> 3.2, >= 3.2.2)
yaml-ld (~> 0.0)
logger (1.5.3)
+ loofah (2.22.0)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
matrix (0.4.2)
metainspector (5.15.0)
addressable (~> 2.8.4)
@@ -196,6 +214,13 @@ GEM
rack
rack-test (2.1.0)
rack (>= 1.3)
+ rails-dom-testing (2.2.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.6.0)
+ loofah (~> 2.21)
+ nokogiri (~> 1.14)
rainbow (3.1.1)
rake (13.0.6)
rdf (3.3.1)
@@ -293,6 +318,10 @@ GEM
rspec-mocks (3.11.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
+ rspec-openapi (0.18.3)
+ actionpack (>= 5.2.0)
+ rails-dom-testing
+ rspec-core
rspec-support (3.11.1)
rubocop (1.54.2)
json (~> 2.3)
@@ -412,6 +441,8 @@ DEPENDENCIES
require_all
rest-client (~> 2.1.0)
rspec (~> 3.11.0)
+ rspec-core (~> 3.11)
+ rspec-openapi (~> 0.18.3)
rubocop
ruby-debug-ide
securerandom
diff --git a/VP/vp-interface/app/controllers/application_controller.rb b/VP/vp-interface/app/controllers/application_controller.rb
index 13c6b66..370cb16 100644
--- a/VP/vp-interface/app/controllers/application_controller.rb
+++ b/VP/vp-interface/app/controllers/application_controller.rb
@@ -1,61 +1,60 @@
# frozen_string_literal: false
-require_relative "../../config/environment" # for docker
-require "swagger/blocks"
-require "sinatra"
-require "sinatra/base"
-require "json"
-require "erb"
+require_relative '../../config/environment' # for docker
+require 'swagger/blocks'
+require 'sinatra'
+require 'sinatra/base'
+require 'json'
+require 'erb'
# require 'omniauth'
# require 'omniauth-openid-connect'
require 'jwt'
# DO NOT change the order of loading below. The files contain executable code that builds the overall configuration before this module starts
-require_relative "../../lib/configuration" # VPConfig and FDPConfig
-require_relative "models"
-require_relative "routes"
-require_relative "../../lib/cache"
-require_relative "../../lib/fdp"
-require_relative "../../lib/vp"
-require_relative "../../lib/metadata_functions"
-require_relative "../../lib/services"
-require_relative "../../lib/wordcloud"
-
+require_relative '../../lib/configuration' # VPConfig and FDPConfig
+require_relative 'models'
+require_relative 'routes'
+require_relative '../../lib/cache'
+require_relative '../../lib/fdp'
+require_relative '../../lib/vp'
+require_relative '../../lib/metadata_functions'
+require_relative '../../lib/services'
+require_relative '../../lib/wordcloud'
class ApplicationController < Sinatra::Application
include Swagger::Blocks
- set :bind, "0.0.0.0"
+ set :bind, '0.0.0.0'
before do
- response.headers["Access-Control-Allow-Origin"] = "*"
+ response.headers['Access-Control-Allow-Origin'] = '*'
end
configure do
- set :public_folder, "public"
- set :views, "app/views"
+ set :public_folder, 'public'
+ set :views, 'app/views'
enable :cross_origin
end
# routes...
- options "*" do
- response.headers["Allow"] = "GET, PUT, POST, DELETE, OPTIONS"
- response.headers["Access-Control-Allow-Headers"] = "Authorization, Content-Type, Accept, X-User-Email, X-Auth-Token"
- response.headers["Access-Control-Allow-Origin"] = "*"
+ options '*' do
+ response.headers['Allow'] = 'GET, PUT, POST, DELETE, OPTIONS'
+ response.headers['Access-Control-Allow-Headers'] = 'Authorization, Content-Type, Accept, X-User-Email, X-Auth-Token'
+ response.headers['Access-Control-Allow-Origin'] = '*'
200
end
swagger_root do
- key :swagger, "2.0"
+ key :swagger, '2.0'
info do
- key :version, "1.0.0"
- key :title, "FLAIR-GG Virtual Platform Server"
- key :description, "Enables discovery of Germplasm resources"
- key :termsOfService, "https://example.org"
+ key :version, '1.0.0'
+ key :title, 'FLAIR-GG Virtual Platform Server'
+ key :description, 'Enables discovery of Germplasm resources'
+ key :termsOfService, 'https://example.org'
contact do
- key :name, "Mark D. Wilkinson"
+ key :name, 'Mark D. Wilkinson'
end
license do
- key :name, "MIT"
+ key :name, 'MIT'
end
end
# tag do
@@ -66,9 +65,9 @@ class ApplicationController < Sinatra::Application
# key :url, 'https://fairdata.services/Champion/about'
# end
# end
- key :schemes, ["http"]
- key :host, ENV.fetch("HARVESTER", nil)
- key :basePath, "/flair-gg-vp-server"
+ key :schemes, ['http']
+ key :host, ENV.fetch('HARVESTER', nil)
+ key :basePath, '/flair-gg-vp-server'
# key :consumes, ['application/json']
# key :produces, ['application/json']
end
@@ -77,9 +76,8 @@ class ApplicationController < Sinatra::Application
SWAGGERED_CLASSES = [ErrorModel, AllResourcesResponse, OntologySearchResponse, KeywordSearchResponse, self].freeze
set_routes(classes: SWAGGERED_CLASSES)
-
- VP.new(config: VPConfig.new) # set up index and active sites)
+
+ VP.new(config: VPConfig.new) # set up index and active sites)
run! # if app_file == $PROGRAM_NAME
end
-
diff --git a/VP/vp-interface/app/controllers/routes.rb b/VP/vp-interface/app/controllers/routes.rb
index 6bc11c4..fa636e8 100644
--- a/VP/vp-interface/app/controllers/routes.rb
+++ b/VP/vp-interface/app/controllers/routes.rb
@@ -2,71 +2,71 @@
def set_routes(classes: allclasses)
set :server_settings, timeout: 180
- set :public_folder, "public"
+ set :public_folder, 'public'
- get "/" do
- redirect "/flair-gg-vp-server/resources"
+ get '/' do
+ redirect '/flair-gg-vp-server/resources'
end
- get "/flair-gg-vp-server" do
+ get '/flair-gg-vp-server' do
content_type :json
response.body = JSON.dump(Swagger::Blocks.build_root_json(classes))
end
- get "/flair-gg-vp-server/force-refresh" do
- warn "initializing refresh in routes"
- unless File.exist?("./cache/REFRESHING") # multiple browser calls are a problem!
+ get '/flair-gg-vp-server/force-refresh' do
+ warn 'initializing refresh in routes'
+ unless File.exist?('./cache/REFRESHING') # multiple browser calls are a problem!
VP.restart
- @discoverables = VP.current_vp.get_resources # "./lib/metadata_functions"
- FileUtils.rm_f("./cache/servicetypes.json") # remove the cache
+ @discoverables = VP.current_vp.get_resources # "./lib/metadata_functions"
+ FileUtils.rm_f('./cache/servicetypes.json') # remove the cache
@services = VP.current_vp.collect_data_services
end
- redirect "/flair-gg-vp-server/resources" # before do collect_data_services will be called, and this will refresh
+ redirect '/flair-gg-vp-server/resources' # before do collect_data_services will be called, and this will refresh
end
- get "/flair-gg-vp-server/resources" do
- @discoverables = VP.current_vp.get_resources # "./lib/metadata_functions"
- @message = "All Resources"
+ get '/flair-gg-vp-server/resources' do
+ @discoverables = VP.current_vp.get_resources # "./lib/metadata_functions"
+ @message = 'All Resources'
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :discovered_layout
- when "application/json"
+ when 'application/json'
content_type :json
halt @discoverables.to_json
end
end
- error 406 # @message = "All Resources"
+ error 406 # @message = "All Resources"
# erb :discovered_layout
end
- get "/flair-gg-vp-server/keyword-search" do
- keyword = params["keyword"].strip
+ get '/flair-gg-vp-server/keyword-search' do
+ keyword = params['keyword'].strip
@discoverables = VP.current_vp.keyword_search_shell(keyword: keyword) # "./lib/vp"
- @message = "Keyword Search Results"
+ @message = 'Keyword Search Results'
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :discovered_layout
- when "application/json"
+ when 'application/json'
content_type :json
halt @discoverables.to_json
end
end
- error 406 # @message = "All Resources"
+ error 406 # @message = "All Resources"
# erb :discovered_layout
end
- post "/flair-gg-vp-server/keyword-search" do
+ post '/flair-gg-vp-server/keyword-search' do
data = JSON.parse request.body.read.to_s
- keyword = data["keyword"] ? data["keyword"].strip : ""
+ keyword = data['keyword'] ? data['keyword'].strip : ''
@discoverables = VP.current_vp.keyword_search_shell(keyword: keyword) # "./lib/vp"
- @message = "Keyword Search Results"
+ @message = 'Keyword Search Results'
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :discovered_layout
- when "application/json"
+ when 'application/json'
content_type :json
halt @discoverables.to_json
end
@@ -75,16 +75,16 @@ def set_routes(classes: allclasses)
# erb :discovered_layout
end
- get "/flair-gg-vp-server/ontology-search" do
- term = params["uri"].strip
- term = term.gsub(/\S+:/, "") unless term =~ /^http/
+ get '/flair-gg-vp-server/ontology-search' do
+ term = params['uri'].strip
+ term = term.gsub(/\S+:/, '') unless term =~ /^http/
@discoverables = VP.current_vp.ontology_search_shell(term: term) # "./lib/vp"
- @message = "Ontology Search Results"
+ @message = 'Ontology Search Results'
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :discovered_layout
- when "application/json"
+ when 'application/json'
content_type :json
halt @discoverables.to_json
end
@@ -92,17 +92,17 @@ def set_routes(classes: allclasses)
error 406
# erb :discovered_layout
end
- post "/flair-gg-vp-server/ontology-search" do
+ post '/flair-gg-vp-server/ontology-search' do
data = JSON.parse request.body.read.to_s
- term = data["uri"] ? data["uri"].strip : ""
- term = term.gsub(/\S+:/, "") unless term =~ /^http/
+ term = data['uri'] ? data['uri'].strip : ''
+ term = term.gsub(/\S+:/, '') unless term =~ /^http/
@discoverables = VP.current_vp.ontology_search_shell(term: term) # "./lib/vp"
- @message = "Ontology Search Results"
+ @message = 'Ontology Search Results'
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :discovered_layout
- when "application/json"
+ when 'application/json'
content_type :json
halt @discoverables.to_json
end
@@ -116,15 +116,16 @@ def set_routes(classes: allclasses)
# @servicecollection, @commongetparams, @commonpostparams = VP.current_vp.retrieve_sevices(termuri: termuri) # "./lib/vp"
# erb :services_layout
# end
- get "/flair-gg-vp-server/retrieve-services" do
- termuri = params["services"]
+ get '/flair-gg-vp-server/retrieve-services' do
+ termuri = params['services']
@servicecollection, @commongetparams, @commonpostparams = VP.current_vp.retrieve_sevices(termuri: termuri) # "./lib/vp"
request.accept.each do |type|
case type.to_s
- when "text/html"
+ when 'text/html'
halt erb :services_layout
- when "application/json"
- @minimized_collection = @servicecollection.minimize_service_collection( commongetparams: @commongetparams, commonpostparams: @commonpostparams)
+ when 'application/json'
+ @minimized_collection = @servicecollection.minimize_service_collection(commongetparams: @commongetparams,
+ commonpostparams: @commonpostparams)
@servicecollection.vpgraph = nil
content_type :json
response = @minimized_collection.to_json
@@ -134,50 +135,83 @@ def set_routes(classes: allclasses)
error 406
end
- post "/flair-gg-vp-server/execute-data-services" do
- @servicelabel = params["servicelabel"].downcase.gsub(/\s+/, "_") # no spaces in service filenames - label leads to jupyter file
- @location, @results = VP.current_vp.execute_data_services(params: params)
- erb :execution_results_layout
- end
+ post '/flair-gg-vp-server/execute-data-services' do
+ # three possibilities:
+ # 1) they send key/value pairs as params from form interface
+ # 2) they send _request_body from the form interfaces
+ # 3) they send JSON as the body
+ if request.content_type == 'application/json'
+ j = JSON.parse(request.body.read.to_s)
+ j = j.first if j.is_a? Array
+ # {uri: serviceuri,
+ # _request_body: {json: data},
+ # service_list: [endpoint, endpoint, endpoint]
+ # } # this is passed to all services
+ _serviceuri = j['uri'].gsub(%r{.*[/\#](\S+)}, '\1') # take fragment only
+ servicelabel = @serviceuri.downcase.gsub(/\s+/, '_')
+ analytics = "https://wilkinsonlab.github.io/FLAIR-GG-Analytics/lab/index.html?path=FLAIR-GG%2F#{servicelabel}.ipynb"
+ location, results = VP.current_vp.execute_data_services_api(json: j)
+ request.accept.each do |type|
+ case type.to_s
+ when 'application/json'
+ content_type :json
+ halt({ 'key' => location, 'jupyter' => analytics, 'results' => results }.to_json)
+ end
+ end
+ else
+ @servicelabel = params['servicelabel'].downcase.gsub(/\s+/, '_') # no spaces in service filenames - label leads to jupyter file
+ @location, @results = VP.current_vp.execute_data_services(params: params)
+ request.accept.each do |type|
+ case type.to_s
+ when 'text/html'
+ halt erb :execution_results_layout
+ when 'application/json'
+ content_type :json
+ halt({ 'location' => location, 'jupyter' => @servicelabel }.to_json)
+ end
+ end
+ end
+ error 406
+ end
- get "/flair-gg-vp-server/wordcloud" do
+ get '/flair-gg-vp-server/wordcloud' do
@freqs = Wordcloud.new.count_words # "./lib/wordcloud"
erb :wordcloud
end
- get "/flair-gg-vp-server/wordcloud/force-refresh" do
+ get '/flair-gg-vp-server/wordcloud/force-refresh' do
@discoverables = {}
@freqs = {}
- if File.exist?("./cache/WCREFRESHING") # multiple browser calls are a problem!
+ if File.exist?('./cache/WCREFRESHING') # multiple browser calls are a problem!
erb :discovered_layout
else
- f = open("./cache/WCREFRESHING", "w") # multiple browser calls are a problem!
- f.puts "WCREFRESHING"
+ f = open('./cache/WCREFRESHING', 'w') # multiple browser calls are a problem!
+ f.puts 'WCREFRESHING'
f.close
- warn "forced refresh"
+ warn 'forced refresh'
wc = Wordcloud.new(refresh: true)
@freqs = wc.count_words
warn "received #{@freqs.length}"
- FileUtils.rm_f("./cache/WCREFRESHING")
+ FileUtils.rm_f('./cache/WCREFRESHING')
end
erb :wordcloud
end
- get "/flair-gg-vp-server/refresh-servicetypes" do
- FileUtils.rm_f("./cache/servicetypes.json") # remove the cache
+ get '/flair-gg-vp-server/refresh-servicetypes' do
+ FileUtils.rm_f('./cache/servicetypes.json') # remove the cache
@services = VP.current_vp.collect_data_services # refresh
- redirect "/flair-gg-vp-server/resources" # before do collect_data_services will be called, and this will refresh
+ redirect '/flair-gg-vp-server/resources' # before do collect_data_services will be called, and this will refresh
end
# API Only
- get "/flair-gg-vp-server/servicetypes" do
- FileUtils.rm_f("./cache/servicetypes.json") # remove the cache
+ get '/flair-gg-vp-server/servicetypes' do
+ FileUtils.rm_f('./cache/servicetypes.json') # remove the cache
@services = VP.current_vp.collect_data_services # refresh
request.accept.each do |type|
case type.to_s
- when "application/json"
+ when 'application/json'
content_type :json
halt @services.to_json
end
diff --git a/VP/vp-interface/app/models/openapi3.json b/VP/vp-interface/app/models/openapi3.json
new file mode 100644
index 0000000..d9e2b3e
--- /dev/null
+++ b/VP/vp-interface/app/models/openapi3.json
@@ -0,0 +1,229 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "XXX & GRLC",
+ "description": "The FAIR Data Point grlc server for the XXXX Project",
+ "contact": {
+ "name": "Your Name Here",
+ "url": "https://my.organization.org"
+ },
+ "version": "local"
+ },
+ "servers": [
+ {
+ "url": "//testbed.ejprd.semlab-leiden.nl:30001/api-local/"
+ }
+ ],
+ "paths": {
+ "/count": {
+ "get": {
+ "tags": [
+ "Patient Count"
+ ],
+ "summary": "Returns the number of patients in the registry with the corresponding disease code",
+ "description": "\n\n```\n#+ summary: Returns the number of patients in the registry with the corresponding disease code\n#+ tags:\n#+ - Patient Count\n#+ defaults:\n#+ - type: http://www.orpha.net/ORDO/Orphanet_98896\n#+ endpoint_in_url: False\n\nPREFIX obo: \nPREFIX sio: \nPREFIX xsd: \nPREFIX ordo: \nPREFIX rdfs: \nPREFIX ofn: \n\nselect (COUNT(?disattribute) as ?count) where { \n?disprocess a ; # diagnostic process\n sio:SIO_000229 ?disoutput .\n?disoutput a ; # diagnosis code\n sio:SIO_000628 ?disattribute.\n?disattribute a ?_type_iri . # attribute is a orphacode\n}\n\n```",
+ "parameters": [
+ {
+ "name": "type",
+ "in": "query",
+ "description": "A value of type string (iri) that will substitute ?_type_iri in the original query",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "iri",
+ "default": "http://www.orpha.net/ORDO/Orphanet_98896"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Query response",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "text/html": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unexpected error",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "text/html": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/kpi-ttd": {
+ "get": {
+ "tags": [
+ "KPI diagnosis-delay"
+ ],
+ "summary": "Returns the Key Performance Indicator of the delay between symptom onset and diagnosis. This data is aggregated by disease, and by year of diagnosis, and is measured in days.",
+ "description": "\n\n```\n#+ summary: Returns the Key Performance Indicator of the delay between symptom onset and diagnosis. This data is aggregated by disease, and by year of diagnosis, and is measured in days.\n#+ tags:\n#+ - KPI diagnosis-delay\n#+ defaults:\n#+ \n#+ endpoint_in_url: False\n\n################################################################\n# list diagnosis and time from onset to diagnosis\n################################################################\n\nPREFIX obo: \nPREFIX sio: \nPREFIX xsd: \nPREFIX ordo: \nPREFIX rdfs: \nPREFIX ofn: \n\n# date of symptom onset is the value (output) of its own model, date of diagnosis is in the context of the diagnosis model\n#SELECT DISTINCT ?pid ?onsetvalue ?diagnosisdate ?ORDO ?yearOfDiagnosis (xsd:integer(ROUND(AVG(?timeOnsetToDiagnosis))) as ?avgoffset)\nSELECT DISTINCT ?ORDO ?yearOfDiagnosis (xsd:integer(ROUND(AVG(?timeOnsetToDiagnosis))) as ?avgoffset)\nWHERE {\n BIND(xsd:integer(ofn:asDays(?diagnosisdate - ?onsetvalue )) AS ?timeOnsetToDiagnosis)\n BIND(SUBSTR(str(?diagnosisdate), 1,4) AS ?yearOfDiagnosis)\n \n\t\tGRAPH ?diseasegraph {\n ?disperson sio:SIO_000228 ?disrole . # person has role role\n ?disrole sio:SIO_000356 ?disprocess ; # is realized in process\n a sio:SIO_000016 .\n ?disprocess a ; # diagnostic process\n sio:SIO_000229 ?disoutput .\n ?disoutput a ; # diagnosis code\n sio:SIO_000628 ?disattribute.\n ?disattribute a ?ORDO.\n FILTER(!(?ORDO = sio:SIO_000614))\n }\n ?diseasegraph a obo:NCIT_C62143 ; # encounter\n \t\t\tsio:SIO_000068 ?diseasetimeline, ?diseaseevent ; # is part of\n \t\t\tsio:SIO_000680 ?diseasestartdate . # start date\n \t?diseasestartdate sio:SIO_000300 ?diagnosisdate . # need the has value property\n\n ?diseasetimeline a obo:NCIT_C54576, sio:SIO_000417; \n \tsio:SIO_000332 ?diseaseindividual .\n ?diseaseindividual sio:SIO_000671 ?diseaseindividual_identifier .\n ?diseaseindividual_identifier sio:SIO_000300 ?pid .\n\n\n# date of symptom onset is the value (output) of its own model, date of diagnosis is in the context of the diagnosis model\n GRAPH ?onsetg {\n ?onsetrole sio:SIO_000356 ?onsetprocess ; \n a sio:SIO_000016 .\n ?onsetprocess a sio:SIO_000006 , ?onsetprocess_type ; \n sio:SIO_000229 ?onsetoutput .\n ?onsetoutput a sio:SIO_000015, ?onsetoutput_type; \n sio:SIO_000628 ?onsetattribute.\n ?onsetattribute a .\n \t\n ?onsetoutput sio:SIO_000300 ?onsetvalue .\n }\n ?onsetg a obo:NCIT_C62143 ; # encounter\n\t sio:SIO_000068 ?onsettimeline, ?onsetevent . # is part of\n\n ?onsettimeline a obo:NCIT_C54576, sio:SIO_000417; \n \t sio:SIO_000332 ?onsetindividual .\n ?onsetindividual sio:SIO_000671 ?onsetindividual_identifier .\n ?onsetindividual_identifier sio:SIO_000300 ?pid . # close the join around PID\n \n} group by ?ORDO ?yearOfDiagnosis order by ?yearOfDiagnosis ?ORDO \n```",
+ "responses": {
+ "200": {
+ "description": "Query response",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "text/html": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unexpected error",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "text/html": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/phenotype-frequencies": {
+ "get": {
+ "tags": [
+ "Phenotype frequency"
+ ],
+ "summary": "Returns the number of patients in the registry that have had a phenotype code at any time",
+ "description": "\n\n```\n#+ summary: Returns the number of patients in the registry that have had a phenotype code at any time\n#+ tags:\n#+ - Phenotype frequency\n#+ defaults:\n#+ \n#+ endpoint_in_url: False\n\nPREFIX obo: \nPREFIX sio: \nPREFIX xsd: \nPREFIX ordo: \nPREFIX rdfs: \nPREFIX ofn: \n\n\nselect ?pheno (count(?pheno) as ?frequency) where {\n select distinct ?p ?pheno where {\n\t\tGRAPH ?diseasegraph {\n ?disprocess a ; # diagnostic process\n sio:SIO_000229 ?disoutput .\n ?disoutput a ; # diagnosis code\n sio:SIO_000628 ?disattribute.\n ?disattribute a ?pheno .\n FILTER(!(?pheno = sio:SIO_000614))\n\n\t\t}\n ?diseasegraph a obo:NCIT_C62143 ; # encounter\n \t\t\tsio:SIO_000068 ?diseasetimeline, ?diseaseevent . # is part of\n\n\t ?diseasetimeline a obo:NCIT_C54576, sio:SIO_000417; \n \tsio:SIO_000332 ?diseaseindividual .\n\t ?diseaseindividual sio:SIO_000671 ?diseaseindividual_identifier .\n \t?diseaseindividual_identifier sio:SIO_000300 ?p .\n }\n} group by ?pheno order by desc(?frequency)\n```",
+ "responses": {
+ "200": {
+ "description": "Query response",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "text/html": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unexpected error",
+ "content": {
+ "text/csv": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ },
+ "text/html": {
+ "schema": {
+ "$ref": "#/components/schemas/Message"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Message": {
+ "type": "string"
+ }
+ }
+ },
+ "x-original-swagger-version": "2.0"
+}
\ No newline at end of file
diff --git a/VP/vp-interface/app/views/_sidebar.erb b/VP/vp-interface/app/views/_sidebar.erb
index 92a0f12..c280173 100644
--- a/VP/vp-interface/app/views/_sidebar.erb
+++ b/VP/vp-interface/app/views/_sidebar.erb
@@ -1,10 +1,10 @@
diff --git a/VP/vp-interface/cache/1afd3d82e64ea326f2690da73fba36e694844b5df911991dea2d70964497ee44.marsh b/VP/vp-interface/cache/1afd3d82e64ea326f2690da73fba36e694844b5df911991dea2d70964497ee44.marsh
index f758c03..ac132d5 100644
Binary files a/VP/vp-interface/cache/1afd3d82e64ea326f2690da73fba36e694844b5df911991dea2d70964497ee44.marsh and b/VP/vp-interface/cache/1afd3d82e64ea326f2690da73fba36e694844b5df911991dea2d70964497ee44.marsh differ
diff --git a/VP/vp-interface/cache/2b2a205f4ee6c947c4354ab52f123c0579cf58ac70525b7983bd35d2e93f4ebc.marsh b/VP/vp-interface/cache/2b2a205f4ee6c947c4354ab52f123c0579cf58ac70525b7983bd35d2e93f4ebc.marsh
index b16cc37..423b8a7 100644
Binary files a/VP/vp-interface/cache/2b2a205f4ee6c947c4354ab52f123c0579cf58ac70525b7983bd35d2e93f4ebc.marsh and b/VP/vp-interface/cache/2b2a205f4ee6c947c4354ab52f123c0579cf58ac70525b7983bd35d2e93f4ebc.marsh differ
diff --git a/VP/vp-interface/cache/44c6412a85ac61f9abc36484ecf0882fa6ebed8d01bae2e9e9452ef629b5d0cb.marsh b/VP/vp-interface/cache/44c6412a85ac61f9abc36484ecf0882fa6ebed8d01bae2e9e9452ef629b5d0cb.marsh
new file mode 100644
index 0000000..77820d7
Binary files /dev/null and b/VP/vp-interface/cache/44c6412a85ac61f9abc36484ecf0882fa6ebed8d01bae2e9e9452ef629b5d0cb.marsh differ
diff --git a/VP/vp-interface/cache/627c5e2d461d7b220eb3bd4030467fd94000ba43ef97456956c4c0a7b24a7aea.marsh b/VP/vp-interface/cache/627c5e2d461d7b220eb3bd4030467fd94000ba43ef97456956c4c0a7b24a7aea.marsh
new file mode 100644
index 0000000..a48f10e
Binary files /dev/null and b/VP/vp-interface/cache/627c5e2d461d7b220eb3bd4030467fd94000ba43ef97456956c4c0a7b24a7aea.marsh differ
diff --git a/VP/vp-interface/cache/73a783168e6b985e249d715b5e67d8ca259f5415b620e830474bfd6c600974f1.marsh b/VP/vp-interface/cache/73a783168e6b985e249d715b5e67d8ca259f5415b620e830474bfd6c600974f1.marsh
index beaa9bb..44c6c9b 100644
Binary files a/VP/vp-interface/cache/73a783168e6b985e249d715b5e67d8ca259f5415b620e830474bfd6c600974f1.marsh and b/VP/vp-interface/cache/73a783168e6b985e249d715b5e67d8ca259f5415b620e830474bfd6c600974f1.marsh differ
diff --git a/VP/vp-interface/cache/a19c57d3b3044ac12f221d33e57cc8f4a28296783c5e24071d0bb1fb760b3ad0.marsh b/VP/vp-interface/cache/a19c57d3b3044ac12f221d33e57cc8f4a28296783c5e24071d0bb1fb760b3ad0.marsh
new file mode 100644
index 0000000..dd05a4f
Binary files /dev/null and b/VP/vp-interface/cache/a19c57d3b3044ac12f221d33e57cc8f4a28296783c5e24071d0bb1fb760b3ad0.marsh differ
diff --git a/VP/vp-interface/cache/bde727f374588b747fba0a13e6bddd1f552cd457b6e49a99672dd796ce53004a.marsh b/VP/vp-interface/cache/bde727f374588b747fba0a13e6bddd1f552cd457b6e49a99672dd796ce53004a.marsh
index 623836b..c7539cb 100644
Binary files a/VP/vp-interface/cache/bde727f374588b747fba0a13e6bddd1f552cd457b6e49a99672dd796ce53004a.marsh and b/VP/vp-interface/cache/bde727f374588b747fba0a13e6bddd1f552cd457b6e49a99672dd796ce53004a.marsh differ
diff --git a/VP/vp-interface/cache/ca0d6773c98d5182b61e3c2f4c40ec9dd07814ec9948b59e8a80825d37e5911e.marsh b/VP/vp-interface/cache/ca0d6773c98d5182b61e3c2f4c40ec9dd07814ec9948b59e8a80825d37e5911e.marsh
new file mode 100644
index 0000000..01cbda9
Binary files /dev/null and b/VP/vp-interface/cache/ca0d6773c98d5182b61e3c2f4c40ec9dd07814ec9948b59e8a80825d37e5911e.marsh differ
diff --git a/VP/vp-interface/cache/d7c4d539e512535ed616b186adf81f926a5e45d8e12edaf173207a89f7058369.marsh b/VP/vp-interface/cache/d7c4d539e512535ed616b186adf81f926a5e45d8e12edaf173207a89f7058369.marsh
index 04c6a23..33225df 100644
Binary files a/VP/vp-interface/cache/d7c4d539e512535ed616b186adf81f926a5e45d8e12edaf173207a89f7058369.marsh and b/VP/vp-interface/cache/d7c4d539e512535ed616b186adf81f926a5e45d8e12edaf173207a89f7058369.marsh differ
diff --git a/VP/vp-interface/config.ru b/VP/vp-interface/config.ru
index 9ed7599..a380f9e 100644
--- a/VP/vp-interface/config.ru
+++ b/VP/vp-interface/config.ru
@@ -4,4 +4,4 @@ require './config/environment'
# raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
# end
-run ApplicationController
+# run ApplicationController
diff --git a/VP/vp-interface/lib/comon_queries.rb b/VP/vp-interface/lib/common_queries.rb
similarity index 76%
rename from VP/vp-interface/lib/comon_queries.rb
rename to VP/vp-interface/lib/common_queries.rb
index fdf2bf8..751ffca 100644
--- a/VP/vp-interface/lib/comon_queries.rb
+++ b/VP/vp-interface/lib/common_queries.rb
@@ -11,8 +11,8 @@ class VP
VPDISCOVERABLE = "ejpnew:VPDiscoverable".freeze
VPANNOTATION = "dcat:theme".freeze
- def find_discoverables_query(graph:)
- SPARQL.parse("
+ def find_discoverables_query(graph:)
+ vpd = SPARQL.parse("
#{NAMESPACES}
SELECT DISTINCT ?s ?t ?title ?contact ?servicetype WHERE
{
@@ -29,13 +29,13 @@ def find_discoverables_query(graph:)
}
")
- graph.query(vpd)
- end
+ graph.query(vpd)
+ end
- def keyword_search_query(graph:, keyword:)
- vpd = SPARQL.parse("
+ def keyword_search_query(graph:, keyword:)
+ vpd = SPARQL.parse("
#{NAMESPACES}
-
+
SELECT DISTINCT ?s ?t ?title ?contact WHERE
{
VALUES ?connection { #{VPCONNECTION} }
@@ -46,27 +46,26 @@ def keyword_search_query(graph:, keyword:)
OPTIONAL{?s dcat:contactPoint ?c .
?c ?contact } .
{
- VALUES ?searchfields { dc:title dc:description dc:keyword }
+ VALUES ?searchfields { dc:title dc:description dc:keyword dcat:keyword }
?s ?searchfields ?kw
FILTER(CONTAINS(lcase(?kw), '#{keyword}'))
}
}")
- # warn "keyword search query #{vpd.to_sparql}"
- # warn "graph is #{@graph.size}"
- graph.query(vpd)
-
- end
+ # warn "keyword search query #{vpd.to_sparql}"
+ # warn "graph is #{@graph.size}"
+ graph.query(vpd)
+ end
- def ontology_search_query(graph:, uri:)
- vpd = SPARQL.parse("
+ def ontology_search_query(graph:, uri:)
+ vpd = SPARQL.parse("
#{NAMESPACES}
-
+
SELECT DISTINCT ?s ?t ?title ?contact WHERE
{
VALUES ?connection { #{VPCONNECTION} }
VALUES ?discoverable { #{VPDISCOVERABLE} }
-
+
?s ?connection ?discoverable ;
dc:title ?title ;
a ?t .
@@ -77,34 +76,33 @@ def ontology_search_query(graph:, uri:)
FILTER(CONTAINS(str(?theme), '#{uri}'))
}
}")
-
- graph.query(vpd)
- end
- def verbose_annotations_query(graph:)
- # TODO: This does not respect vpdiscoverable...
- vpd = SPARQL.parse("
+ graph.query(vpd)
+ end
+
+ def verbose_annotations_query(graph:)
+ # TODO: This does not respect vpdiscoverable...
+ vpd = SPARQL.parse("
#{NAMESPACES}
SELECT DISTINCT ?annot WHERE
{ VALUES ?annotation { dcat:theme dcat:themeTaxonomy }
?s ?annotation ?annot .
}")
- graph.query(vpd)
- end
+ graph.query(vpd)
+ end
- def keyword_annotations_query(graph:)
- vpd = SPARQL.parse("
+ def keyword_annotations_query(graph:)
+ vpd = SPARQL.parse("
#{NAMESPACES}
select DISTINCT ?kw WHERE
- { VALUES ?searchfields { dc:keyword }
+ { VALUES ?searchfields { dc:keyword dcat:keyword }
?s ?searchfields ?kw .
}")
- graph.query(vpd)
-
- end
+ graph.query(vpd)
+ end
- def collect_data_services_query(graph:)
- vpd = SPARQL.parse("
+ def collect_data_services_query(graph:)
+ vpd = SPARQL.parse("
#{NAMESPACES}
@@ -119,6 +117,6 @@ def collect_data_services_query(graph:)
?s dc:type ?type .
}
}")
- graph.query(vpd)
- end
-
\ No newline at end of file
+ graph.query(vpd)
+ end
+end
diff --git a/VP/vp-interface/lib/configuration.rb b/VP/vp-interface/lib/configuration.rb
index 47e18b7..1f088a9 100644
--- a/VP/vp-interface/lib/configuration.rb
+++ b/VP/vp-interface/lib/configuration.rb
@@ -21,8 +21,9 @@ def get_active_sites(api:)
:headers => { accept: "application/json" },
:verify_ssl => false
)
- sites = JSON.parse(r.body).map { |s| s["clientUrl"] if s["state"] == "ACTIVE" }
+ sites = JSON.parse(r.body).map { |s| s["clientUrl"] if ["ACTIVE"].include? s["state"] }
sites.compact!
+ warn "FOUND SITES #{sites}"
sites
end
# {
diff --git a/VP/vp-interface/lib/services.rb b/VP/vp-interface/lib/services.rb
index ef5d074..1c439a9 100644
--- a/VP/vp-interface/lib/services.rb
+++ b/VP/vp-interface/lib/services.rb
@@ -177,7 +177,7 @@ def retrieve_endpoint(openapi:)
j = JSON.parse(resp)
j["servers"].each do |s|
s["url"].gsub!(%r{/$}, "")
- s["url"].gsub!(%r{^//}, "https://")
+ s["url"].gsub!(%r{^//}, "http://")
end
resp = j.to_json # back to json for the openapi3
begin
@@ -190,12 +190,16 @@ def retrieve_endpoint(openapi:)
# we are now scanning for the endpoint that was referenced in the FDP.
# if we don't find it, we fail! (politely!)
+ # need to deal with http vs https, since they get messed up in the openAPI3 conversion
+ endpointsuffix = @endpoint.to_s.gsub(/https?:/, "")
+
api.paths.each do |path, pathitem|
warn "path #{path}"
base = pathitem.servers.first.url
fullpath = base + path
- warn "testing #{fullpath} against #{@endpoint}|"
- unless fullpath == @endpoint # compare it to the endpoint that was in the FDP
+ fullpathsuffix = fullpath.gsub(/https?:/, "")
+ warn "testing #{fullpathsuffix} against #{endpointsuffix}|"
+ unless fullpathsuffix == endpointsuffix # compare it to the endpoint that was in the FDP
warn "TEST FAILED"
next
end
diff --git a/VP/vp-interface/lib/vp.rb b/VP/vp-interface/lib/vp.rb
index e1a952a..f48fb92 100644
--- a/VP/vp-interface/lib/vp.rb
+++ b/VP/vp-interface/lib/vp.rb
@@ -78,7 +78,7 @@ def find_discoverables
results = find_discoverables_query(graph: networkgraph)
discoverables = build_from_results(results: results)
- warn discoverables
+ warn "DISCOVERABLES", discoverables
discoverables
end
@@ -180,6 +180,24 @@ def execute_data_services(params:)
[downloadlocation, results]
end
+ def execute_data_services_api(json:)
+ # {uri: serviceuri,
+ # _request_body: {json: data},
+ # service_list: [endpoint, endpoint, endpoint]
+ # } # this is passed to all services
+ results = {}
+ json["service_list"].each do |ep|
+ endpoint = ep
+ if json["_request_body"]
+ result = Service::execute_post(endpoint: endpoint, body: params)
+ end
+ results[endpoint] = result.body if result
+ end
+ downloadlocation = process_and_upload_output(results: results) # in serviceoutput_processors/general.rb
+ [downloadlocation, results]
+ end
+
+
def match_type_to_icon(type:)
t = type.match(%r{[\#/](\w+?)$})[1].downcase.to_sym # anchor to end to capture last / or #
warn "matching #{t}\n\n"
diff --git a/VP/vp-interface/public/images/drug.png b/VP/vp-interface/public/images/drug copy.png
similarity index 100%
rename from VP/vp-interface/public/images/drug.png
rename to VP/vp-interface/public/images/drug copy.png
diff --git a/VP/vp-interface/public/images/flair-gg-logo copy.png b/VP/vp-interface/public/images/flair-gg-logo copy.png
new file mode 100644
index 0000000..7b747f1
Binary files /dev/null and b/VP/vp-interface/public/images/flair-gg-logo copy.png differ
diff --git a/VP/vp-interface/spec/application_controller_spec.rb b/VP/vp-interface/spec/application_controller_spec.rb
index d57710e..aa73a81 100644
--- a/VP/vp-interface/spec/application_controller_spec.rb
+++ b/VP/vp-interface/spec/application_controller_spec.rb
@@ -1,13 +1,15 @@
-require_relative "spec_helper"
+# frozen_string_literal: false
-def app
- ApplicationController
-end
+require_relative 'spec_helper' # this will load the app
+
+RSpec.describe 'ApplicationController', type: :request do
+ include Rack::Test::Methods
+ def app
+ ApplicationController
+ end
-describe ApplicationController do
- it "responds with a welcome message" do
- get '/'
- expect(last_response.status).to eq(200)
- expect(last_response.body).to include("Welcome to the Sinatra Template!")
+ it 'returns a list of all known resources' do
+ get '/flair-gg-vp-server/resources'
+ expect(last_response.status).to eq(406)
end
end
diff --git a/VP/vp-interface/spec/spec_helper.rb b/VP/vp-interface/spec/spec_helper.rb
index b686a1e..534ffa0 100644
--- a/VP/vp-interface/spec/spec_helper.rb
+++ b/VP/vp-interface/spec/spec_helper.rb
@@ -1,36 +1,52 @@
ENV["SINATRA_ENV"] = "test"
+ENV['RACK_ENV'] = "test"
require_relative '../config/environment'
+require 'rspec'
require 'rack/test'
-require 'capybara/rspec'
-require 'capybara/dsl'
+# require 'capybara/rspec'
+# require 'capybara/dsl'
-if ActiveRecord::Migrator.needs_migration?
- raise 'Migrations are pending. Run `rake db:migrate SINATRA_ENV=test` to resolve the issue.'
-end
-ActiveRecord::Base.logger = nil
+set :environment, :test
+set :run, false
+set :raise_errors, true
+set :logging, false
+
+module RSpecMixin
+ def app
+ ApplicationController
+
+ # App.new
+ end
+end
RSpec.configure do |config|
- config.run_all_when_everything_filtered = true
- config.filter_run :focus
+ config.tty = true
+ config.formatter = :documentation
config.include Rack::Test::Methods
- config.include Capybara::DSL
- DatabaseCleaner.strategy = :truncation
+ config.include RSpecMixin
+end
+# RSpec.configure do |config|
+# config.run_all_when_everything_filtered = true
+# config.filter_run :focus
+# config.include Rack::Test::Methods
+# config.include Capybara::DSL
+# DatabaseCleaner.strategy = :truncation
- config.before do
- DatabaseCleaner.clean
- end
+# config.before do
+# DatabaseCleaner.clean
+# end
- config.after do
- DatabaseCleaner.clean
- end
+# config.after do
+# DatabaseCleaner.clean
+# end
- config.order = 'default'
-end
+# config.order = 'default'
+# end
def app
Rack::Builder.parse_file('config.ru').first
end
-Capybara.app = app
+# Capybara.app = app