Skip to main content

A set of runtime extensions of Invenio repository

Project description

OARepo runtime

The base of invenio oarepo client and a set of classes/functions that help with code-generated features:

Custom fields

Provides support for custom fields identification and iteration and invenio oarepo cf init initialization tool for customfields.

Expansions

Provides expandable field implementation and service mixin for referenced record (in case you do not want to use relations).

Facets

An implementation of nested labeled facet.

i18n

Validator for language codes.

Relations

Replacement of Invenio relations. Fixes the following issues:

  1. Invenio relations can occur only on specific paths and for each pattern, different class must be used (Relation, ListRelation, NestedListRelation)
  2. PID Cache is isolated per request, not set directly on field
  3. Allows to map keys - A key from related object can be renamed/remapped to a different key/path
  4. Provides classes to reference parts of the same record
# article, id 12
metadata:
    title: blah

with mapping referenced article would look like (mapping: {key: 'metadata.title', target: 'title'}):

# dataset:
metadata:
    articles:
    - id: 12
      @v: 1
      title: blah

With Invenio PID relation, it would be:

# dataset:
metadata:
    articles:
    - id: 12
      "@v": 1
      metadata:
        title: blah

Validation

This module provides a marshmallow validator for date strings.

Config

Provides interface and definitions for loading preconfigured permission sets to service config.

ICU sort and suggestions

To use ICU sort and suggestion custom fields, provide the following configuration to oarepo-model-builder (or put this stuff to your custom superclasses).

  record:
    imports:
      - import: invenio_records_resources.records.api.Record
        alias: InvenioRecord
      - import: oarepo_runtime.records.SystemFieldDumperExt
      - import: oarepo_runtime.records.icu.ICUSortField
      - import: oarepo_runtime.records.icu.ICUSuggestField
    extra-code: |-2
          # extra custom fields for testing ICU sorting and suggesting
          sort = ICUSortField(source_field="metadata.title")
          suggest = ICUSuggestField(source_field="metadata.title")
  search-options:
    base-classes:
      - I18nSearchOptions
    imports:
      - import: oarepo_runtime.services.icu.I18nSearchOptions
      - import: oarepo_runtime.services.icu.ICUSuggestParser
      - import: oarepo_runtime.services.icu.ICUSortOptions
    sort-options-field: extra_sort_options
    extra-code: |-2
          suggest_parser_cls = ICUSuggestParser("records2")
          sort_options = ICUSortOptions("records2")

  record-dumper:
    extensions:
      - SystemFieldDumperExt()

Run invenio oarepo cf init to initialize custom fields, invenio oarepo index reindex if you already have data inside the repository and from this moment on, /records?sort=title and /records?suggest=abc should work

Command-line utils

invenio oarepo version

Prints a json with versions of all installed packages. Format:

{
   "package_name": "package_version",
   "package_name2": "package_version2",
   ...
}

invenio oarepo check

Checks the repository if it has access to all infrastructure components and that they have been initialized correctly.

Call as invenio oarepo check - or invenio oarepo check <output-file>. Will print/write to file a json with the following format:

{
  "db": "ok|connection_error|not_initialized|migration_pending",
  "opensearch": "ok|connection_error|index_missing:<index_name>",
  "files": "ok|db_connection_error|default_location_missing|bucket_does_not_exist:<bucket_name>|db_error",
  "mq": "ok|connection_error|mq_error",
  "cache": "ok|connection_error|cache_error|cache_exception", 
  "configuration": {
     // contains the configuration from the flask app
     "key": "value",
     "key2": "value2",
     ...
  }
}


          

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

oarepo_runtime-1.5.62.tar.gz (71.0 kB view details)

Uploaded Source

Built Distribution

oarepo_runtime-1.5.62-py3-none-any.whl (107.1 kB view details)

Uploaded Python 3

File details

Details for the file oarepo_runtime-1.5.62.tar.gz.

File metadata

  • Download URL: oarepo_runtime-1.5.62.tar.gz
  • Upload date:
  • Size: 71.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for oarepo_runtime-1.5.62.tar.gz
Algorithm Hash digest
SHA256 135f051ffeab71b9504bca8ecdc3bfd2aed4b32f9f005db7662d7a0c4f68e047
MD5 e9158ba5d4b72b6b497b5d69a11ec497
BLAKE2b-256 e2846d63421c05c98679028553265752492c39a50f74bd6f96d91de978c9fd44

See more details on using hashes here.

File details

Details for the file oarepo_runtime-1.5.62-py3-none-any.whl.

File metadata

File hashes

Hashes for oarepo_runtime-1.5.62-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc8310bb0e048b1bd1a1f8f3830286929d84d6fc1e7c0d63456e0a6ac5ffc3a
MD5 845c7c23fbde45127a1175a61f178d50
BLAKE2b-256 f5e7ec665b82e8b8bcca7da83edc2ce34091ad5ec8d4499507bfe6419885d973

See more details on using hashes here.

Supported by

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