dservercore
dserver Flask app
Functions
|
Classes
Any extension plugin must inherit from this base class. |
|
Common base class for all plugins. |
|
Any retrieve plugin must inherit from this base class. |
|
Any search plugin must inherit from this base class. |
Exceptions
- exception dservercore.ValidationError
Bases:
ValueError- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception dservercore.AuthenticationError
Bases:
ValueError- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception dservercore.AuthorizationError
Bases:
ValueError- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception dservercore.UnknownBaseURIError
Bases:
KeyError- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception dservercore.UnknownURIError
Bases:
KeyError- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class dservercore.PluginABC
Bases:
ABCCommon base class for all plugins.
There are different groups of plugins, i.e. search plugin, retrieve plugin, and extension plugins. These groups differ on where within this lookup server core they are hooked to. All of them are discovered via the python entrypoints mechanism.
Any plugin MUST implement a register_dataset method, and SHOULD implement a delete_dataset methods. While register_dataset is primarily intended to create new a dataset entry (but may as well replace an existing entry), the register_dataset is primarily intended to replace an existing entry (but may as well create a new entry). register_dataset MUST be idempotent. patch_update_dataset SHOULD update an existing entry partially by only modifying specified fields and MUST not create new entries. delete_dataset SHOULD remove a dataset entry from the plugin’s database if applicable.
- abstract register_dataset(dataset_info: RegisterDatasetSchema)
Register or update a dataset entry by replacing a possibly existing entry. Idempotent.
The base URI is in the dataset_info. It is assumed that preflight checks have been made to ensure that the base URI has been registered and that the user has permissions to perform the action.
- delete_dataset(dataset_uri: str)
Delete a dataset from the index by their URI.
- get_config()
Return the Config object of the retrieve plugin.
- get_config_secrets_to_obfuscate()
Return a list of config keys never to be exposed in clear text.
- class dservercore.SearchABC
Bases:
PluginABCAny search plugin must inherit from this base class.
- abstract search(query: SearchDatasetSchema, pagination_parameters: PaginationParameters = None, sort_parameters: SortParameters = None) <DatasetSchema(many=True)>
Search for datasets.
It is assumed that preflight checks have been made to ensure that the user has permissions to perform the action and that the base URIs in the query have been limited to those the user has permissions to search.
The search method is hooked into utils.search_datasets_by_user and MUST process a query argument adhering to SearchDatasetSchema, meaning
- {
- “base_uris”: [
“string”
], “free_text”: “string”, “uuids”: [
“string”
], “creator_usernames”: [
“string”
], “tags”: [
“string”
]
}
at the time of writing.
The search plugin SHOULD make use of “OR” logic for the items in “base_uris” and “creator_usernames” lists, but use “AND” logic for filtering the search based on the items in the tags list.
If pagination and sorting parameters are supplied, the plugin SHOULD provide the desired subset of datasets.
- delete_dataset(dataset_uri: str)
Delete a dataset from the index by their URI.
- get_config()
Return the Config object of the retrieve plugin.
- get_config_secrets_to_obfuscate()
Return a list of config keys never to be exposed in clear text.
- abstract register_dataset(dataset_info: RegisterDatasetSchema)
Register or update a dataset entry by replacing a possibly existing entry. Idempotent.
The base URI is in the dataset_info. It is assumed that preflight checks have been made to ensure that the base URI has been registered and that the user has permissions to perform the action.
- class dservercore.RetrieveABC
Bases:
ABCAny retrieve plugin must inherit from this base class.
- abstract get_readme(uri)
Return the dataset readme.
It is assumed that preflight checks have been made to ensure that the user has permissions to access the URI.
- abstract get_manifest(uri)
Return the dataset manifest.
It is assumed that preflight checks have been made to ensure that the user has permissions to access the URI.
- abstract get_annotations(uri)
Return the dataset annotations.
It is assumed that preflight checks have been made to ensure that the user has permissions to access the URI.
- abstract get_tags(uri)
Return the dataset tags.
It is assumed that preflight checks have been made to ensure that the user has permissions to access the URI.
- class dservercore.ExtensionABC
Bases:
ABCAny extension plugin must inherit from this base class.
- An extension MUST implement:
a register_dataset(self, dataset_info) method.
a get_config() method.
a get_blueprint() method. This also means the extension MUST provide a single blueprint.
- An extension MAY implement
The app factory will inject extension config parameters into the global Flask app config. An extension SHOULD hence:
prefix their config parameter keys uniquely, for example with their capitalized module name
retrieve config parameters in a Flask-typical fashion, i.e. from the environment or from file as done within the core at dservercore.config.Config
provide these parameters via the get_config method.
access at runtime via global Flask config, i.e. app.config
- abstract get_blueprint()
Return the Flask blueprint to be used for the extension.
- init_app(app, *args, **kwargs)
Called by Flask app factory.
- dservercore.create_app(test_config=None)
Modules
Route for retrieving dataset annotations by URI. |
|
Routes for Base URI management |
|
Custom dserver Blueprint |
|
Command line utility functions. |
|
dserver Flask app configuration |
|
Routes for retrieving server and server-side plugin configuration |
|
Validation utility functions. |
|
Flask extensions |
|
Route for retrieving the manifest of a dataset |
|
Routes for me (information on currently authenticated user) |
|
Route for retrieving the readme of a dataset |
|
marshmallow schema for (de-) serialization and validation |
|
Sort feature |
|
Database models and derived schemas |
|
Route for retrieving tags of a dataset |
|
Routes for querying and managing dataset entries by their URIs |
|
Routes for user management |
|
Utility functions. |
|
Auth utility functions. |
|
Routes for querying dataset entries by their UUIDs |
|