Ready to Learn?Ex Libris products all provide open APIs

Tech Blog

 

Converting Voyager patron SIF records into Alma's SIS (v2) format

Mel Pemble on April 29th, 2015

So, you've moved to Alma, but your patron records are still in Voyager SIF format.

You have read an even implemented the code in the blog post Using Voyager SIF records to create Alma XML patron load data only to discover you need the output in Alma SIS V2 format

Maybe you want something you can drop in and configure without writing any code.

In this article we will describe how to accomplish this task.

 

About the App

This application is implemented in php and includes functionality to

  • Convert Voyager Patron SIF files to Alma SIS XML format (version 2)
  • Easily update configuration to the SIF format when it changes
  • Easily update the code table mappings into the ALMA SIS format
  • Using a stock php install (5.3 +) without a need for compiled extentions
  • Low memory footprint (converting 500K records in under 10 meg of ram)
  • Support for user friendly xml output for testing
  • Command line client (no need for a web server)
  • Support for converting more than 1 SIF file

 

The Files

voyager_sif_definition.php

This file is the basic definition of the Voyager SIF file.

The fixed fields and lengths have not changed since voyager version 2000.0

The file contains 2 pre-defined arrays.

$baseRecordFields  and $addressRecordFields

A valid Voyager patron SIF file must contain the baseRecordFields and at least 1 addressRecordField

The arrays simply consist of a name and its fixed field length defined in the Patron Standard Information File Format included with the technical documentation for every given release.

As an example ...

$baseRecordFields = [
    'patron_id' => 10,
    'patron_barcode_id_1' => 10,
    'patron_barcode_1' => 25,
    'patron_group_1' => 10,
    'barcode_status_1' => 1,
    'barcode_modified_date_1' => 10,
    'patron_barcode_id_2' => 10,
    'patron_barcode_2' => 25,
    'patron_group_2' => 10,

 

Should the SIF format change in terms of field lengths, updating this file would be trivial and allow the conversion code to still operate normally. If new fields are introduced, defining them in the correct order would allow the conversion to operate normally, with the exception of not immediately including the new fields in the conversions. When and if that does occur an update would be made to the code base.

Additionally, should the fixed fields lengths change, the validation for minimal record length will not break as the calculation is done dynamically

$baseRecordFieldsLength = array_sum($baseRecordFields);

$addressRecordFieldsLength = array_sum($addressRecordFields);

if (strlen($line) < $baseRecordFieldsLength+$addressRecordFieldsLength) { ...

 

During the conversion, invalid records are echoed to the console window by line number

 

voy2alma_mapping.php

This file contains the mappings from the code tables that must be manually configured per institution so that a valid Alma SIS file can be created.

The code itself is well documented and contains the REST url snippets needed to lookup the information based on that institution so that valid mappings may be entered.

 

Additionally the user may configure patron purge and expire dates as well as address begin and end dates in cases where the SIF record does not contain data

// default dates when no date in SIF
// the offset will use php strtotime function
// which can translate any English textual datetime description into a timestamp
//
$default_patron_purge_date = getDefaultDateOffset('+10 years');
$default_patron_expiry_date = getDefaultDateOffset('+5 years');
$default_address_begin_date = getDefaultDateOffset('last month');
$default_address_end_date = getDefaultDateOffset('+5 years');

 

SIF2SISV2.php

This is the main program, and the one that will be executed from the command line after the configuration to the mapping file has been done.

Typing from the command line

SIF2SISV2.php -h

Will present the following output, which hopefully is self-explanatory.

 

Usage - This is a command line utility to convert a Voyager Patron SIF file 
into an Alma SIS V2 XML file

valid parameters are -f -p -h

-f      Filename to process
-p      In addition to creating the SIS XML file
        also output the xml to the console in "pretty-print" format (for debugging)
        ( the script will limit pretty print to the 1st 10 patrons converted)
-h      Display the help file

Examples:

SIF2SISV2.php -h
    Displays the helpfile

SIF2SISV2.php -f /path/to/SIFFile.sif
    Converts SIFFile.sif to SIFFile.sif.sis.xml

SIF2SISV2.php -f /path/to/SIFFile.sif -p
    Converts SIFFile.sif to SIFFile.sif.sis.xml and displays the xml to the console

SIF2SISV2.php -f /path/to/SIFFile.sif -f /path/to/SIFFile2.sif
    Converts SIFFile.sif to SIFFile.sif.sis.xml
    Converts SIFFile.sif to SIFFile2.sif.sis.xml

 

Conclusion

The entire application created for this article is available in this Github repository.