Skip to content

[3026] Round 2 FIGHT#1976

Draft
peterdavidhamilton wants to merge 3 commits intomainfrom
pdh/dqt-importers-updated
Draft

[3026] Round 2 FIGHT#1976
peterdavidhamilton wants to merge 3 commits intomainfrom
pdh/dqt-importers-updated

Conversation

@peterdavidhamilton
Copy link
Contributor

@peterdavidhamilton peterdavidhamilton commented Dec 23, 2025

Context

Second round of imported data into RIAB.

  • Import all teachers that have inductions and had finished training
  • Import any missing appropriate bodies
  • Import these teacher's sanitized induction periods
  • Generate accurate event histories for admin timelines

Considerations:

  • temporarily tagging imported data to segregate or test it

Changes proposed in this pull request

  • Revert Remove importer scripts #240 (57c48ab).
  • Update with main
  • Fix linting
  • Fix specs
  • Change to import remaining teachers / appropriate body periods / induction periods
  • Test against snapshot DB

Guidance to review

TBC

@github-actions
Copy link

Review app deployed to https://cpd-ec2-review-1976-web.test.teacherservices.cloud

- lint
- rename :event_type for claims/releases
- remove insertion of :local_authority_code and :establishment_number now in GIAS::School
- rename :legacy_id to :dqt_id
require "csv"

module AppropriateBodies::Importers
class AppropriateBodyImporter
Copy link
Contributor

@craigmdavidson craigmdavidson Jan 23, 2026

Choose a reason for hiding this comment

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

This isn't really an Importer, as it doesn't write anything? The import is done exclusively by the Importer class.

This class just provides the data to be imported, as such should, it might be more intention revealing if this class was named something like AppropriateBodyData? or if we wanted to be totally explicit AppropriateBodyFilteredImportData?

@trns_with_induction_periods = @induction_periods_grouped_by_trn.keys
@teacher_importer_rows = TeacherImporter.new(teachers_csv, @trns_with_induction_periods).rows_with_wanted_statuses

@active_abs = @induction_periods_grouped_by_trn.flat_map { |_trn, ips| ips.map(&:legacy_appropriate_body_id) }.uniq
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like @active_absis @unique_legacy_appropriate_bodies?


def import_ab_rows
Rails.logger.info("Active appropriate bodies: #{@active_abs.count}")
AppropriateBody.insert_all!(@ab_importer_rows.select { |r| r.dqt_id.in?(@active_abs) }.map(&:to_h))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not be filtering the @ab_importer_rows in the AppropriateBodyImporter as it already has the@active_abs to filter on?

@peterdavidhamilton peterdavidhamilton self-assigned this Feb 2, 2026
- disable importing admin users
@sonarqubecloud
Copy link

@@ -0,0 +1,41 @@
appropriate_body_csv = Rails.root.join("tmp/import/appropriatebody.csv") # 537
teachers_csv = Rails.root.join("tmp/import/teachers.csv") # 1_799_170
@@ -0,0 +1,41 @@
appropriate_body_csv = Rails.root.join("tmp/import/appropriatebody.csv") # 537
teachers_csv = Rails.root.join("tmp/import/teachers.csv") # 1_799_170
induction_period_csv = Rails.root.join("tmp/import/inductionperiods.csv") # 829_189
appropriate_body_csv = Rails.root.join("tmp/import/appropriatebody.csv") # 537
teachers_csv = Rails.root.join("tmp/import/teachers.csv") # 1_799_170
induction_period_csv = Rails.root.join("tmp/import/inductionperiods.csv") # 829_189
dfe_sign_in_mapping_csv = Rails.root.join("tmp/import/dfe-sign-in-mappings.csv") # 86
teachers_csv = Rails.root.join("tmp/import/teachers.csv") # 1_799_170
induction_period_csv = Rails.root.join("tmp/import/inductionperiods.csv") # 829_189
dfe_sign_in_mapping_csv = Rails.root.join("tmp/import/dfe-sign-in-mappings.csv") # 86
admin_csv = Rails.root.join("tmp/import/admins.csv") # 30
induction_period_csv = Rails.root.join("tmp/import/inductionperiods.csv") # 829_189
dfe_sign_in_mapping_csv = Rails.root.join("tmp/import/dfe-sign-in-mappings.csv") # 86
admin_csv = Rails.root.join("tmp/import/admins.csv") # 30
cutoff_csv = Rails.root.join("tmp/import/old-abs.csv") # 433
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.

2 participants