scientist-softserv / ams

Archival Management System to support the American Archive of Public Broadcasting
GNU General Public License v3.0
1 stars 0 forks source link

Script to set number of intended children for all Assets #10

Open bkiahstroud opened 1 year ago

bkiahstroud commented 1 year ago

Story

PR

Ref

A "missing child" validation was added for Assets in https://github.com/scientist-softserv/dev-ops/issues/729. With the changes made for that ticket, all future XML imports/ingests will have each Asset count its number of intended children and save that number to be used later for validation. The purpose of this ticket is to do the same, except for existing Asset records.

A script needs to be written that will loop through all existing Assets and set both the :intended_children_count and :validation_status_for_aapb properties.

Acceptance Criteria

Testing Instructions

  1. After the script has been run, open a rails console
  2. Run ActiveFedora::SolrService.get('-intended_children_count_isi:[* TO *] has_model_ssim:Asset')['response']['numFound']. Verify the result is 0
  3. Run ActiveFedora::SolrService.get('-validation_status_for_aapb_tesim:[* TO *] has_model_ssim:Asset')['response']['numFound']. Verify the result is 0
  4. find a random Asset that has at least one child record
  5. Check the value of :intended_children_count. Make sure it is not nil or 0
  6. Check the value of :validation_status_for_aapb. Make sure it is not nil
  7. Repeat steps 4-6 five times
ShanaLMoore commented 1 year ago

Assigning @laritakr to this for follow up support per slack convo.

bkiahstroud commented 1 year ago

Needs Rework

orangewolf commented 10 months ago

this is blocked because I believe it will be done due to the resaving of every record, but we need to verify that.

orangewolf commented 10 months ago

@bkiahstroud now that we've been through most of the fedora -> pg migration, can you confirm if this still needs to be run or was it updated when we resaved the records?

bkiahstroud commented 10 months ago

@bkiahstroud now that we've been through most of the fedora -> pg migration, can you confirm if this still needs to be run or was it updated when we resaved the records?

@orangewolf assuming we're only concerned with Valkyrie records, I don't believe this needs to be run anymore.

# Count: Valkyrie Asset SolrDocuments that are missing a :intended_children_count_isi value
ActiveFedora::SolrService
  .get('has_model_ssim:Asset AND valkyrie_bsi:true AND -intended_children_count_isi:[* TO *]')
  .dig('response', 'numFound')
=> 0

# Count: Valkyrie Asset SolrDocuments that are missing a :validation_status_for_aapb_tesim value
ActiveFedora::SolrService
  .get('has_model_ssim:Asset AND valkyrie_bsi:true AND -validation_status_for_aapb_tesim:[* TO *]')
  .dig('response', 'numFound')
=> 0
bkiahstroud commented 9 months ago

@jillpe what's left to do here?