diff --git a/Gemfile b/Gemfile index 1455483..43f0d19 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,8 @@ gem 'importmap-rails' # Build JSON APIs with ease [https://github.com/rails/jbuilder] gem 'jbuilder' +gem 'mitlibraries-theme', git: 'https://github.com/mitlibraries/mitlibraries-theme', tag: 'v1.0.2' + # Use the Puma web server [https://github.com/puma/puma] gem 'puma', '>= 5.0' @@ -71,9 +73,6 @@ group :development do # Add annotations to model, test, fixtures when run gem 'annotate' - # GraphQL query editor - gem 'graphiql-rails' - # RuboCop is a Ruby static code analyzer (a.k.a. linter) and code formatter. gem 'rubocop' gem 'rubocop-capybara' diff --git a/Gemfile.lock b/Gemfile.lock index f02f643..8f44cd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/mitlibraries/mitlibraries-theme + revision: bbd5bb9f8f977251651a41be47b59aa5bd1b22c1 + tag: v1.0.2 + specs: + mitlibraries-theme (1.0.2) + rails (>= 6, < 8) + sassc-rails (~> 2) + GEM remote: https://rubygems.org/ specs: @@ -121,9 +130,6 @@ GEM rake globalid (1.2.1) activesupport (>= 6.1) - graphiql-rails (1.9.0) - railties - sprockets-rails graphql (2.1.6) racc (~> 1.4) hashdiff (1.0.1) @@ -261,6 +267,14 @@ GEM ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt selenium-webdriver (4.15.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -286,6 +300,7 @@ GEM railties (>= 6.0.0) stringio (3.0.9) thor (1.3.0) + tilt (2.3.0) timeout (0.4.1) turbo-rails (1.5.0) actionpack (>= 6.0.0) @@ -327,11 +342,11 @@ DEPENDENCIES capybara debug dotenv-rails - graphiql-rails graphql http importmap-rails jbuilder + mitlibraries-theme! pg puma (>= 5.0) rails (~> 7.1.2) diff --git a/README.md b/README.md index 754ab4c..713a042 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,21 @@ -# tacos +# TACOS: Tool for Analyzing and Categorization Of Searchterms ## Required Environment Variables `LINKRESOLVER_BASEURL`: base url for our link resolver. `https://mit.primo.exlibrisgroup.com/discovery/openurl?institution=01MIT_INST&rfr_id=info:sid/mit.tacos.api&vid=01MIT_INST:MIT` is probably the best value unless you are doing something interesting. `UNPAYWALL_EMAIL`: email address to include in API call as required in their [documentation](https://unpaywall.org/products/api). Your personal email is appropriate for development. Deployed and for tests, use the timdex moira list email. + +## Documentation + +[Architecture Decisions](docs/architecture-decisions/) + +### Explanation/Overview + +[Work Activity Analysis](docs/explanation/work-activity-analysis.md) + +[Pattern Detection and Enhancement](docs/explanation/pattern_detection_and_enhancement.md) + +### Reference + +[Class Diagram](docs/reference/classes.md) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss similarity index 96% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index 288b9ab..dc0fc4f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ + +@import "libraries-main"; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..ba42844 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,3 @@ class ApplicationController < ActionController::Base + helper Mitlibraries::Theme::Engine.helpers end diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index b5c4574..923c431 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -4,7 +4,7 @@ class GraphqlController < ApplicationController # If accessing from outside this domain, nullify the session # This allows for outside API access while preventing CSRF attacks, # but you'll have to authenticate your user separately - # protect_from_forgery with: :null_session + protect_from_forgery with: :null_session def execute variables = prepare_variables(params[:variables]) @@ -14,10 +14,11 @@ def execute # Query context goes here, for example: # current_user: current_user, } - result = TacosSchema.execute(query, variables: variables, context: context, operation_name: operation_name) + result = TacosSchema.execute(query, variables:, context:, operation_name:) render json: result rescue StandardError => e raise e unless Rails.env.development? + handle_error_in_development(e) end diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb new file mode 100644 index 0000000..4d46687 --- /dev/null +++ b/app/controllers/static_controller.rb @@ -0,0 +1,3 @@ +class StaticController < ApplicationController + def index; end +end diff --git a/app/views/layouts/_site_nav.html.erb b/app/views/layouts/_site_nav.html.erb new file mode 100644 index 0000000..d6b2195 --- /dev/null +++ b/app/views/layouts/_site_nav.html.erb @@ -0,0 +1,14 @@ +
+
+
+

TACOS

+
+
+
+ +
+
+
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 1c65cf6..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,16 +0,0 @@ - - - - Tacos - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - - - <%= yield %> - - diff --git a/app/views/static/index.html.erb b/app/views/static/index.html.erb new file mode 100644 index 0000000..10b616c --- /dev/null +++ b/app/views/static/index.html.erb @@ -0,0 +1,27 @@ +<%= content_for(:title, "TACOS") %> + +
+
+
+

About TACOS

+ +

TACOS is an anonymous searchterm analysis system.

+ +

TACOS aims to be a combination of data collection of anonymous searchterms from our various systems, + algorithmic detection of patterns (such as ISSN, ISBN, DOI, PMID), data lookups of facts about detected + patterns, and a staff workflow to categorize searchterms our algorithmic approach cannot yet understand.

+ +

The hope is that TACOS will provide insight into what a user is intending to search for _before_ we ask a + traditional search system to process that search.

+ +
+ TACOS is coming soon! +
+
+
+ + + +
diff --git a/config/routes.rb b/config/routes.rb index 1b25c45..d9af329 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,14 +1,11 @@ Rails.application.routes.draw do - if Rails.env.development? - mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql" - end - post "/graphql", to: "graphql#execute" + post '/graphql', to: 'graphql#execute' # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. - get "up" => "rails/health#show", as: :rails_health_check + get 'up' => 'rails/health#show', as: :rails_health_check # Defines the root path route ("/") - # root "posts#index" + root to: 'static#index' end diff --git a/docs/reference/pattern_detection_and_enhancement.md b/docs/explanation/pattern_detection_and_enhancement.md similarity index 100% rename from docs/reference/pattern_detection_and_enhancement.md rename to docs/explanation/pattern_detection_and_enhancement.md diff --git a/public/playground.html b/public/playground.html new file mode 100644 index 0000000..6fe65eb --- /dev/null +++ b/public/playground.html @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + +
Loading...
+ + + +