Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to Master merge, release v5.33.0 #167

Merged
merged 16 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API_URL=http://localhost:9393
ONTOLOGIES_LINKED_DATA_PATH=
GOO_PATH=
SPARQL_CLIENT_PATH=
ONTOPORTAL_KB=ontoportal_kb
REDIS_HOST=redis-ut
26 changes: 14 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
source 'https://rubygems.org'

gem 'activesupport', '~> 3.2'
gem 'activesupport', '~> 5'
# see https://github.com/ncbo/ontologies_api/issues/69
gem 'bigdecimal', '1.4.2'
gem 'bigdecimal'
# gem 'faraday', '~> 1.9'
gem 'json-schema', '~> 2.0'
gem 'multi_json', '~> 1.0'
gem 'oj', '~> 3.0'
gem 'multi_json'
gem 'oj'
gem 'parseconfig'
gem 'rack'
gem 'rake', '~> 10.0'
Expand Down Expand Up @@ -43,12 +43,12 @@ gem 'redcarpet'


# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'master'
gem 'ncbo_cron', github: 'ncbo/ncbo_cron', branch: 'master'
gem 'ncbo_ontology_recommender', github: 'ncbo/ncbo_ontology_recommender', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'
gem 'goo', github: 'ncbo/goo', branch: 'master'
gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'master'
gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'develop'
gem 'ncbo_cron', github: 'ncbo/ncbo_cron', branch: 'develop'
gem 'ncbo_ontology_recommender', github: 'ncbo/ncbo_ontology_recommender', branch: 'develop'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop'
gem 'goo', github: 'ncbo/goo', branch: 'develop'
gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'develop'


group :development do
Expand All @@ -72,7 +72,9 @@ group :profiling do
end

