Skip to main content

OARepo documents

image image image image

Instalation

    pip install oarepo-documents

Usage

This library contains data model for creating documents. This data model is not usable by it self, you have to add it to your own data model as it is shown in "Using data model". New document can by also created by provided DOI, as it is shown in "Document from DOI"

Using data model

Document json schema, es mapping and marshmallow is taken from invenio-app-ils/documents with some properties changed to data type multilingual string from oarepo-multilingual library. All properties that are changed to multilingual are listed in "Changes"

Changes

  • abstract
  • alternative_abstracts
  • alternative_titles
  • conference_info (only property "title")
  • license (only property "title")
  • note
  • publication_info (only property "journal_title")
  • title
  • urls (only property "description")

Json Schema

Add documents json schema to your schema with keyword allOf and "$ref": "/schemas/document-v1.0.0.json#/definitions/Document"

Example

{
  "type": "object",
  "allOf": [
    {
      "properties": {
        "extra_property": {
          "type": "string"
        }
      }
    },
    {
      "$ref": "/schemas/document-v1.0.0.json#/definitions/Document"
    }
  ],
  "additionalProperties": "false"
}

Mapping

Add documents mapping to your elastic search mapping with "oarepo:extends": "document-v1.0.0.json#/Document" from library "oarepo-extends""

Example

{
  "mappings": {
    "dynamic": "strict",
    "oarepo:extends": "document-v1.0.0.json#/Document",
    "properties": {
         "extra_property": {
        "type": "text"
      }
    }
  }
}

Marshmallow

Inherit your class from DocumentSchemaV1

Example

from oarepo_documents.marshmallow.document import DocumentSchemaV1

class SampleSchemaV1(DocumentSchemaV1):
    extra_property = fields.String(validate=validate.Length(min=5), required=False) 

Document from DOI

You can create new document record from existing DOI with url in format 'server/record_class/document/doi'. This request will return existing document record, if document with that DOI already exists in your database. If there is no document with this DOI in database, it will be created a new one via CrossRef client and metadata from this new document will be returned. This new document will have its DOI as metadata in property "alternative_identifiers" with scheme "DOI".

Examples

 url = "https://localhost:5000/records/document/10.5281/zenodo.3883620"

Changes

Version 1.0.0

  • Initial public release.

Metadata

Release files for oarepo-documents 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oarepo-documents 2.0.1
File Size Uploaded
oarepo_documents-2.0.1.tar.gz 24.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oarepo-documents 2.0.1
File Interpreter ABI Platform
oarepo_documents-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.3 kB

Release files / oarepo_documents-2.0.1.tar.gz

Download URL oarepo_documents-2.0.1.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6af4c6c84d963cc360f567d819b83cae7c44a84bde2461c3e74e31fc01656220
BLAKE2b-256 checksum
How to use checksums
25e0f5474457590a3bf4442608b537c87f17e86ad8fff21ccb512882cdc2307a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / oarepo_documents-2.0.1-py3-none-any.whl

Download URL oarepo_documents-2.0.1-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a41a6c5983c6c60862a41a769b40dfa342de42d9049a414f88008b74a48342a0
BLAKE2b-256 checksum
How to use checksums
fb8f1b843d77d57d56fc0397d930824276c10a829184cd5c7f684731a699470e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page