Skip to content

Etda Committee import integration#152

Merged
Joao Vitor Barros da Silva (jvitorbarros15) merged 41 commits into
mainfrom
etda-post-receiver
Apr 9, 2026
Merged

Etda Committee import integration#152
Joao Vitor Barros da Silva (jvitorbarros15) merged 41 commits into
mainfrom
etda-post-receiver

Conversation

@usmannsiddiqui
Copy link
Copy Markdown
Contributor

Closes #143
Closes #145
Close #132 - as a whole

Brief Technical Summary:

  • Adds client that pulls committee data from ETDA
  • Adds a job that handles the full integration from ETDA to fams_tools
  • Maps the committee roles to activity insight
  • Created the envrc.example in FAMS Tools for secrets template

   - 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
usmannsiddiqui and others added 7 commits March 19, 2026 11:52
- 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
Copy link
Copy Markdown
Contributor

@ajkiessl Alex Kiessling (ajkiessl) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Alex, removed.

Comment on lines +1 to +8
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just delete this migration file. Since it hasn't been deployed, we don't need to keep this at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

def change
change_table :committees, bulk: true do |t|
t.remove :degree_type, type: :string
t.remove :role_other_explanation, type: :text
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread db/schema.rb Outdated
Comment on lines +63 to +67
t.string "type_of_work"
t.string "stage_of_completion"
t.integer "start_year"
t.integer "completion_year"
t.text "type_other_explanation"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type_other_explanation needs removed. It should get removed when you run the migrations after the fixes I suggested.

Comment on lines 11 to 14
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) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add tests for the new db_columns we added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added column tests for type_of_work, stage_of_completion, start_year, completion_year

Comment thread .irb_history Outdated
Comment on lines +1 to +11
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed. I think the .gitignore got messed up. This file should be ignored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to gitignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this file is already committed, you'll have to remove it from git manually. Something like git rm path/to/file

Comment thread README.md Outdated
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`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this change got in here, but it can be reverted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted this.

@usmannsiddiqui
Copy link
Copy Markdown
Contributor Author

I have made all the changes that were requested, hopefully this should be good now!

Copy link
Copy Markdown
Contributor

@ajkiessl Alex Kiessling (ajkiessl) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more things

Comment thread .irb_history Outdated
Comment on lines +1 to +11
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this file is already committed, you'll have to remove it from git manually. Something like git rm path/to/file

Comment thread README.md

Add the following untracked files/folders:

* `config/database.yml` This will be similar to `config/database.yml.sample`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be added back, I just wanted you to remove the extra string quotes that were added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back the config/database.yml line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About .irb_history file. Removed it from git tracking with git rm --cached .irb_history

Comment thread Dockerfile Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to merge in main and resolve the conflict with the Dockerfile.

@ajkiessl Alex Kiessling (ajkiessl) marked this pull request as ready for review April 1, 2026 16:56
@ajkiessl
Copy link
Copy Markdown
Contributor

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?

@usmannsiddiqui
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

@ajkiessl Alex Kiessling (ajkiessl) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jvitorbarros15 Joao Vitor Barros da Silva (jvitorbarros15) merged commit 1476e5e into main Apr 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fams tools ETDA committee importer Map ETDA data to Activity Insight fields Pull data from ETDA and LionPATH for mentorship records

4 participants