```ruby
require 'organisation_importer'

namespace :organisations do

  desc "Imports organisations from the data.gov.uk hierarchy"
  task :import => :environment do
    response = Net::HTTP.get_response("data.gov.uk","/api/action/group_tree?type=organization")
    json = JSON.parse(response.body)
    results = json['result']
    puts "#{results.length} top level organisations found"
    OrganisationImporter.populate(results)
  end
  
end```

Add rake task to be called by heroku scheduler
user
```ruby
require 'organisation_importer'

namespace :organisations do

  #work around that heroku schedule only allows up to daily
  task :weekly_import => :environment do
    if Time.now.monday?
      Rake::Task["organisations:import"].execute
    end    
  end
  
  desc "Imports organisations from the data.gov.uk hierarchy"
  task :import => :environment do
    response = Net::HTTP.get_response("data.gov.uk","/api/action/group_tree?type=organization")
    json = JSON.parse(response.body)
    results = json['result']
    puts "#{results.length} top level organisations found"
    OrganisationImporter.populate(results)
  end
  
end```
assistant