EPrints Technical Mailing List Archive

Message: #09154


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] ChatGPT


Updating the Perl Doc in the codebase so the wiki can be subsequently updated has been one of my background tasks for some time.  Unfortunately, it is slow progress, mainly as there is always something more important and/or urgent that needs doing.

Beyond that, I have been trying to tidy up the wiki and clear out some of the clutter.  I feel I have barely scraped the surface of this. Using the wiki special pages to find some useful entry points to tackle things has hopefully meant that I have got the best "bang for my buck". 

Any suggestions on quick-ish tasks/fixes to improve the wiki to make it easier to use are welcome. Over the last year I put extensive effort adding and/or improving the following pages (some that I have mentioned on this list before), which I hope to be useful:

https://wiki.eprints.org/w/EPrints_Glossary
https://wiki.eprints.org/w/Category:EPrints_Directory_Structure -  Category for pages describing directories within the EPrints codebase and the purpose of their files and sub-directories.
https://wiki.eprints.org/w/Admin - Describes a repository's admin page with sub-pages for its tabs and buttons.
https://wiki.eprints.org/w/Listings_of_User_Roles_and_Privileges
https://wiki.eprints.org/w/Apache_Hardening
https://wiki.eprints.org/w/EPrints_and_SELinux

On 08/01/2023 6:25 pm, Christopher Gutteridge via Eprints-tech wrote:

So, it seems that EPrints is well documented enough online that ChatGPT can write simple EPrints scripts and functions. I'm frankly astounded at what this tool can do. It can't do complex stuff but it's still impressive.



Christopher Gutteridge
PROMPT:
please suggest a perl script to operate on an EPrints repository. It should find all the records with no title and set the title to "NO TITLE".


#!/usr/bin/perl

use EPrints;

Initialize the repository

my $repo = EPrints->new->repository('your_repository_id');

Find all records with no title

my $records = $repo->search({ match => 'AND', filters => [ { meta_fields => [ 'title' ], value => '', match => 'EQ' }, ], });

Set the title of each record to "NO TITLE"

foreach my $record ($records->get_records) {

$record->set_value('title', 'NO TITLE');

$record->commit;

}

print "Finished setting titles of records with no title to 'NO TITLE'\n";

-- 
Christopher Gutteridge, Research Application Support, University of Southampton

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/