Generating a list of slugs and reference codes

94 views
Skip to first unread message

Anna Mcnally

unread,
Sep 15, 2021, 9:16:24 AM9/15/21
to AtoM Users
Hi all,

we've recently upgraded to AtoM 2.6 and are having a few issues with reference codes and slugs not matching up, even though the slugs should be generated from the reference codes. In the records where we're having issues, it is usually the slug that is actually correct and the reference code that is incorrect. Therefore we'd ideally we'd like to generate a spreadsheet with a list of all the slugs and reference codes side by side, so that we could identify where the issues are. is there any way of doing this either a)within the the user interface or b)via the command line?
Many thanks,

Anna McNally
University of Westminster Archive

Dan Gillean

unread,
Sep 15, 2021, 2:55:16 PM9/15/21
to ICA-AtoM Users
Hi Anna, 

If you're willing to make a temporary local code change, then CSV export might be the easiest option to get what you need. 

The CSV export already includes a column with the full reference code. This is ignored during import since reference codes are built via inheritance, but is intended for exactly this kind of purpose on export. 

As for the slugs - we are adding a slug column on export in 2.7 for very similar reasons. You can see the issue ticket here: 
If you follow the link in the comments to the related pull request, you can see that adding this support is actually dead simple:
I think the easiest method then would to try making this change in your local instance, and then exporting what you need. Seems simpler to me than trying complicated SQL queries! 

Of course, if you'll be doing this on a production installation, we always strongly recommend making backups before making any kind of code changes! 

Cheers, 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him


This message and its attachments are private and confidential. If you have received this message in error, please notify the sender and remove it and its attachments from your system.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/2bff7b2e-3fca-4d00-ba10-ca6643a57789n%40googlegroups.com.

Simon (der_smon)

unread,
Dec 15, 2023, 8:11:39 AM12/15/23
to AtoM Users
Hi Dan!

I managed to export the slug in our 2.6 installation with the code/configuration change you mentioned. But I do not see the full reference code anywhere in my export: What column should I look for?

Regards
Simon

Dan Gillean

unread,
Dec 15, 2023, 9:35:26 AM12/15/23
to ica-ato...@googlegroups.com
Hi Simon, 

Very strange - generally, there should be a column on archival description exports called referenceCode. This column is ignored on import, since reference codes in AtoM are built using inheritance from parent descriptions and the repository code, etc. How are you running the export - via the command-line, or the user interface? They should be the same, but there is a small chance that for some reason they are not.... you might try running an export from the source you are not currently using (e.g. if you were running CLI exports, try adding some descriptions to the clipboard and exporting via the user interface including all descendants - or vice versa) to compare them. 

Given that 2.7.0 and later now should include both the reference code AND the slug on export as Anna was originally looking for in a CSV, one option might be to upgrade to the latest version (2.7.3) - or, if the need isn't urgent, you could until the new year as AtoM 2.8 should be released in early 2024. 

Finally, you could try double-checking your settings and running some maintenance tasks once more, to see if it helps. Some considerations: 
  • If the SLUGS seem more correct than the reference codes, then perhaps there is an issue with the nested set, which helps manage hierarchical relations in the relatively flat, table-like structure of the SQL database. You can try rebuilding the nested set, clearing caches, restarting PHP-FPM, and repopulating the search index to see if it resolves the issue
  • If you are using slashes in your reference codes (either forward or backward slashes - / or \ ), these will NOT be recreated when generating the slug, as these are reserved characters in URIs
  • Double-check that reference code inheritance is turned on in the settings, and review the docs so you are clear on how it works 
  • To ensure the closest match between slugs and reference codes, you should probably make sure that the setting to use any valid URI character in slug generation is enabled if it's not already
  • Double-check the Generate description permalinks from setting for descriptions as well - there are at least 2 different options for generating from the reference code that can influence the outcome
  • Spot check some description hierarchies with your permalink generation setting in mind. Keep in mind that if some intermediary levels of description do not have identifiers, then that will impact how reference code inheritance works, and could lead to unexpected outcomes if there are multiple intermediary levels without identifiers. Similarly, if you are generating permalinks / slugs from the reference code INCLUDING the repository country code and identifier, but your repository record lacks a country in the address or an identifier, this could also lead to a mismatch. 
  • Make sure you run the nested set rebuild task and have checked your settings before trying the slug generation task again
  • When you do run the slug generation task, be sure to use the --delete option - otherwise it will ONLY update records that are missing a slug
That's all I can really think of for now! Apologies if all of the above is obvious and things you have already tried or are aware of - just trying to rule out possible causes. Let us know how it goes!

Cheers, 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him

Simon (der_smon)

unread,
Dec 15, 2023, 10:25:00 AM12/15/23
to AtoM Users
Thanks, I will have a look at your suggestions. I am not quite sure if I want to recreate the slugs - that may basically recreate URLs for certain datasets, right?

I use the command line interface. Side note: When I try to export everything, I get an error, see https://groups.google.com/g/ica-atom-users/c/vXIB6xHK3o4.

"Inherit reference code (information object)" is active.

Dan Gillean

unread,
Dec 15, 2023, 11:26:35 AM12/15/23
to ica-ato...@googlegroups.com
Hi Simon, 

Thanks, I will have a look at your suggestions. I am not quite sure if I want to recreate the slugs - that may basically recreate URLs for certain datasets, right?

If you run the task with no options, it will only generate slugs for records that are missing them - so if you are having issues, I would recommend trying this as one of the steps to remedy common issues. 

If you run the task with the --delete option, then YES - it will delete all existing slugs before recreating them. This setting will respect your "generate permalink" settings, so if you have set that to use the reference code, then it will use the reference code to try to generate new slugs. However, any slugs you have individually customized (such as via the Rename module, or using SQL or some other method) would be overwritten in the process

I use the command line interface. Side note: When I try to export everything, I get an error, see https://groups.google.com/g/ica-atom-users/c/vXIB6xHK3o4.

Okay, I will take a look at that thread and respond there. 

Cheers,  
 
Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him

Reply all
Reply to author
Forward
0 new messages