• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

boston-library / curator / #637973397

13 Feb 2026 04:03PM UTC coverage: 90.42%. First build
#637973397

Pull #390

travis-ci

Pull Request #390: rake task to update allmaps georeferencing status

22 of 25 new or added lines in 2 files covered. (88.0%)

5559 of 6148 relevant lines covered (90.42%)

461.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.36
/lib/tasks/allmaps_status.rake
1
# frozen_string_literal: true
2

3
namespace :curator do
1✔
4
  desc 'check Allmaps georeferencing status for cartographic materials and reindex'
1✔
5
  task allmaps_status: :environment do
1✔
6
    Rails.logger.info 'Running allmaps_status task, checking for newly georeferenced items...'
1✔
7
    data_resp = Faraday.get(Curator.config.allmaps_data_export_url)
1✔
8
    raise Curator::Exceptions::AllmapsAnnotationsUnavailable, 'COULD NOT PARSE ALLMAPS DATA EXPORT' unless data_resp.status == 200
1✔
9

10
    allmaps_data = JSON.parse(data_resp.body)
1✔
11
    regexp_pattern = /#{Curator.config.ark_manager_api_url}\/ark:\/50959\/[0-9a-z]{9}\/manifest/
1✔
12
    ark_ids = []
1✔
13
    # iterate over the data, find items with IIIF manifest links
14
    allmaps_data['items']&.each do |am_item|
1✔
15
      manifest_url = am_item.to_s.match(regexp_pattern).to_s
1✔
16
      ark_ids << "#{Curator.config.default_ark_params[:namespace_id]}:#{manifest_url.split('/')[-2]}" if manifest_url.present?
1✔
17
    end
18

19
    # reindex any items that are currently un-georeferenced,
20
    # query Solr, since we don't store Allmaps status in Curator data model
21
    solr = RSolr.connect(url: Curator.config.solr_url)
1✔
22
    q_params = %w(destination_site_ssim:nblmc hosting_status_ssi:hosted type_of_resource_ssim:Cartographic
1✔
23
                  curator_model_suffix_ssi:DigitalObject processing_state_ssi:complete -georeferenced_allmaps_bsi:true)
24
    resp = solr.get('select', params: { q: q_params.join(' AND '), rows: 50_000, fl: 'id' })
1✔
25
    nongeorefd = resp.dig('response', 'docs')&.map { |doc| doc['id'] }
1✔
26

27
    ark_ids.uniq.each do |ark_id|
1✔
28
      next unless nongeorefd.include?(ark_id)
1✔
29

NEW
30
      Rails.logger.info "Reindexing #{ark_id} to update georeferencing status"
×
NEW
31
      Curator.digital_object_class.find_ark(ark_id).queue_indexing_job
×
NEW
32
    end
×
33
    Rails.logger.info 'allmaps_status task completed.'
34
  end
1✔
35
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc