[Koha] FW: MIGRATING A CDS/ISIS BASED SYSTEM TO KOHA

Mbangi Mlandeli Douglas dmbangi at fctve.ce.ac.bw
Tue Oct 7 09:35:14 UTC 2008


Good day Baiju,

I hope I'm not asking too much with the problem below. Are you making any progress with it?

Please help us. We are still stuck here and are not able to progress at the moment.

Regards,
Douglas
________________________________
From: Mbangi Mlandeli Douglas
Sent: 29 September 2008 11:12
To: baijum81 at hailmail.net
Cc: Koha at lists.katipo.co.nz
Subject: FW: MIGRATING A CDS/ISIS BASED SYSTEM TO KOHA

Good day,

Just making a follow up to check if anyone has managed to help find a solution to the issue below.

Best regards,
Douglas
________________________________
From: Mbangi Mlandeli Douglas
Sent: 25 September 2008 12:15
To: baijum81 at hailmail.net
Cc: Koha at lists.katipo.co.nz
Subject: MIGRATING A CDS/ISIS BASED SYSTEM TO KOHA

Good day,

Please help us migrate our records from CDS/ISIS (version 1.5) into Koha (2.2.9). A sample of our records is found in the attached FCTVEMIG.XML whilst a definition of our tags is in Tag Meanings.txt.
We converted our tags to suit those in the cmftf script for migrating book data. We then managed to convert our xml file to tab delimited text format using the attached cdiffctve.py (amended ciddtf.py). But when we tried running the attached cdismafctve.pl (amended cfmftf.pl) on the resultant text file, our output file had nothing in it.

We attempted to add the following tags to your script (cmftf) since they were not there:
25 ($itemtype_25_942_c)
60 ($isbn_60_020_a)
70 ($subject_70_650_a)
80 ($recordedby_80_946_a)

Please kindly assist us.

Regards
Douglas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.katipo.co.nz/pipermail/koha/attachments/20081007/448e9eb9/attachment.htm>
-------------- next part --------------

114	Class No
691	Accession Number
18	Author
4	Title
25	Item Type (MARC21 942c)
7	Edition
12	Place of Publication
11	Publisher
13	Date of Publication
10	Extent
110	Volume
60	ISBN (MARC21 020a)
151	Replacement Price
70	Subject (MARC21 650a) If it appears more than once, just join the entries and make them one entry.
20	Additional Authors
80	Recorded by (MARC21 946)
122	Date of Record

We attempted to add the following tags to your script since they were not there:
25 ($itemtype_25_942_c)
60 ($isbn_60_020_a)
70 ($subject_70_650_a)
80 ($recordedby_80_946_a)




		
-------------- next part --------------
##Before Parsing :
##Change  RECORDX\xc3\x91_5\xc3\xaf\x03\x12  to RECORD
##Change & to and
##fix problems of <Tag_97> manualy.

import libxml2

record = []

def Record(i, node):
    sub_node = node.children
    while sub_node is not None:
        if sub_node.type == "element":
            record[i][sub_node.name] = sub_node.get_content()
            sub_node = sub_node.next
        else:
            sub_node = sub_node.next

# Memory debug specific
libxml2.debugMemory(1)
 
isis_data = libxml2.parseFile ('/root/fctvet.xml')
root = isis_data.getRootElement()
node = root.children
i = 0
while node is not None:
    if node.type != "element":
        node = node.next
        continue
    if node is None:
        break
    if node.name == "RECORD":
        ##print node.get_content()
        record.append({})
        Record(i, node)
        i = i + 1
        node = node.next
    else:
        print "unhandled node in <isis_xml>: " + node.name

isis_data.freeDoc()

# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
    print "OK"
else:
    print "Memory leak %d bytes" % (libxml2.debugMemory(1))
    libxml2.dumpMemory()

####################################################################

record_file = open('/root/fctveout.txt', 'w')
tag = ['Tag_4', 'Tag_7', 'Tag_11', 'Tag_12', 'Tag_13', 'Tag_25', 'Tag_60', 'Tag_70', 'Tag_80', 'Tag_18', 'Tag_19', 'Tag_20', 'Tag_21', 'Tag_24', 'Tag_38', 'Tag_10', 'Tag_114', 'Tag_115', 'Tag_110', 'Tag_5', 'Tag_122', 'Tag_97', 'Tag_151', 'Tag_153', 'Tag_123']

for j in record:
    if j.has_key('Tag_691'):
        record_file.write(j['Tag_691'])
##Check docs without 114 tag
##         if j.has_key('Tag_114'):
##             pass
##         else:
##             print j['Tag_691']
    else:
        record_file.write('_B_L_A_N_K_')
    for h in tag:
        if j.has_key(h):
            record_file.write('\t'+j[h])
        else:
            record_file.write('\t_B_L_A_N_K_')
    record_file.write('\n')
-------------- next part --------------
package cmftf;
## Create MARC From Text File
## Copyright 2004 Baiju M <baijum81 at hailmail.net>
## This program is licensed under GNU GPL.

use strict;
use MARC::Record;

my $input_file = "/root/fctveout.txt";
my $output_file = "/root/fctvef.out";
my $repeated_items = " ";
open(INFILE, $input_file) or die "Can't open $input_file: $!";
open(OUTFILE, ">>", $output_file) or die "Can't open $output_file: $!";
my $c = 0;
while (<INFILE>) {
    $c++;
    my $biblionumber_ftf_691_090_c, my $title_ftf_4_245_a, my $edition_ftf_7_250_a, my $publisher_ftf_11_260_b, my $publishcountry_ftf_12_260_a, my $publishyear_ftf_13_260_c, my $author1ee_ftf_18_100_a, my $author1se_ftf_19_100_a, my $author2ee_ftf_20_700_a, my $author2se_ftf_21_700_a, my $adiauthors_ftf_24_700_a, my $itemtype_ftf_25_942_c, my $role_ftf_38_590_a, my $phydescr_ftf_10_300_a, my $classno_ftf_114_852_k, my $classno_ftf_115_852_h, my $keyword_ftf_5_520_a, my $voldetails_ftf_110_440_v, my $dateofentry_ftf_122_952_v, my $notes_ftf_97_500_a, my $isbn_ftf_60_020_a, my $subject_ftf_70_650_a, my $recordedby_ftf_80_946_a, my $pubprice_151_952_r, my $currency_153_590_b, my $reccreated_123_508_a, my $remainder;
    ($biblionumber_ftf_691_090_c, $title_ftf_4_245_a, $edition_ftf_7_250_a, $publisher_ftf_11_260_b, $publishcountry_ftf_12_260_a, $publishyear_ftf_13_260_c, $author1ee_ftf_18_100_a, $author1se_ftf_19_100_a, $author2ee_ftf_20_700_a, $itemtype_ftf_25_942_c, $author2se_ftf_21_700_a, $adiauthors_ftf_24_700_a, $role_ftf_38_590_a, $phydescr_ftf_10_300_a, $classno_ftf_114_852_k, $classno_ftf_115_852_h, $keyword_ftf_5_520_a, $voldetails_ftf_110_440_v, $dateofentry_ftf_122_952_v, $notes_ftf_97_500_a,$isbn_ftf_60_020_a, $subject_ftf_70_650_a, $recordedby_ftf_80_946_a, $pubprice_151_952_r, $currency_153_590_b, $reccreated_123_508_a, $remainder) = split(/\t/, $_, 23);
    if (($biblionumber_ftf_691_090_c !~ /[^\d]/)  and ($title_ftf_4_245_a !~ /_B_L_A_N_K_/) and ($repeated_items !~ /$biblionumber_ftf_691_090_c/) ) {
        $repeated_items .= " $biblionumber_ftf_691_090_c";
        my @biblionumber_array;
        open(INF, $input_file) or die "Can't open $input_file: $!";
        my $i = 1;
        while (<INF>) {
            $i++;
            if ($i >= $c) {
            my $biblionumber_ftf_691_090_c2, my $title_ftf_4_245_a2, my $edition_ftf_7_250_a2, my $publisher_ftf_11_260_b2, my $publishcountry_ftf_12_260_a2, my $publishyear_ftf_13_260_c2, my $author1ee_ftf_18_100_a2, my $author1se_ftf_19_100_a2, my $author2ee_ftf_20_700_a2, my $author2se_ftf_21_700_a2, my $adiauthors_ftf_24_700_a2, my $itemtype_ftf_25_942_c2, my $role_ftf_38_590_a2, my $phydescr_ftf_10_300_a2, my $classno_ftf_114_852_k2, my $classno_ftf_115_852_h2, my $keyword_ftf_5_520_a2, my $voldetails_ftf_110_440_v2, my $dateofentry_ftf_122_952_v2, my $notes_ftf_97_500_a2, my $isbn_ftf_60_020_a2, my $subject_ftf_70_650_a2, my $recordedby_ftf_80_946_a2, my $pubprice_151_952_r2, my $currency_153_590_b2, my $reccreated_123_508_a2, my $remainder2;
            ($biblionumber_ftf_691_090_c2, $title_ftf_4_245_a2, $edition_ftf_7_250_a2, $publisher_ftf_11_260_b2, $publishcountry_ftf_12_260_a2, $publishyear_ftf_13_260_c2, $author1ee_ftf_18_100_a2, $author1se_ftf_19_100_a2, $author2ee_ftf_20_700_a2, $author2se_ftf_21_700_a2, $adiauthors_ftf_24_700_a2, $itemtype_ftf_25_942_c2, $role_ftf_38_590_a2, $phydescr_ftf_10_300_a2, $classno_ftf_114_852_k2, $classno_ftf_115_852_h2, $keyword_ftf_5_520_a2, $voldetails_ftf_110_440_v2, $dateofentry_ftf_122_952_v2, $notes_ftf_97_500_a2, $isbn_ftf_60_020_a2, $subject_ftf_70_650_a2, $recordedby_ftf_80_946_a2, $pubprice_151_952_r2, $currency_153_590_b2, $reccreated_123_508_a2, $remainder2) = split(/\t/, $_, 23);
            if (($biblionumber_ftf_691_090_c2 !~ /[^\d]/) and ($title_ftf_4_245_a2 !~ /_B_L_A_N_K_/) and ($title_ftf_4_245_a2 eq $title_ftf_4_245_a) and ($author1ee_ftf_18_100_a2 eq $author1ee_ftf_18_100_a)){
                print "$biblionumber_ftf_691_090_c:$biblionumber_ftf_691_090_c2\t";
                $repeated_items .= " $biblionumber_ftf_691_090_c2";
                push @biblionumber_array, $biblionumber_ftf_691_090_c2;
            }
        }
        }
        print "\n";
        close(INF);
        my $record = MARC::Record->new();

	if ($isbn_ftf_60_020_a !~ /_B_L_A_N_K_/) { 
            my $isbn = MARC::Field->new(
                                         '020','','',
                                         a => $isbn_ftf_60_020_a
                                         );
            $record->add_fields($isbn);
        }

        if ($author1ee_ftf_18_100_a =~ /_B_L_A_N_K_/) {
            $author1ee_ftf_18_100_a = "";
        }
        if ($author1se_ftf_19_100_a =~ /_B_L_A_N_K_/) {
            $author1se_ftf_19_100_a = "";
        }

        my $author1_ftf = join(" ", $author1se_ftf_19_100_a, $author1ee_ftf_18_100_a);

        if ($author1_ftf ne "") { 
            my $author1 = MARC::Field->new(
                                           '100','1','',
                                           a => $author1_ftf
                                           );
            $record->add_fields($author1);
        }

        if ($title_ftf_4_245_a !~ /_B_L_A_N_K_/) { 
            my $title = MARC::Field->new(
                                         '245','1','2',
                                         a => $title_ftf_4_245_a
                                         );
            $record->add_fields($title);
        }

        if ($edition_ftf_7_250_a !~ /_B_L_A_N_K_/) { 
            my $edition = MARC::Field->new(
                                           '250','','',
                                           a => $edition_ftf_7_250_a
                                           );
            $record->add_fields($edition);
        }

        if ($publishcountry_ftf_12_260_a !~ /_B_L_A_N_K_/) { 
            my $publishcountry = MARC::Field->new(
                                                  '260','','',
                                                  a => $publishcountry_ftf_12_260_a
                                                  );
         $record->add_fields($publishcountry);
        }
        if ($publisher_ftf_11_260_b =~ /_B_L_A_N_K_/) {
            $publisher_ftf_11_260_b = "";
        }
        if ($publishyear_ftf_13_260_c =~ /_B_L_A_N_K_/) { 
            $publishyear_ftf_13_260_c = "";
        }
        my $publisher = MARC::Field->new(
                                         '260','','',
                                         b => $publisher_ftf_11_260_b,
                                         c => $publishyear_ftf_13_260_c
                                         );
        $record->add_fields($publisher);

        if ($phydescr_ftf_10_300_a =~ /_B_L_A_N_K_/) {
            $phydescr_ftf_10_300_a = "";
        }
        my $phydescr = MARC::Field->new(
                                        '300','','',
                                        a => $phydescr_ftf_10_300_a,
                                        f => $itemtype_ftf_25_942_c
                                        );
        $record->append_fields($phydescr);

        if ($voldetails_ftf_110_440_v !~ /_B_L_A_N_K_/) { 
            my $voldetails = MARC::Field->new(
                                              '440','','3',
                                              v => $voldetails_ftf_110_440_v
                                              );
            $record->add_fields($voldetails);
        }

        if ($notes_ftf_97_500_a !~ /_B_L_A_N_K_/) { 
            my $notes = MARC::Field->new(
                                         '500','','',
                                         a => $notes_ftf_97_500_a
                                         );
            $record->add_fields($notes);
        }

        if ($reccreated_123_508_a !~ /_B_L_A_N_K_/) { 
            my $reccreated = MARC::Field->new(
                                              '508','','',
                                              a => $reccreated_123_508_a
                                              );
            $record->add_fields($reccreated);
        }

        if ($keyword_ftf_5_520_a !~ /_B_L_A_N_K_/) { 
            my $keyword = MARC::Field->new(
                                           '520','','',
                                           a => $keyword_ftf_5_520_a
                                           );
            $record->add_fields($keyword);
        }
        if ($role_ftf_38_590_a =~ /_B_L_A_N_K_/) { 
            $role_ftf_38_590_a = '';
        }
        if ($currency_153_590_b =~ /_B_L_A_N_K_/) {
            $currency_153_590_b = '';
        }
        my $role = MARC::Field->new(
                                    '590','','',
                                    a => $role_ftf_38_590_a,
                                    b => $currency_153_590_b
                                    );
        $record->add_fields($role);

 	if ($subject_ftf_70_650_a !~ /_B_L_A_N_K_/) { 
            my $subject = MARC::Field->new(
                                         '650','1','2',
                                         a => $subject_ftf_70_650_a
                                         );
            $record->add_fields($subject);
        }

        if ($author2ee_ftf_20_700_a =~ /_B_L_A_N_K_/) {
            $author2ee_ftf_20_700_a = "";
        }
        if ($author2se_ftf_21_700_a =~ /_B_L_A_N_K_/) {
            $author2se_ftf_21_700_a = "";
        }
        if ($adiauthors_ftf_24_700_a =~ /_B_L_A_N_K_/) {
            $adiauthors_ftf_24_700_a = "";
        }

        my $adiauthors_ftf = join(" ", $author2se_ftf_21_700_a, $author2ee_ftf_20_700_a, $adiauthors_ftf_24_700_a);

        if ($adiauthors_ftf ne "") { 
            my $adiauthors = MARC::Field->new(
                                              '700','1','',
                                              a => $adiauthors_ftf
                                              );
            $record->add_fields($adiauthors);
        }

        if ($classno_ftf_114_852_k =~ /_B_L_A_N_K_/) {
            if ($classno_ftf_115_852_h =~ /_B_L_A_N_K_/) {
                my $classno = MARC::Field->new(
                                               '852','','',
                                               k => '999.9999'
                                               );
                $record->add_fields($classno);
            }
            else {
                if ($classno_ftf_115_852_h =~ /^\d\d\d/) {
                    my $classno = MARC::Field->new(
                                                   '852','','',
                                                   k => $classno_ftf_115_852_h
                                                   );
                    $record->add_fields($classno);
                }
                else {
                    my $classno = MARC::Field->new(
                                                   '852','','',
                                                   k => '999.9998',
                                                   h => $classno_ftf_115_852_h
                                                   );
                    $record->add_fields($classno);
                }
            }
        }    
        else {
            if ($classno_ftf_114_852_k =~ /^\d\d\d/) {
                if ($classno_ftf_115_852_h =~ /_B_L_A_N_K_/) {
                    $classno_ftf_115_852_h = "";
                }
                my $classno = MARC::Field->new(
                                               '852','','',
                                               k => $classno_ftf_114_852_k,
                                               h => $classno_ftf_115_852_h
                                               );
                $record->add_fields($classno);
            }
            else {
                if ($classno_ftf_115_852_h =~ /^\d\d\d/) {
                    my $classno = MARC::Field->new(
                                                   '852','','',
                                                   k => $classno_ftf_115_852_h,
                                                   h => $classno_ftf_114_852_k
                                                   );
                    $record->add_fields($classno);
                }
                else {
                    if ($classno_ftf_115_852_h =~ /_B_L_A_N_K_/) {
                        $classno_ftf_115_852_h = "";
                    }
                    my $classno = MARC::Field->new(
                                                   '852','','',
                                                   k => '999.9997',
                                                   h => $classno_ftf_115_852_h
                                                   );
                    $record->add_fields($classno);
                }
            }
        }
	
	if ($itemtype_ftf_25_942_c !~ /_B_L_A_N_K_/) { 
            my $itemtype = MARC::Field->new(
                                         '942','','',
                                         c => $itemtype_ftf_25_942_c
                                         );
            $record->add_fields($itemtype);
        }
	if ($recordedby_ftf_80_946_a !~ /_B_L_A_N_K_/) { 
            my $recordedby = MARC::Field->new(
                                         '946','1','',
                                         c => $recordedby_ftf_80_946_a
                                         );
            $record->add_fields($recordedby);
        }
        if ($pubprice_151_952_r =~ /_B_L_A_N_K_/) { 
            $pubprice_151_952_r = '';
        }
        if ($dateofentry_ftf_122_952_v =~ /_B_L_A_N_K_/) {
            $dateofentry_ftf_122_952_v = '';
        }
        my @biblionumber_array_tmp = sort @biblionumber_array;
        foreach (@biblionumber_array_tmp) {
            my $biblionumber = $_;
            my $barcode = MARC::Field->new(
                                           '952','','',
                                           b => "MAIN",
                                           d => "MAIN",
                                           p => $biblionumber,
                                           r => $pubprice_151_952_r,
                                           u => $biblionumber,
                                           v => $dateofentry_ftf_122_952_v
                                           );
            $record->add_fields($barcode);
        }
        #print "\n";
        print OUTFILE $record->as_usmarc();
    }
    else {
        #print $_;
    }
}
close(OUTFILE);


More information about the Koha mailing list