[Koha-bugs] [Bug 34828] Add Koha::MetadataExtractor class
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Oct 5 12:45:11 CEST 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34828
Jonathan Druart <jonathan.druart+koha at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #155907|0 |1
is obsolete| |
--- Comment #10 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Created attachment 156565
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=156565&action=edit
Bug 34828: Introduce Koha::MetadataExtractor and ->get_normalized_upc
This patch introduces a new pattern for the different ->get_<thing>
methods we've been adding. The aim is that code will look more like:
my $metadata_extractor = Koha::MetadataExtractor->new;
while ( my $biblio = $biblios->next ) {
my $record = $biblio->record;
my $schema = $biblio->record_schema;
$data->{$biblio->id}->{normalized_upc} =
$metadata_extractor->get_normalized_upc( { record => $record, schema =>
$schema } );
$data->{$biblio->id}->{normalized_ean} =
$metadata_extractor->get_normalized_ean( { record => $record, schema =>
$schema } );
}
The key is that we are actually reusing the MARC::Record, and code for
each schema is organized cleanly so easier to maintain.
For the class names, I chose to add the 'MARC' name in the path, so we
don't need to refactor anything if we want to add support for another
serialization formats.
To test:
1. Apply this patch
2. Run:
$ ktd --shell
k$ qa -c 1
=> SUCCESS: Tests pass!
3. Sign off :-D
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list