-
Notifications
You must be signed in to change notification settings - Fork 2
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
2024 07 04 ai and form fields #211
Merged
Merged
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
edf4aed
turns out getting the assistants API to work is a little bit of a lar…
Ches-ctrl fefdd88
ca marche!
Ches-ctrl 024d58e
updates to outputs
Ches-ctrl 4c425f3
update sidekiq
Ches-ctrl f6f26e3
update seeds
Ches-ctrl ba89b4b
puts & pretty_generate
Ches-ctrl ba6269c
we're getting somewhere
Ches-ctrl 35f6852
getting there
Ches-ctrl 2c2f05d
old file for now
Ches-ctrl ed0c5f0
better
Ches-ctrl dfb4bd1
updates and deletions
Ches-ctrl f4885be
comparing against old code
Ches-ctrl 4d7c121
handle additional field sets
Ches-ctrl eac7d94
updating
Ches-ctrl f228418
delete capybara scrape
Ches-ctrl 8acc5ca
add pretty generate
Ches-ctrl fb77e74
getting the fields from the API is ridiculously easier
Ches-ctrl 9741f92
add old method in case
Ches-ctrl a3f5153
add testing rake task
Ches-ctrl fa05929
call service class for fields
Ches-ctrl dc6f051
update api comments
Ches-ctrl 0447c21
pass job variable to gff
Ches-ctrl 83b2c75
Setup testing
Ches-ctrl 4c24552
setup for testing and add missing fields
Ches-ctrl 95da870
add iframe for original link to job posting
Ches-ctrl 1fafec8
remove iframe for now
Ches-ctrl e10cdc2
slight format update
Ches-ctrl bf9af52
add temporary link to original posting
Ches-ctrl 3e24014
Add GetApiFieldsJob & fix seed
patanj101 47e0e81
get rid of getformfields
Ches-ctrl cba13af
call getapifields
Ches-ctrl 8f7389d
create classs to inherit from
Ches-ctrl 13ec639
Merge branch '2024-07-04-ai-and-form-fields' of github.com:Ches-ctrl/…
Ches-ctrl 136c938
update empty file
Ches-ctrl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Importer | ||
class GetApiFieldsJob < ApplicationJob | ||
include Sidekiq::Status::Worker | ||
|
||
queue_as :importers | ||
sidekiq_options retry: false | ||
|
||
def perform(job) | ||
Importer::GetApiFields.call(job) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Importer | ||
# Core class for getting form fields directly from the API | ||
# Splits based on category of fields - main, custom, demographic, eeoc | ||
# Known Issues - Building the checkbox logic for the data_compliance section | ||
# Allowable file types (Greenhouse): (File types: pdf, doc, docx, txt, rtf) | ||
# NB. Must include all params to get additional fields from the API | ||
class GetApiFields < ApplicationTask | ||
include FaradayHelpers | ||
|
||
def initialize | ||
# @job = job | ||
# @url = @job.api_url | ||
@url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/4628944002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/7301308002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/monzo/jobs/6076740" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/axios/jobs/6009256" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/11fs/jobs/4060453101" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/forter/jobs/7259821002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/4628944002" | ||
@url += "?questions=true&location_questions=true&demographic_questions=true&&compliance=true&pay_transparency=true" | ||
# @ats_sections = %w[main_fields custom_fields demographic_questions eeoc_fields data_compliance security_code_fields] | ||
@fields = {} | ||
@errors = false | ||
end | ||
|
||
def call | ||
return unless processable | ||
|
||
process | ||
rescue StandardError => e | ||
Rails.logger.error "Error running GetFormFields: #{e.message}" | ||
nil | ||
end | ||
|
||
private | ||
|
||
def processable | ||
@url # && @job | ||
end | ||
|
||
def process | ||
p "Hello from GetApiFields!" | ||
|
||
json = fetch_json(@url) | ||
return unless json | ||
|
||
@fields['main_fields'] = json['questions'] | ||
@fields['demographic_questions'] = json['demographic_questions'] | ||
@fields['location_questions'] = json['location_questions'] | ||
@fields['data_compliance'] = json['data_compliance'] | ||
|
||
puts pretty_generate(@fields) | ||
@fields | ||
end | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JB suggested I take a look and offer suggestions. Here are a few thoughts I had:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is helpful context thanks Dan - noted on the updates to the Faraday helper and also calling with job_data instead - ideally we do this as you note (we'll need to build the URL carefully for Greenhouse in this case as perhaps we'll sometimes want to pass the additional params and sometimes not? Keen to discuss / hear thoughts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a note on this - we can add further customisation into how Faraday makes the connection than what we're doing at the moment - think we might want to bring this in in future so just noting (e.g. custom user agent, proxy etc.)