Sign inSign up

renatodiaz/py-dts

By renatodiaz

•Updated about 2 months ago

A simple and flexible python implementation on the DTS specifications

Image
Data science
Databases & storage
0

398

renatodiaz/py-dts repository overview

⁠PY-DTS - a Python implementation of the DTS api

This project implements the DTS API specification in Python. It provides a RESTful web service to manage and serve text documents, collections, and their metadata. It also includes tools to extract metadata from XML documents and convert them into the appropriate DTS representations. The project is built using FastAPI for the web framework and Pydantic for data validation and serialization.

full API purpose and specification can be found here:

https://distributed-text-services.github.io/specifications/⁠

actual DTS api implementation version is 1-alpha.

⁠Features

  • RESTful API for requesting documents and collections
  • Metadata extraction from XML documents (Dublin Core)
  • OpenAPI documentation for easy API exploration
  • Unit tests to ensure code quality and reliability
  • Modular design for easy extension and customization
  • Asynchronous support for handling multiple requests efficiently
  • CORS support for cross-origin requests
  • Example data and scripts for testing and demonstration
  • Error handling and validation for robust API interactions
  • Support for multiple storage backends (local filesystem, GitHub, ExistDb)

⁠how run

⁠Docker

PY-DTS can also be deployed using Docker with :

docker/podman run -p 8000:8000 --name pydts renatodiaz/py-dts:latest

⁠Variables

The API can be configured with the following environment variables:

  • APP_NAME: the name of the application, used in the API documentation.
  • APP_DESCRIPTION: a short description of the application, used in the API documentation.
  • APP_AUTHOR_INFOS: a dict containing the name and email of the author, used in the API documentation.
  • APP_URL: a JSON string containing a list of URLs and their descriptions, used in the API documentation.
  • DTS_CONTEXT: the URL of the DTS context to use for JSON-LD serialization, the default value is https://distributed-text-services.github.io/specifications/context/1-alpha1.json.
  • DTS_VERSION: the version of the DTS specification to use, the default value is 1-alpha.
  • ROOT_COLLECTION: the root collection to use, the default value is None.
  • ALLOWED_ORIGINS: a list of allowed origins for CORS settings, set to * to allow all origins, or specify a comma-separated list of allowed origins (e.g. http://localhost:3000,http://example.com).
  • STORAGE: the storage backend to use, available options are local and github.
  • INDEXER: the indexer to use, available options are standard (the default one) and custom (not implemented yet).
  • BASE_PATH: the base path to the storage, not needed for github storage, but required for local storage.
  • METADATA_PATH: the path to the metadata file, can be a local path or a URL, depending on the storage backend used.
  • TEI_NS: the TEI namespace to use for XML parsing, the default value is http://www.tei-c.org/ns/1.0.

Tag summary

Content type

Image

Digest

sha256:c527b09c6…

Size

146.8 MB

Last updated

about 2 months ago

docker pull renatodiaz/py-dts