Models documentation

Enum Models

Messages.py

Module regrouping enumerations containing messages.

It includes different kind of messages :

  • Messages returned during the parsing of lipid names by Pygoslin tool.

  • Messages that may be returned by the application in case of errors.

  • Messages returned by the application serving as information for users.

  • Messages related to the local “database” built at the start of the application.

class src.models.enums.Messages.ErrorMessages(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Regroups the error messages that the application may return.

BAD_REQUEST = 'Bad request - There is an error in the request.\rThere must be at least one query parameter named "lipid_names". It takes a lipid name as value and can be repeated.\rExample : /goslin/validate?lipid_name=value1&lipid_name=value2'
class src.models.enums.Messages.GoslinMessages(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Regroups messages that can be returned in the response obtained after parsing with Pygoslin tool.

LIPIDMAPS_REF_NOT_FOUND = 'Standardized name not link with any entry in the LipidMaps Structure Database'
LIPID_NOT_FOUND = 'Lipid not found'
NO_CLASS_NAME = 'UNDEFINED'
NO_FORMULA = 'The formula for this lipid could not be calculated.'
NO_MASS = 'The mass of this lipid could not be calculated.'
class src.models.enums.Messages.InformativeMessages(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Regroups the informative messages that the application may return.

ROOT = 'You are at the root of the Goslin API. Please refer to the Swagger documentation to know the existing endpoint.\rIt is available here : https://metabocloud.mesocentre.uca.fr/goslin/api/doc'
class src.models.enums.Messages.LocalDatabase(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Regroups messages related to the local database built from the LipidMaps Structure Database.

FILE_NOT_FOUND = 'The SDF file containing the LipidMaps Structure Database was not found. \n    The local database could not be created.'
NO_LOCAL_DATABASE = 'Information coming from this database could not be retrieved (LipidMaps ID, InCHI key and SwissLipids ID). Error during the creation of the local database.'
class src.models.enums.Messages.State(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Regroups the different states that a parsing result can take.

FAILURE = 'Failure'
SUCCESS = 'Success'
UNCOMPLETED = 'Uncompleted'

Paths.py

Module regrouping enumerations containing paths.

It includes all paths used in the application.

class src.models.enums.Paths.Paths(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Paths used in the API.

LIPIDMAPS_DATABASE = 'http://mirror.dsi.uca.fr/metabocloud/structures.sdf'

URL to the SDF file containing the LipidMaps Structure Database.

LIPID_CLASSES_SUPPORTED = './resources/lipid-list.csv'

Relative path to the CSV file containing the lipid class that are supported by the Goslin tool. This file comes from the package pygoslin.

METADATA_JSON = './resources/goslin_about.json'

Relative path to the template JSON file with the metadata of a microservice.

OPENAPI_DOC = 'https://metabocloud.mesocentre.uca.fr/goslin/api/doc'

URL to the OpenAPI documentation.

OPENAPI_YAML = './resources/metabocloud-goslin.yaml'

Relative path to the YAML OpenAPI specification.


Object Models

LipidMapsEntry.py

class src.models.objects.LipidMapsEntry.LipidMapsEntry(lipidmaps_id: str = None, inchi_key: str = None, standardized_name: str = None, swiss_lipids: str = None)

An Object model to store LipidMaps Structure Database entry

property inchi_key: str

Gets the InChI Key of the lipid.

Returns:

The InChI Key of the lipid.

Return type:

str

property lipidmaps_id: str

Gets the LipidMaps ID of the lipid.

Returns:

The LipidMaps ID of the lipid.

Return type:

str

property standardized_name: str

Gets the standardized name of the lipid.

Returns:

The standardized name of the lipid.

Return type:

str

property swiss_lipids: str

Gets the SwissLipids ID of the lipid.

Returns:

The SwissLipids ID of the lipid.

Return type:

str

to_dict()

Returns the model properties as a dictionary

Returns:

The model properties as a dictionary

Return type:

dict


Vars.py

class src.models.objects.Vars.Vars

Variables used in the API.

LIPIDMAPS_DATABASE = []

Variable which will store the local database built from the SDF file of the LipidMaps Structure Database during the launch of the application. It will be a list a dictionary where each dictionary will contain 4 keys : LIPIDMAPS_ID, INCHI_KEY, STANDARDIZED_NAME and SWISSLIPIDS_ID.

METADATA = {'SHA_1': None, 'SHORT_SHA_1': None, 'TIMESTAMP': None}

Variable which will store the metadata about the version of the microservice that will be retrieve during the launch of the application.