Bug 5608 - Tool to move MARC21 series info to 490 tag
Summary: Tool to move MARC21 series info to 490 tag
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Michael Hafen
QA Contact: Paul Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 23:30 UTC by Michael Hafen
Modified: 2020-05-16 08:34 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
proposed patch to add command-line tool to migration_tools (3.22 KB, patch)
2011-01-11 23:31 UTC, Michael Hafen
Details | Diff | Splinter Review
New script which works properly (4.70 KB, patch)
2013-01-05 00:59 UTC, Michael Hafen
Details | Diff | Splinter Review
New patch which would pass QA tool (6.58 KB, patch)
2013-02-20 22:42 UTC, Michael Hafen
Details | Diff | Splinter Review
new patch to pass QA and with authorities linking option (7.54 KB, patch)
2013-02-21 22:47 UTC, Michael Hafen
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 5608 - command-line tool to switch information in 440 and 490 tags (6.71 KB, patch)
2013-02-25 19:14 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 5608 - command-line tool to switch information in 440 and 490 tags (7.67 KB, patch)
2013-02-25 19:14 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Proposed follow-up adding license statement (1.50 KB, patch)
2013-02-25 19:25 UTC, Michael Hafen
Details | Diff | Splinter Review
Proposed follow-up adding license and copyright statements (1.60 KB, patch)
2013-02-25 19:44 UTC, Michael Hafen
Details | Diff | Splinter Review
[SIGNED-OFF] Add license statement to switch_series_info CLI script (1.70 KB, patch)
2013-02-25 20:17 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[PASSED QA] Bug 5608 - command-line tool to switch information in 440 and 490 tags (6.77 KB, patch)
2013-03-21 16:00 UTC, Paul Poulain
Details | Diff | Splinter Review
[PASSED QA] Bug 5608 - command-line tool to switch information in 440 and 490 tags (7.72 KB, patch)
2013-03-21 16:00 UTC, Paul Poulain
Details | Diff | Splinter Review
[PASSED QA] Add license statement to switch_series_info CLI script (1.76 KB, patch)
2013-03-21 16:00 UTC, Paul Poulain
Details | Diff | Splinter Review
[PASSED QA] bug 5608 follow-up: exit immediately if UNIMARC (994 bytes, patch)
2013-03-21 16:00 UTC, Paul Poulain
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hafen 2011-01-11 23:30:21 UTC
With the MARC21 standard moving from the 440 to the 490 it would be nice to have to tool that would move information in the catalogue from the 440 to the 490.

I've written a tool that switches the information in the two tags for records found to have series information in the database.
Comment 1 Michael Hafen 2011-01-11 23:31:23 UTC Comment hidden (obsolete)
Comment 2 Michael Hafen 2011-01-31 21:59:48 UTC
Seems this tool isn't perfect.  Instead up updating fields it duplicates them.  Quite messy.  I've looked at it and can't tell what the problem is.  Someone smarter than me will have to fix it if it gets used.
Comment 3 Jared Camins-Esakov 2012-02-12 23:16:43 UTC
Marking "Failed QA" per Michael Hafen's last comment.
Comment 4 Jared Camins-Esakov 2013-01-02 02:36:58 UTC
Changing assignment and setting to ASSIGNED.
Comment 5 Michael Hafen 2013-01-05 00:59:59 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2013-01-12 05:16:22 UTC
Don't forget to set it to Needs Signoff Michael, or no one will notice it is ready to be tested :)
Comment 7 Bernardo Gonzalez Kriegel 2013-02-16 19:24:48 UTC
Michael, your second patch modify the first. So it's not supposed to be obsolete.
Comment 8 Bernardo Gonzalez Kriegel 2013-02-16 20:03:15 UTC
Michael, I tried your script.
Apparently it works, at last it moved data from 440 to 490.

But there is no indication of progress, nor command line options 
(at last -h or --help).

I think you are missing some of the indications in 
http://wiki.koha-community.org/wiki/Coding_Guidelines#Perl

Also, koha-qa complains about indentations.
Comment 9 Michael Hafen 2013-02-20 22:42:13 UTC Comment hidden (obsolete)
Comment 10 Bernardo Gonzalez Kriegel 2013-02-21 00:07:37 UTC
Two things:

a) Add "v" (verbose) option to usage

b) when running without arguments, it seems to run anyway.
Look at the last two lines. Is that ok?


bgkriegel@oak:~/kohaclone$ misc/migration_tools/switch_marc21_series_info.pl 
misc/migration_tools/switch_marc21_series_info.pl: switch MARC21 440 tag and 490 tag contents

Parameters:
    -c            Commit the changes to the marc records

    -m            Also update the Koha field to MARC framework mappings for the
                  seriestitle and volume Koha fields.

    --help or -h  show this message.

Examining MARC records...
There appears to be no series information to change
Comment 11 David Cook 2013-02-21 00:09:41 UTC
I like the idea behind this patch, Michael, but I don't think it is as comprehensive as it should be.

