Bug #12861

Actor aliases and relations being dropped on CSV export

Added by Dan Gillean 3 months ago. Updated about 1 month ago.

Status:VerifiedStart date:03/05/2019
Priority:MediumDue date:
Assignee:Michelle Curran% Done:

0%

Category:CSV export
Target version:Release 2.5.0
Google Code Legacy ID: Tested version:2.4, 2.5
Sponsored:No Requires documentation:

Description

  • Find or create several authority records that have multiple aliases (in all fields: parallel, standard according to others, and other forms) - and relations (multiple types - hierarchial, temporal, associative, family).
  • Add all authorities to the clipboard
  • Go to the clipboard
  • Export the authority records as CSV
  • Open the relations and aliases CSV files included in the exported zip

Resulting error
Relations and alias data is only included for one entity.

Expected result
Relations and alias data is included for every actor exported

Notes

Reported by community user in 2.4; reproduced in 2.5 vagrant box on 2019-03-05. Possibly due to a loop function that is overwriting previous results, or some kind of badly formed array?

History

#1 Updated by Steve Breker 3 months ago

This is an architectural issue where the call to produce the alias and relations files here:

https://github.com/artefactual/atom/blob/qa/2.5.x/lib/flatfile/csvActorExport.class.php#L64

...is being called once per actor record in the report. This results in these relation and alias files being regenerated each time, each containing one actor's relations and aliases. The same filename is being used on each loop which results in the previous file containing the previous actor's relations and aliases files being overwritten.

E.g.: when exporting two actors with aliases, adding a log message inside of ::exportCompanionFile outputs:

Mar 06 10:52:36 symfony [err] SBSBSB exportCompanionFile:/tmp/565be7ff0e363e590443f3cd9b40cc53/0000000001_aliases.csv
Mar 06 10:52:36 symfony [err] SBSBSB exportCompanionFile:/tmp/565be7ff0e363e590443f3cd9b40cc53/0000000001_relations.csv
Mar 06 10:52:36 symfony [err] SBSBSB exportCompanionFile:/tmp/565be7ff0e363e590443f3cd9b40cc53/0000000001_aliases.csv
Mar 06 10:52:36 symfony [err] SBSBSB exportCompanionFile:/tmp/565be7ff0e363e590443f3cd9b40cc53/0000000001_relations.csv

Note that the filenames are the same on each loop. At the end of the run, these files will contain the details for the last actor in the main export spreadsheet.

This logic is triggered in the job here:
https://github.com/artefactual/atom/blob/qa/2.5.x/lib/job/arActorCsvExportJob.class.php#L102

I am assuming we want one actor output CSV and one file each for aliases and relations so that all exported actor details are included in the three files, as opposed to one alias and relation file per actor included in the actor export CSV.

#2 Updated by Mike Cantelon about 1 month ago

  • Assignee set to Mike Cantelon

#3 Updated by Mike Cantelon about 1 month ago

  • Status changed from New to Code Review
  • Assignee deleted (Mike Cantelon)

#4 Updated by Steve Breker about 1 month ago

  • Status changed from Code Review to Feedback

CR complete. Looks good!

#5 Updated by Mike Cantelon about 1 month ago

  • Status changed from Feedback to QA/Review

Merged into qa/2.5.x for QA.

#6 Updated by Michelle Curran about 1 month ago

  • Assignee set to Michelle Curran

#7 Updated by Michelle Curran about 1 month ago

  • Status changed from QA/Review to Verified

Verified on artefactual/atom and atom25qa vagrant boxes.

#8 Updated by Dan Gillean about 1 month ago

  • Target version set to Release 2.5.0

Also available in: Atom PDF