pokapi
Simple Python object-oriented interface for getting records from FOLIO
Science Score: 62.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
✓Institutional organization owner
Organization caltechlibrary has institutional domain (www.library.caltech.edu) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.2%) to scientific vocabulary
Keywords
Repository
Simple Python object-oriented interface for getting records from FOLIO
Basic Info
Statistics
- Stars: 9
- Watchers: 5
- Forks: 1
- Open Issues: 1
- Releases: 7
Topics
Metadata Files
README.md
Pokapi
Pokapi (Python Okapi Interface) is a Python package for getting basic data from a FOLIO LSP server using the Okapi API.
Table of contents
- Introduction
- Installation
- Usage
- Known issues and limitations
- Getting help
- Contributing
- License
- Authors and history
- Acknowledgments
Introduction
The FOLIO platform is a library services platform. The Caltech Library uses a hosted solution by EBSCO for its library catalog. To make writing interfaces and automation scripts in Python easier, the Caltech Library Digital Library Development team are developing Pokapi (Python Okapi Interface), a Python package that provides an object-oriented interface to accessing FOLIO data via the Okapi API. It currently provides a simple object structure based mostly on FOLIO instance records.
Incidentally, okapi (properly known as Okapia johnstoni) are real animals related to the giraffe. They are an endangered species whose population continues to decrease due to human activity and hunting by humans.
Installation
The instructions below assume you have a Python interpreter installed on your computer; if that's not the case, please first install Python version 3 and familiarize yourself with running Python programs on your system.
On Linux, macOS, and Windows operating systems, you should be able to install pokapi with pip. To install pokapi from the Python package repository (PyPI), run the following command:
sh
python3 -m pip install pokapi
As an alternative to getting it from PyPI, you can use pip to install pokapi directly from GitHub, like this:
sh
python3 -m pip install git+https://github.com/caltechlibrary/pokapi.git
Usage
The use of Pokapi is straightfoward. First, callers must create one instance of a Folio object that defines various aspects of how to communicate with their FOLIO/Okapi system. Then, callers can use the record(...) method on that Folio object to get objects that represent records in their FOLIO system. The method only requires an identifier, which can be a FOLIO instance identifier, an item barcode, or an EDS accession number. More details about all of this are provided below.
The Folio interface object
To use Pokapi, first create a Folio object with parameters that define certain things Pokapi can't get on its own. These are: the the Okapi URL for your instance, an Okapi API token, a tenant id, and the prefix that appears in front of your accession numbers. Assuming that these values are stored in separate variables, the following code illustrates how to create a Folio object:
```python
from pokapi import Folio
folio = Folio(okapiurl = theokapiurl, okapitoken = theokapitoken, tenantid = thetenantid, anprefix = theaccessionnumber_prefix) ```
As an example of a prefix for accession numbers, for Caltech the prefix is the clc part of an accession number such as clc.025d49d5.735a.4d79.8889.c5895ac65fd2.
The record(...) method
The Folio class has only one method on it currently: record(...). This method contacts the FOLIO server to obtain data and returns a FolioRecord object with the data stored in fields. The following fields are implemented at this time:
| Field | Type | Meaning |
|------------------|--------|---------|
| id | string | FOLIO instance record identifier |
| accession_number | string | The accession number for the record |
| title | string | Title of the work |
| author | string | Author; multiple authors are separated by "and" |
| publisher | string | Publisher |
| year | string | Year of publication |
| edition | string | the edition of the work (if any) |
| isbn_issn | string | ISBN or ISSN |
The method Folio.record(...) can take any one of the following mutually-exclusive keyword arguments to identify the record to be retrieved:
barcode: retrieve the record corresponding to the given item barcodeinstance_id: retrieve the record having the given FOLIO instance identifieraccession_number: retrieve the record corresponding to the accession number
Here is an example of using the method:
python
r = folio.record(barcode = "35047019531631")
assert r.id == "1fedf5f3-b631-4d34-8d40-e022f70ab232"
assert r.title == "The bad doctor"
assert r.year == "2015"
assert r.author == "Williams, Ian"
assert r.isbn_issn == "9780271067544"
assert r.publisher == "The Pennsylvania State University Press"
Known issues and limitations
The following are known limitations at this time:
- If a record has multiple publishers, only the first publisher name is retrieved.
- The title is extracted from the instance record's
titlefield, but because (at least in our catalog) the title contains both a title and author info, Pokapi has to use heuristics to extract out just the title from the string. The heuristics might fail in some cases, especially if your installation of FOLIO uses different conventions for formatting thetitlefield.
Getting help
If you find an issue, please submit it in the GitHub issue tracker for this repository.
Contributing
We would be happy to receive your help and participation with enhancing Pokapi! Please visit the guidelines for contributing for some tips on getting started.
License
Software produced by the Caltech Library is Copyright © 2021–2023 California Institute of Technology. This software is freely distributed under a BSD/MIT type license. Please see the LICENSE file for more information.
Acknowledgments
This work was funded by the California Institute of Technology Library.
The vector artwork of the face of an okapi, used as the icon for this project, was created by Icons Producer from the Noun Project. It is licensed under the Creative Commons CC-BY 3.0 license.
Pokapi makes use of numerous open-source packages, without which Pokapi could not have been developed. I want to acknowledge this debt. In alphabetical order, the packages are:
- CommonPy – a collection of commonly-useful Python functions
- ipdb – the IPython debugger
- lxml – an XML parsing library for Python
- Python Decouple – a high-level configuration file interface
- setuptools – library for
setup.py - Sidetrack – simple debug logging/tracing package
- uritemplate – URI template parsing per RFC 6570
- validators – Python data validation for Humans
Owner
- Name: Caltech Library
- Login: caltechlibrary
- Kind: organization
- Email: helpdesk@library.caltech.edu
- Location: Pasadena, CA 91125
- Website: https://www.library.caltech.edu/
- Repositories: 84
- Profile: https://github.com/caltechlibrary
We manage the physical and digital holdings of the California Institute of Technology, provide services and training, and develop open-source software.
Citation (CITATION.cff)
cff-version: 1.2
message: "If you use this software, please cite it using these metadata."
title: "Pokapi: Python Okapi Interface"
authors:
-
affiliation: "Caltech Library"
given-names: Mike
family-names: Hucka
orcid: "0000-0001-9105-5960"
version: "0.4.0"
abstract: "A tool to do bulk changes in FOLIO using the OKAPI API"
repository-code: "https://github.com/caltechlibrary/pokapi"
type: software
license-url: "https://github.com/caltechlibrary/foliage/blob/main/LICENSE"
keywords:
- FOLIO
- Library Services Platforms
date-released: 2023-01-18
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"description": "Python package for getting basic data from a FOLIO ILS server",
"name": "Pokapi",
"codeRepository": "https://github.com/caltechlibrary/pokapi",
"issueTracker": "https://github.com/caltechlibrary/pokapi/issues",
"license": "https://github.com/caltechlibrary/pokapi/blob/main/LICENSE",
"version": "0.4.0",
"author": [
{
"@type": "Person",
"givenName": "Michael",
"familyName": "Hucka",
"affiliation": "California Institute of Technology Library",
"email": "mhucka@library.caltech.edu",
"@id": "https://orcid.org/0000-0001-9105-5960"
}
],
"developmentStatus": "active",
"downloadUrl": "https://github.com/caltechlibrary/pokapi/archive/main.zip",
"keywords": [
"software",
"science"
],
"maintainer": "https://orcid.org/0000-0001-9105-5960",
"funder": {
"@id": "https://doi.org/10.13039/100006961",
"@type": "Organization",
"name": "Caltech Library"
}
}
GitHub Events
Total
Last Year
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 127
- Total Committers: 2
- Avg Commits per committer: 63.5
- Development Distribution Score (DDS): 0.008
Top Committers
| Name | Commits | |
|---|---|---|
| mhucka | m****a@c****u | 126 |
| dependabot[bot] | 4****]@u****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 2 minutes
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mhucka (1)
Pull Request Authors
- dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 29 last-month
- Total dependent packages: 0
- Total dependent repositories: 3
- Total versions: 8
- Total maintainers: 1
pypi.org: pokapi
Python package for getting basic data from a FOLIO LSP server
- Homepage: https://github.com/caltechlibrary/pokapi
- Documentation: https://pokapi.readthedocs.io/
- License: BSD 3-clause
-
Latest release: 0.4.0
published almost 3 years ago
Rankings
Maintainers (1)
Dependencies
- commonpy >=1.3.10
- lxml >=4.6.3
- python-decouple >=3.4
- sidetrack >=1.4.0
- uritemplate >=3.0.0
- validators >=0.18.2