Skip to main content

A library for generating predictive uuids for FOLIO data migrations

Project description

folio_uuid

A python module for creating deterministic UUIDs (UUID v5) outside of FOLIO when migrating data.

Installation

The module is uploaded to pypi. Just do

pip install folio-uuid

or

pipenv install folio-uuid      

Overview

The UUIDs (v5) are contstructed in the following way:

  • The namespace is the same for all "Folio UUIDs": 8405ae4d-b315-42e1-918a-d1919900cf3f
  • The name is contstructed by the following parts, delimited by a colon (:)
    • TENANT_STRING This should be a unique, system-specific string for the target system. We recommend using the target Tenant ID (the value passed in x-okapi-tenant when accessing FOLIO's APIs), but you can use the system's API gateway URL, as well. Example: diku
    • OBJECT_TYPE_NAME This should be the name of the type of object that the ID is generated for. In plural. the file folio_namespaces.py in this repo has a complete list of the ones currently in use. Example: items
    • LEGACY_IDENTIFIER This should be the legacy identifier comming from the source system. The library will perform some normalization* of the identifier if it is a Sierra/Millennium identifier. Example: i3696836

* The normalization strips away any dots (.), check digits and campus codes from the identifiers

Tests/Examples

  • The namespace is *8405ae4d-b315-42e1-918a-d1919900cf3f*
  • The name, constructed as TENANT_ID:OBJECT_TYPE_NAME:LEGACY_IDENTIFIER would become diku:items:i3696836
  • The resulting UUID then becomes 9647225d-d8e9-530d-b8cc-52a53be14e26

Bash/linux example

uuidgen --sha1 -n 8405ae4d-b315-42e1-918a-d1919900cf3f -N diku:items:i3696836

To install uuidgen on a apt-enabled Linux distribution, use

sudo apt-get install uuid-runtime

Python Example

def test_deterministic_uuid_generation_holdings():
   deterministic_uuid = FolioUUID(
      "diku",
      FOLIONamespaces.holdings,
      "000000167",
   )
assert "3db53ecc-37a9-521e-88fd-6ef72c710468" == str(deterministic_uuid)

What happened to OKAPI_URL?

Previous versions of this library directed users to provide the target FOLIO system's OKAPI URL as the first argument (okapi_url) when instantiating a new FolioUUID class, and allowed specifying an optional tenant_id value that would be included in the overall string used to generate the v5 UUID. However, in most circumstances the FOLIO tenant id value is more static than the API gateway URL (eg. when migrating from an OKAPI-based FOLIO system to a Eureka-based one).

As of v1.0.0 of folio_uuid, the first argument has been renamed to tenant_string, and can be any unique string value for the target tenant. okapi_url and tenant_id are still available as keyword-only arguments, but are deprecated and will be removed in a future release. Code that used FolioUUID with positional-only arguments will not require any code changes. Code that used keyword arguments for okapi_url and tenant_id will continue to work, as well, but will raise deprecation warnings.

References

Wikipedia has an article on UUID version 5

There are many browser-based tools to create singe UUIDs v5. UUIDTools is one of them.

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

folio_uuid-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

folio_uuid-1.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file folio_uuid-1.0.0.tar.gz.

File metadata

  • Download URL: folio_uuid-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for folio_uuid-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a8661bad8ce4607b68cee99b40fd8d19fa724f137083d5cfa273a36481127f7a
MD5 58b760ffee8731fdcee37429133476b6
BLAKE2b-256 354757be7c46eb1f13a210fdddfba3752884ed4db3c44232c0254b6aa4556dea

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_uuid-1.0.0.tar.gz:

Publisher: python-publish.yml on FOLIO-FSE/folio_uuid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file folio_uuid-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: folio_uuid-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for folio_uuid-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0da6337e5f83a395f8a19cc91a176d8dd0885a354a1e9a84fddda53a60c1522d
MD5 1600c97e3af397bd78d41cc36535a891
BLAKE2b-256 5521a8a1dcba2ebb6335769495284550a197dadc7541cb350b5e59cc9f8a1adb

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_uuid-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on FOLIO-FSE/folio_uuid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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