Skip to main content

Teacher Training Entitlement - importing_data

< Back to Navigation

  1. Importing schools
  2. Importing Private Childcare Provider data
  3. Importing Pupil Premium data

Importing schools

Locally

Open a Rails console and run ImportGiasSchools.new.call

Production

This occurs automatically on a daily basis through the Crons::UpdateSchoolsJob job.

This detects which schools have had their data updated and then only updates those schools, using the LastChangedDate column of the downloaded CSV to check for changes.

Schools not updating

There is an edge case that can occasionally lead to school data not updating when it should. This is due to the LastChangedDate column not being updated when a school has had their data updated multiple times in the same day as the column is a date and not a datetime. If a school changes once at 4am we would update the data at 5am and store the date of last change. If they then changed again at 12pm then the LastChangedDate would not update and we would not notice the change. If this occurs the school will not be updated until the next time their LastChangedDate changes. See below for how to update all schools.

Updating all schools

If you need to update all schools you can ignore the LastChangedDate and perform a full school refresh using refresh_all, e.g.:

ImportGiasSchools.new(refresh_all: true).call

Importing Private Childcare Provider data

See Acquiring New Private Childcare Provider data for how to acquire new data.

The import should be run on staging and production.

Open a rails console and run e.g. the following:

  • bundle exec rake 'private_childcare_providers:import[lib/private_childcare_providers/2024-12-31/childcare_providers.csv,childcare_providers]'
  • bundle exec rake 'private_childcare_providers:import[lib/private_childcare_providers/2024-12-31/childminder_agencies.csv,childminder_agencies]'

Importing Pupil Premium data

Open a Rails console and run the following:

  • SetHighPupilPremiums.new(path_to_csv: Rails.root.join("config/data/high_pupil_premiums_2021_2022.csv")).call