GithubHelp home page GithubHelp logo

alma_enumerator's Introduction

ae: alma enumerator

About

Alma Enumerator is set of Python scripts to update enumeration and chronology information in Alma, an integrated library system made by Ex Libris. It parses item record description fields, extracts enumeration and chronology information and updates the item record's enumeration and chronology fields. This is particularly useful cases when a library has volume, issue and date information saved in item description fields but not in the corresponding enumeration and chronology fields.

Requirements

Usage

First make sure your settings are correct in settings.py, including the API key and the MMS ID of the title you wish to update. If you don't have an API key, you'll need to get one from the Ex Libris Developer Network.

To use ae's graphical interface, run ae_gui. This will open up a window like the one below:

Example of ae_gui

Alma Enumerator can also be used on the command line. To get enumeration and chronology data out of item description fields, run ae_fetch or ae fetch. To update items' enumeration and chronology fields, run ae_update or ae update.

ae_fetch saves the information it gets to a CSV file. It is always a good idea to check ae_fetch's output to make sure the data it has extracted from the item descriptions is correct. The CSV file can be loaded into a spreadsheet application for easier viewing. If you do load it into a spreadsheet app, it's a good idea to have the program treat each column as plain text rather than numerical data.

Additionally, whenever ae_fetch recognizes a pattern doesn't parse correctly, it records the error in an error file and ae_update won't update the item record in Alma. This way you can edit these records yourself.

Once everything checks out in the CSV, you can run ae_update to update the enumeration and chronology information for each item under the current title.

Then verify that your records updated correctly in Alma.

If you'd rather pass ae_fetch and ae_update command line arguments instead of updating settings.py each time you make change mms_id, you can.

ae_fetch accepts:

ae_fetch [-m | --mms-id <mms>] [-o | --output-file <of>] [-e | --error-file <ef>] [-a | --api-key <api>]

So you could specify an mms_id by typing ae_fetch -m 999999999999999999 or ae_fetch --mms-id 999999999999999999 and ae_fetch would use the MMS ID provided while using settings.py for the output and error files and the API key.

ae_update accepts:

ae_update [-m | --mms-id <mms>] [-o | --output-file <of>] [-e | --error-file <ef>] [-a | --api-key <api>]

If you're not comfortable working on the command line, run ae_gui or use an IDE like Spyder or PyCharm that will allow you to open and then run ae_fetch and ae_update.

Example of running ae_update in Spyder

Example of running ae_fetch in Pycharm

If you're feeling daring you can also batch process files without checking the output of ae_fetch, you can use ae_batch or ae batch.

ae_batch accepts: ae_batch [-m | --mms-id ] [-o | --output-file ] [-e | --error-file ] [-a | --api-key ]

Instead of taking a single MMS ID, ae_batch takes a file with one bibliographic MMS ID per line such as:

1234567890
0987654321
0192837465
1029384756

It then will download and process items associated with each MMS ID, just like ae_fetch before updating each item a la ae_update. This has the potential to speed up processing significantly, but at the risk of errors potentially going uncaught.

Known issues

Certain patterns pass through the parser without raising an error, but do not process correctly. Some examples:

  • no.51 12 Dec 2015 (12 is treated as enumeration_b rather than chronology_k)
  • v 19 07-08 (07-08 is treated like enumeration_b instead of chronology_i)
  • v 63 #1 P.1 JAN 1990 (P.1 is treated like chronology_k instead of enumeration_c)
  • v 20-21 1983-1984, c 2 (c 2 treated like enumeration_b)
  • For more known issues see notes.md

Because the updating function downloads the XML for each record, modifies it, and uploads it back to the server one at a time, it is quite slow, especially when processing large numbers of records.

alma_enumerator's People

Contributors

nausicaa-rose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

alma_enumerator's Issues

error running ae_fetch

I'm guessing I'm missing some info that isn't in the readme, but I filled in the api key, added in an mms ID, and tried adding blank text files output.txt, input.txt, and error.txt for those sections, and also tried with no text files for output, input and error. installed and updated all the dependencies, python version 3.12, requests version 2.31.0, beautifulsoup 4.12.2. not sure what to do (tried running in vscode and cmd).

PS C:\Users\fesnakm> & C:/Users/fesnakm/AppData/Local/Programs/Python/Python312/python.exe c:/Users/fesnakm/alma_enumerator-master/ae_fetch
Traceback (most recent call last):
File "c:\Users\fesnakm\alma_enumerator-master\ae_fetch", line 30, in
fetch(mms_id, output_file, error_file, api_key, base_url)
File "c:\Users\fesnakm\alma_enumerator-master\AE.py", line 414, in fetch
holdings = get_holdings(base_url, mms_id, api_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\fesnakm\alma_enumerator-master\AE.py", line 20, in get_holdings
soup = BeautifulSoup(r.text, 'xml')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\fesnakm\AppData\Local\Programs\Python\Python312\Lib\site-packages\bs4_init_.py", line 250, in init
raise FeatureNotFound(
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?

UnboundLocalError local variable 'holdings_id'

I'm getting the following:

File "ae_gui", line 30, in update_it
update(settings.mms_id, settings.input_file, settings.error_file, settings.api_key, settings.base_url)
File "C:\AlmaEnumerator\alma_enumerator-master\AE.py", line 524, in update
items_to_update = get_info_from_csv(input_file)
File "C:\AlmaEnumerator\alma_enumerator-master\AE.py", line 477, in get_info_from_csv
item_info[holdings_id].append(dict(zip(keys, info)))
UnboundLocalError: local variable 'holdings_id' referenced before assignment

I've tried a couple different things, but just get various errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.