group :test do
gem 'minitest', '~> 4.0'
gem 'crack', '0.4.5'
gem 'minitest', '~> 5.0'
gem 'minitest-hooks', "~> 1.5"
gem 'minitest-stub_any_instance'
gem 'rack-test'
gem 'simplecov', require: false
Expand Down
83 changes: 46 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 2cec53c2d84179171def81d7dc0a18e462e78fc2
branch: master
revision: 74a012eebb9433d031eb00df5abbe488cb8b4512
branch: develop
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand All @@ -16,8 +16,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: 63c986880aa88c9384043e6611a682434a14aba7
branch: master
revision: b2731c98bfef0958fecb440c8648b7755a670895
branch: develop
specs:
ncbo_annotator (0.0.1)
goo
Expand All @@ -27,8 +27,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_cron.git
revision: 15ccdaa2835be9f35f9c3afdcc4ed5bf5d130999
branch: master
revision: b279f9caa9a6a169bad7350890d7015d56e9e9b2
branch: develop
specs:
ncbo_cron (0.0.1)
dante
Expand All @@ -45,8 +45,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_ontology_recommender.git
revision: 013abea4af3b10910ec661dbb358a4b6cae198a4
branch: master
revision: 084cfc74a78b1c6334f3b74e228ddbf80d36e30a
branch: develop
specs:
ncbo_ontology_recommender (0.0.1)
goo
Expand All @@ -56,8 +56,8 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: a9da0982eef16ea8272002d14d6b8851dc07fb0a
branch: master
revision: 812dd78f02b77c9c6d579b0febf1c2a42d513022
branch: develop
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand All @@ -76,8 +76,8 @@ GIT

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: e89c26aa96f184dbe9b52d51e04fb3d9ba998dbc
branch: master
revision: 1657f0dd69fd4b522d3549a6848670175f5e98cc
branch: develop
specs:
sparql-client (1.0.1)
json_pure (>= 1.4)
Expand All @@ -103,9 +103,11 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
activesupport (5.2.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.3)
Expand All @@ -116,7 +118,7 @@ GEM
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bigdecimal (1.4.2)
bigdecimal (3.1.8)
builder (3.3.0)
capistrano (3.19.1)
airbrussh (>= 1.0.0)
Expand All @@ -133,8 +135,7 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crack (1.0.0)
bigdecimal
crack (0.4.5)
rexml
cube-ruby (0.0.3)
dante (0.2.0)
Expand Down Expand Up @@ -174,7 +175,7 @@ GEM
google-cloud-core (1.7.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.2.0)
google-cloud-env (2.2.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-protobuf (3.25.5-aarch64-linux)
Expand All @@ -186,7 +187,7 @@ GEM
grpc (~> 1.41)
googleapis-common-protos-types (1.16.0)
google-protobuf (>= 3.18, < 5.a)
googleauth (1.11.0)
googleauth (1.11.1)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand All @@ -209,13 +210,13 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.7)
domain_name (~> 0.5)
i18n (0.9.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.2)
json-schema (2.8.1)
addressable (>= 2.4)
json_pure (2.7.2)
jwt (2.9.1)
jwt (2.9.3)
base64
kgio (2.11.4)
language_server-protocol (3.17.0.3)
Expand All @@ -229,11 +230,14 @@ GEM
net-pop
net-smtp
method_source (1.1.0)
mime-types (3.5.2)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0903)
mime-types-data (3.2024.1001)
mini_mime (1.1.5)
minitest (4.7.5)
minitest (5.25.1)
minitest-hooks (1.5.2)
minitest (> 5.3)
minitest-stub_any_instance (1.0.3)
mlanett-redis-lock (0.2.7)
redis
Expand All @@ -254,10 +258,12 @@ GEM
net-ssh (>= 5.0.0, < 8.0.0)
net-smtp (0.5.0)
net-protocol
net-ssh (7.2.3)
net-ssh (7.3.0)
netrc (0.11.0)
newrelic_rpm (9.13.0)
oj (3.16.1)
newrelic_rpm (9.14.0)
oj (3.16.6)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
omni_logger (0.1.4)
logger
os (1.1.4)
Expand Down Expand Up @@ -313,7 +319,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.7)
rexml (3.3.8)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand Down Expand Up @@ -369,10 +375,11 @@ GEM
ostruct
systemu (2.6.5)
temple (0.10.3)
thread_safe (0.3.6)
tilt (2.4.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo (1.2.11)
thread_safe (~> 0.1)
unicode-display_width (2.6.0)
unicorn (6.1.0)
kgio (~> 2.6)
Expand All @@ -395,27 +402,29 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activesupport (~> 3.2)
activesupport (~> 5)
bcrypt_pbkdf (>= 1.0, < 2.0)
bigdecimal (= 1.4.2)
bigdecimal
capistrano (~> 3)
capistrano-bundler
capistrano-locally
capistrano-rbenv
crack (= 0.4.5)
cube-ruby
ed25519 (>= 1.2, < 2.0)
ffi
goo!
haml (~> 5.2.2)
json-schema (~> 2.0)
minitest (~> 4.0)
minitest (~> 5.0)
minitest-hooks (~> 1.5)
minitest-stub_any_instance
multi_json (~> 1.0)
multi_json
ncbo_annotator!
ncbo_cron!
ncbo_ontology_recommender!
newrelic_rpm
oj (~> 3.0)
oj
ontologies_linked_data!
parseconfig
rack
Expand Down Expand Up @@ -447,4 +456,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.5.19
2.5.20
11 changes: 2 additions & 9 deletions controllers/recommender_v1_controller.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
class RecommenderController < ApplicationController
namespace "/recommender_v1" do

# execute an annotator query
# Mark this route as deprecated
get do
text = params["text"]
raise error 400, "A text to be analyzed by the recommender must be supplied using the argument text=<text>" if text.nil? || text.strip.empty?
acronyms = restricted_ontologies_to_acronyms(params)
display_classes = params['display_classes'].eql?('true') # default will be false
recommender = Recommender::Models::NcboRecommender.new
recommendations = recommender.recommend(text, acronyms, display_classes)
reply 200, recommendations
reply 410, { message: "This API endpoint has been deprecated and is no longer available. Please use /recommender or refer to the API documentation for updated routes." }
end

end
end

16 changes: 13 additions & 3 deletions controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,24 @@ class UsersController < ApplicationController
params["display"] = User.attributes.join(",") # used to serialize everything via the serializer
user = LinkedData::Models::User.where(email: email, username: username).include(User.goo_attrs_to_load(includes_param)).first
error 404, "User not found" unless user

user.bring(:resetToken)
user.bring(:resetTokenExpireTime)
user.bring(:passwordHash)

if token.eql?(user.resetToken)
error 401, "Invalid password reset token" if user.resetTokenExpireTime.nil?
error 401, "The password reset token expired" if user.resetTokenExpireTime < Time.now.to_i
user.resetToken = nil
user.resetTokenExpireTime = nil
user.save(override_security: true) if user.valid?
user.show_apikey = true
reply user

if user.valid?
user.save(override_security: true)
user.show_apikey = true
reply user
else
error 422, "Error resetting password"
end
else
error 401, "Password reset not authorized with this token"
end
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_annotator_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestAnnotatorController < TestCase

def self.before_suite
def before_suite
@@redis = Redis.new(:host => Annotator.settings.annotator_redis_host, :port => Annotator.settings.annotator_redis_port)
db_size = @@redis.dbsize
if db_size > MAX_TEST_REDIS_SIZE
Expand All @@ -25,7 +25,7 @@ def self.before_suite
annotator = Annotator::Models::NcboAnnotator.new
annotator.init_redis_for_tests()
annotator.create_term_cache_from_ontologies(@@ontologies, false)
mapping_test_set
self.class.mapping_test_set
end

def test_annotate
Expand Down
Loading