Etda Committee import integration#152
Conversation
- Fill in all test cases using WebMock to stub HTTP responses - Fix RSpec.describe class name and capitalization - Fix auth header from Bearer token to X-API-KEY
Adds CommitteeData::EtdaImporter with import_all and import_for_faculty methods. Iterates over all faculty, calls the ETDA API client, and creates committee records. Error handling and tests still in progress.
- Add CommitteeData::EtdaImporter.new.import_all call to integrate method - Pass faculty object directly to import_for_faculty instead of access_id - Move import_for_faculty to private and fix access_id references
…nstead of a hash - Rename job to 'Committee Integration' - Use send(:name) in spec to test private method
- Fix stage_of_completion: 'In Progress' -> 'In Process' to match Activity Insight's valid dropdown values; add 'Withdrew' support - Add role_other_explanation and type_other_explanation DB columns for when role/type maps to 'Other' in Activity Insight - Improve map_type_of_work to use role context and handle more degree types (undergraduate, postdoc, honors) - Emit <ROLE_OTHER> and <TYPE_OTHER> XML tags when explanations present - Update all related specs
Alex Kiessling (ajkiessl)
left a comment
There was a problem hiding this comment.
I have a handful of small change requests. Otherwise, this looks very close to being done!
| xml.DSL do | ||
| xml.ROLE committee.role | ||
| xml.TYPE committee.type_of_work | ||
| xml.TYPE_OTHER committee.type_other_explanation if committee.type_other_explanation.present? |
There was a problem hiding this comment.
Can this be removed?
There was a problem hiding this comment.
Hey Alex, removed.
| class AddOtherExplanationFieldsToCommittees < ActiveRecord::Migration[7.2] | ||
| def change | ||
| change_table :committees, bulk: true do |t| | ||
| t.text :role_other_explanation, limit: 20_000 | ||
| t.text :type_other_explanation, limit: 20_000 | ||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
Let's just delete this migration file. Since it hasn't been deployed, we don't need to keep this at all.
| def change | ||
| change_table :committees, bulk: true do |t| | ||
| t.remove :degree_type, type: :string | ||
| t.remove :role_other_explanation, type: :text |
There was a problem hiding this comment.
Remove line 5 since we will completely delete the migration that adds this field. Also, is t.remove the idiomatic way to do this? Just curious where you got that from since I think I usually use remove_column.
There was a problem hiding this comment.
you're right, its good for big changes but in this case I was removing one column so I will change it back to remove_column.
| t.string "type_of_work" | ||
| t.string "stage_of_completion" | ||
| t.integer "start_year" | ||
| t.integer "completion_year" | ||
| t.text "type_other_explanation" |
There was a problem hiding this comment.
type_other_explanation needs removed. It should get removed when you run the migrations after the fixes I suggested.
| it { is_expected.to have_db_column(:student_lname).of_type(:string) } | ||
| it { is_expected.to have_db_column(:role).of_type(:string) } | ||
| it { is_expected.to have_db_column(:thesis_title).of_type(:string) } | ||
| it { is_expected.to have_db_column(:degree_type).of_type(:string) } | ||
| it { is_expected.to have_db_column(:faculty_id).of_type(:integer) } |
There was a problem hiding this comment.
We should add tests for the new db_columns we added.
There was a problem hiding this comment.
Added column tests for type_of_work, stage_of_completion, start_year, completion_year
| importer = CommitteeData::EtdaImporter.new | ||
| Committee.last.attributes | ||
| ENV['ETDA_API_URL'] | ||
| quit | ||
| importer = CommitteeData::EtdaImporter.new | ||
| Committee.last.attributes | ||
| importer.import_all | ||
| quit | ||
| importer = CommitteeData::EtdaImporter.new | ||
| importer.import_all | ||
| quit |
There was a problem hiding this comment.
This can be removed. I think the .gitignore got messed up. This file should be ignored.
There was a problem hiding this comment.
added to gitignore
There was a problem hiding this comment.
Since this file is already committed, you'll have to remove it from git manually. Something like git rm path/to/file
| Add the following untracked files/folders: | ||
|
|
||
| * `config/database.yml` This will be similar to `config/database.yml.sample` | ||
| * `'config/database.yml'` This will be similar to `config/database.yml.sample` |
There was a problem hiding this comment.
Not sure how this change got in here, but it can be reverted.
There was a problem hiding this comment.
deleted this.
…date specs and gitignore
|
I have made all the changes that were requested, hopefully this should be good now! |
Alex Kiessling (ajkiessl)
left a comment
There was a problem hiding this comment.
A couple more things
| importer = CommitteeData::EtdaImporter.new | ||
| Committee.last.attributes | ||
| ENV['ETDA_API_URL'] | ||
| quit | ||
| importer = CommitteeData::EtdaImporter.new | ||
| Committee.last.attributes | ||
| importer.import_all | ||
| quit | ||
| importer = CommitteeData::EtdaImporter.new | ||
| importer.import_all | ||
| quit |
There was a problem hiding this comment.
Since this file is already committed, you'll have to remove it from git manually. Something like git rm path/to/file
|
|
||
| Add the following untracked files/folders: | ||
|
|
||
| * `config/database.yml` This will be similar to `config/database.yml.sample` |
There was a problem hiding this comment.
This line should be added back, I just wanted you to remove the extra string quotes that were added.
There was a problem hiding this comment.
Added back the config/database.yml line
There was a problem hiding this comment.
About .irb_history file. Removed it from git tracking with git rm --cached .irb_history
There was a problem hiding this comment.
You'll need to merge in main and resolve the conflict with the Dockerfile.
|
Also, we need some logic in here to prevent imports of committees from before "some date". We don't want to import everything. Did we want to set the limit to committees that have started the approval process in the last 6 months? |
…racking, fix README
|
You're right about the setting the limit, I remember Nicole and Binky saying that we want to import people who started their approval process within a 6 month range. Added a new filter that rejects anything older than 6 months. etda_importer.rb: New private method within_last_six_months?, this will take a date string, returns false if blank, otherwise checks if the date is within the last 6 months using 6.months.ago. etda_importer_spec.rb: updated specs accordingly. |
…rror in spec - Changed logic for start_year in committee_xml_builder
1476e5e
into
main
Closes #143
Closes #145
Close #132 - as a whole
Brief Technical Summary: