kbase / collections

Data collections code including a service and loaders
MIT License
0 stars 1 forks source link

PROTOTYPE - Collections repo

Contains service API and loader code for collections of data that

Currently collections only contain KBase staff curated data.

Usage

OpenAPI documentation is provided at the /docs endpoint of the server (in KBase, this is at <host>/service/collections/docs, for example https://ci.kbase.us/services/collections/docs).

Error codes

Error codes are listed in errors.py.

Administration

A few setup steps are required before starting the service and when new Arango collections are required or ArangoSearch views need to be created or updated.

$ PYTHONPATH=. python src/service_manager.py -c <path to filled out collections config file>

Arango Collection updates

Occasionally new collections may be required on service updates. In that case run the script again to create the new collections.

ArangoSearch view creation and updates

Occasionally new data products may be added to the service that require new ArangoSearch views or existing data products may have their view specifications altered. In this case the service manager script must be run again to create the new view(s), and the user will have to provide names for the view(s). As noted above, including the git commit hash in the name may be wise.

Those view names are then used when creating or updating KBase Collections (capitalized to distinguish between KBase Collections and ArangoDB collections) with data products that require ArangoSearch views. Prior to activating a collection with a new view:

When no active KBase Collections are using a view it can be deleted with the caveat that if an older version of a Collection that specifies a deleted view is reactivated, any operations that required a view will fail for that Collection.

File structure

Development

Adding code

Timestamps

Versioning

Code requirements for prototype code:

Running tests

Python 3.11 must be installed on the system.

pipenv sync --dev  # only the first time or when Pipfile.lock changes
pipenv shell
PYTHONPATH=. pytest test

TODO

Prior to declaring this a non-prototype