Skip to main content

Command line tool to load CSV content into a Solr index for the UCLA Digital Library's frontend, Ursus (https://digital.library.ucla.edu/)

Project description

feed_ursus

Command line tool to load CSV content into a Solr index for the UCLA Digital Library's frontend, Ursus (https://digital.library.ucla.edu/)

Using feed_ursus

For basic use, you can install feed_ursus as a systemwide command directly from pypi, without having to first clone the repository.

Installation

We recommend installing with pipx. On MacOS, you can install pipx (and python!) with homebrew:

brew install pipx pyenv
pipx ensurepath

Then:

pipx install feed_ursus

Pipx will install feed_ursus in its own virtualenv, but make the command accessible from anywhere so you don't need to active the virtualenv yourself.

Use

Convert a csv into a json document that follows the data model of an Ursus solr index:

feed_ursus [path/to/your.csv]

This repo includes a docker-compose.yml file that will run local instances of solr and ursus for use in testing this script. To use them, first install docker and docker compose. Then run:

docker-compose up --detach
docker-compose run web bundle exec rails db:setup

It might take a minute or so for solr to get up and running, at which point you should be able to see your new site at http://localhost:3000. Ursus will be empty, because you haven't loaded any data yet.

To load data from a csv:

feed_ursus --solr_url=http://localhost:8983/solr/californica --mapping=dlp load [path/to/your.csv] 

Mappers

Different metadata mappings are included for general Digital Library use (--mapping=dlp) and for the Sinai Manuscripts Digital Library (--mapping=sinai). The default is "dlp" – "sinai" is not guaranteed to be up to date as the sinai project is using a forked version at https://github.com/uclalibrary/feed_sinai.

Developing feed_ursus

Installing

For development, clone the repository and use poetry to set up the virtualenv:

git clone git@github.com:UCLALibrary/feed_ursus.git
cd feed_ursus
pipx install poetry
poetry self add poetry-git-version-plugin
poetry install

Then, to activate the virtualenv:

poetry shell

The following will assume the virtualenv is active. You could also run e.g. poetry run feed_ursus [path/to/your.csv]

Using the development version

feed_ursus --solr_url http://localhost:8983/solr/californica load [path/to/your.csv]

Running the tests

Tests are written for pytest:

pytest

Running the formatter and linters:

black (formatter) will run in check mode in ci, so make sure you run it before committing:

black .

flake8 (linter) isn't currently running in ci, but should be put back in soon:

flake8

pylint (linter) isn't currently running in ci, but should be put back in soon:

pylint

mypy (static type checker) isn't currently running in ci, but should be put back in soon:

mypy

Caveats

IIIF Manifests

When importing a work, the script will always assume that a IIIF manifest exists at https://iiif.library.ucla.edu/[ark]/manifest, where [ark] is the URL-encoded Archival Resource Key of the work. This link should work, as long as a manifest has been pushed to that location by importing the work into Fester or Californica. If you haven't done one of those, obviously, the link will fail and the image won't be visible, but metadata will import and be visible. A manifest can then be created and pushed to the expected location without re-running feed_ursus.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feed_ursus-1.0.5.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feed_ursus-1.0.5-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file feed_ursus-1.0.5.tar.gz.

File metadata

  • Download URL: feed_ursus-1.0.5.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for feed_ursus-1.0.5.tar.gz
Algorithm Hash digest
SHA256 0c2c73fe617f36d5b39c38ede4dedc3cd494164be1a24750d6624d9fd29d9389
MD5 599b693038b458956c4f2e852e78e7c8
BLAKE2b-256 b27c2115a59d0596a999ca24f63b263d0e75784bdc3e0873269423e8c5162517

See more details on using hashes here.

File details

Details for the file feed_ursus-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: feed_ursus-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for feed_ursus-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e0c4a79d484fbafdc2881f41925e6af233f7d800db0c73fa675a153e1a449e3
MD5 ee54b142fbf81a047d816c29ce0503f2
BLAKE2b-256 b0de0a884a85335fc2eb2029b0b0d49119a0d885f51f0680c31386adac4fccb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page