Take a look at the "Field Definition and Scope" and "Conversion to Current Fields" sections of the MARC 440 page provided by the Library of Congress (http://www.loc.gov/marc/bibliographic/bd440.html).

This page states that one should "concatenate field 440 subfields $a, $n and $p and place the new string into 490 subfield $a; and copy the content of 440 subfields $v, $x, $6, and $8 into the same subfields in field 490. Any additional subfields in field 440 do not convert to 490 but do convert to field 830."

The additional subfields from 440 are the authority-related $w and $x, which would go into field 830, because it is the field used to link the bib record with the "uniform title" authority record for that series.

--

Of course, not all libraries use authorities, so I think it would be useful to have a parameter that handles migrating the 440 to the 490, or migrating the 440 to the 490 AND the 830.

If the 440 goes to the 490, the first indicator for the 490 should be 0. If the 440 goes to the 490 and the 830, the first indicator for the 490 should be 1.
Comment 12 Michael Hafen 2013-02-21 22:42:27 UTC
(In reply to comment #10)
> Two things:
> 
> a) Add "v" (verbose) option to usage
> 
> b) when running without arguments, it seems to run anyway.
> Look at the last two lines. Is that ok?
> 
> 

I've added the 'v' option to usage.

When run without arguments it is supposed to look that way.  My thinking was that by showing the usage the user would know something wasn't right, and it would show the number of records that would be changed.  It might be confusing to some users though, so I'll add a line instructing them to run it with the 'c' option to make the changes.
Comment 13 Michael Hafen 2013-02-21 22:47:02 UTC Comment hidden (obsolete)
Comment 14 Bernardo Gonzalez Kriegel 2013-02-25 19:14:19 UTC Comment hidden (obsolete)
Comment 15 Bernardo Gonzalez Kriegel 2013-02-25 19:14:28 UTC Comment hidden (obsolete)
Comment 16 Michael Hafen 2013-02-25 19:25:45 UTC Comment hidden (obsolete)
Comment 17 Bernardo Gonzalez Kriegel 2013-02-25 19:40:18 UTC
Ok, but put your name in it :-)
Add a line 

# Copyright 2013 Michael Hafen <mdhafen@tech.washk12.org>
Comment 18 Michael Hafen 2013-02-25 19:44:30 UTC Comment hidden (obsolete)
Comment 19 Bernardo Gonzalez Kriegel 2013-02-25 20:17:21 UTC Comment hidden (obsolete)
Comment 20 Paul Poulain 2013-03-21 15:57:26 UTC
QA comment:
 * passes koha-qa.pl
 * I've added a tiny follow-up to exit immediately if the database is UNIMARC
 * no side effect risk, it's just a new script

passed QA
Comment 21 Paul Poulain 2013-03-21 15:58:29 UTC
mmm... just an additionnal comment, jared, your decision/confirmation = haven't we decided to remove
BEGIN {
    # find Koha's Perl modules
    # test carefully before changing this
    use FindBin;
    eval { require "$FindBin::Bin/../kohalib.pl" };
}

?
Comment 22 Paul Poulain 2013-03-21 16:00:25 UTC
Created attachment 16670 [details] [review]
[PASSED QA] Bug 5608 - command-line tool to switch information in 440 and 490 tags

With the MARC21 standard moving from the 440 tag to the 490, this tool is
to help libraries make the move.  It switches any information in 440 tags to
490 tags, and any information in 490 tags to 440 tags.  That seemed like the
best way to go to me.

To Test:
locate some biblios with 440 or 490 tags filled.
run bin/migration_tools/switch_marc21_series_info.pl -c
observe that the information in the biblios has switched 4xx tags.

http://bugs.koha-community.org/show_bug.cgi?id=5608
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Works as described. No errors.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 23 Paul Poulain 2013-03-21 16:00:30 UTC
Created attachment 16671 [details] [review]
[PASSED QA] Bug 5608 - command-line tool to switch information in 440 and 490 tags

With the MARC21 standard moving from the 440 tag to the 490, this tool is
to help libraries make the move.  It switches any information in 440 tags to
490 tags, and any information in 490 tags to 440 tags.  That seemed like the
best way to go to me.  There is also an option to create 830 tags for any 44
information, like authorities, that can't be represented in the 490 tag.

To Test:
locate some biblios with 440 or 490 tags filled.
run bin/migration_tools/switch_marc21_series_info.pl -c
observe that the information in the biblios has switched 4xx tags.

http://bugs.koha-community.org/show_bug.cgi?id=5608
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No errors.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 24 Paul Poulain 2013-03-21 16:00:35 UTC
Created attachment 16672 [details] [review]
[PASSED QA] Add license statement to switch_series_info CLI script

License and copyright statement added.
Thanks to Bernardo Gonzalez Kriegel for reminding me about this.

http://bugs.koha-community.org/show_bug.cgi?id=5608
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: add license information. No errors.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 25 Paul Poulain 2013-03-21 16:00:41 UTC
Created attachment 16673 [details] [review]
[PASSED QA] bug 5608 follow-up: exit immediately if UNIMARC

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 26 Jared Camins-Esakov 2013-03-22 02:16:31 UTC
This patch has been pushed to master.