Controllers documentation

A Controller is a module that implements operations defined by the API. It will receive the request, process it and send back the response.

about_controller.py

Controller managing requests directed to the “/about” endpoint for Goslin REST API.

src.controllers.about_controller.retrieve_information() dict

Handle GET requests to the “/about” endpoint.

It provides metadata about the Goslin tool and the microservice.

Returns:

Metadata about the application in JSON format.

Return type:

dict

grammars_controller.py

Controller managing requests directed to the “/grammars” endpoint for Goslin REST API.

src.controllers.grammars_controller.retrieve_grammars() list[str]

Handle GET requests to the “/grammars” endpoint.

It provides a list of grammars available in the Goslin tool.

Returns:

A list with all the grammars available in the Goslin tool as JSON format.

Return type:

list[str]

root_controller.py

Controller managing requests directed to the “/” root endpoint for Goslin REST API.

src.controllers.root_controller.read_root() str

Handle GET requests to the root endpoint (“/”).

Responds with a message indicating that users should refer to the OpenAPI documentation for details about the available API endpoints and their associated requests.

Returns:

An informative message.

Return type:

str

validate_controller.py

Controller managing requests directed to the “/validate” endpoint for Goslin REST API

src.controllers.validate_controller.validate_lipid_names(lipid_names: Annotated[list[str], Query(PydanticUndefined)]) dict

Handle GET requests to the “/validate” endpoint.

Standardizes lipid names passed in the query and retrieves related information.

It can return three types of parsing result :

  • When the parsing is successful, it returns the standardized lipid name along with information on the lipid :

    • The grammar used to normalize the lipid name.

    • The lipid class and category in the taxonomy.

    • The level of nomenclature describing the lipid structure.

    • The molecular mass and formula of the lipid.

  • When the parsing is uncompleted, it returns “messages” indicating how far the grammar was able to read the lipid name.

  • When the parsing failed, it returns a message indicating that the lipid was not found in any grammars.

Parameters:

lipid_names (str) – Mandatory query parameter specifying a lipid encoded name to parse.

Returns:

Parsing results for all the lipid names sent in the request.

Return type:

dict