Skip to content

Commit

Permalink
Merge pull request #48 from CoralineAda/diagnose-orphan-codes
Browse files Browse the repository at this point in the history
Diagnose orphan codes
  • Loading branch information
CoralineAda authored Jun 17, 2024
2 parents 53cd629 + e415b71 commit fee5e52
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 48 deletions.
15 changes: 5 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ source "https://rubygems.org"

ruby "3.2.2"

# TMI-specific
gem 'sidekiq'

gem 'pry', groups: [:development, :test]

gem 'dotenv', groups: [:development, :test]

# OpenAI for GPT-4
gem 'ruby-openai'

# Neo4j
gem 'activegraph', '11.5.0.beta.3'
gem 'neo4j-ruby-driver'

Expand All @@ -31,16 +26,16 @@ gem "pg"
gem "puma", ">= 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# gem "importmap-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# gem "stimulus-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# gem "jbuilder"

# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"
Expand Down
17 changes: 0 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,11 @@ GEM
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
io-event (1.5.1)
irb (1.12.0)
rdoc
reline (>= 0.4.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.7.1)
loofah (2.22.0)
crass (~> 1.0.2)
Expand Down Expand Up @@ -298,17 +291,11 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
strscan (3.1.0)
thor (1.3.1)
timeout (0.4.1)
timers (4.3.5)
turbo-rails (2.0.5)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (0.13.0)
Expand Down Expand Up @@ -340,8 +327,6 @@ DEPENDENCIES
capybara
debug
dotenv
importmap-rails
jbuilder
neo4j-ruby-driver
pg
pry
Expand All @@ -353,8 +338,6 @@ DEPENDENCIES
selenium-webdriver
sidekiq
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
web-console

Expand Down
1 change: 1 addition & 0 deletions app/jobs/category_extractor_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class CategoryExtractorJob
queue_as :default

def perform(context)
Rails.logger.info("CategoryExtractorJob running with context #{context}")
Category.from(context)
end

Expand Down
1 change: 1 addition & 0 deletions app/jobs/export_to_graph_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ExportToGraphJob

def perform(id)
return unless record = SurveyResponse.find(id)
Rails.logger.info("ExportToGraphJob running with survey response ID #{id}")
record.to_graph
end

Expand Down
1 change: 1 addition & 0 deletions app/jobs/keyword_extractor_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class KeywordExtractorJob
queue_as :default

def perform(context)
Rails.logger.info("KeywordExtractorJob running with context #{context}")
Keyword.from(context)
end

Expand Down
1 change: 1 addition & 0 deletions app/models/code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Code

validates :name, presence: true
validates :context, presence: true
validates_uniqueness_of :name, :scope => :context

has_many :out, :personas, rel_class: :Experiences
has_many :in, :categories, rel_class: :CategorizedAs
Expand Down
1 change: 0 additions & 1 deletion app/models/persona.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Persona
validates :name, presence: true
validates :survey_response_id, presence: true

has_many :out, :themes, rel_class: :RelatesTo, dependent: :delete_orphans
has_many :out, :codes, rel_class: :Experiences, dependent: :delete_orphans
has_many :out, :identities, rel_class: :IdentifiesWith, dependent: :delete_orphans
has_many :out, :keywords, rel_class: :ReflectsOn, dependent: :delete_orphans
Expand Down
9 changes: 0 additions & 9 deletions app/models/relates_to.rb

This file was deleted.

5 changes: 4 additions & 1 deletion app/models/survey_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ def identifier
self.id.to_s.rjust(4, "0")
end

def enqueue_keyword_extraction
KeywordExtractorJob.perform_async(self.id)
end

def enqueue_export_to_graph
ExportToGraphJob.perform_async(self.id)
KeywordExtractorJob.perform_async(self.id)
end

def to_graph
Expand Down
10 changes: 0 additions & 10 deletions app/models/theme.rb

This file was deleted.

0 comments on commit fee5e52

Please sign in to comment.