Commit 2cba5a05 authored by David Mendez's avatar David Mendez
Browse files

Add endpoint for first eubopen visualisation

parent bb0f02db
# Run development server
```bash
FLASK_APP=app flask run --host=0.0.0.0
```
......@@ -18,6 +18,7 @@ from app.blueprints.visualisation_data.controllers.visualisation_data_controller
from app.blueprints.utils.controllers.utils_controller import UTILS_BLUEPRINT
from app.blueprints.entities_join.controllers.entities_join_controller import ENTITIES_JOIN_BLUEPRINT
from app.blueprints.eubopen.search.controller import EUBOPEN_SEARCH_BLUEPRINT
from app.blueprints.eubopen.visualisations.controller import EUBOPEN_VISUALISATIONS_BLUEPRINT
def create_app():
......@@ -89,6 +90,10 @@ def create_app():
{
'blueprint': EUBOPEN_SEARCH_BLUEPRINT,
'url': '/eubopen/search'
},
{
'blueprint': EUBOPEN_VISUALISATIONS_BLUEPRINT,
'url': '/eubopen/visualisations'
}
]
......
......@@ -8,7 +8,6 @@ from app.blueprints.eubopen.search import marshmallow_schemas
from app.blueprints.eubopen.search import services
EUBOPEN_SEARCH_BLUEPRINT = Blueprint('eubopen_search', __name__)
print('GOING TO REGISTER EUBOPEN BLUEPRINT')
@EUBOPEN_SEARCH_BLUEPRINT.route('/autocomplete/<term>', methods=['GET'])
......
"""
Controller for handling the requests for the eubopen visualisations
"""
from flask import Blueprint, jsonify
from app.request_validation.decorators import validate_url_params_with
from app.blueprints.eubopen.visualisations import services
EUBOPEN_VISUALISATIONS_BLUEPRINT = Blueprint('eubopen_visualisations', __name__)
@EUBOPEN_VISUALISATIONS_BLUEPRINT.route('/target_classifications/protein_classification', methods=['GET'])
def get_protein_target_classification():
"""
:return: the json response with the protein target classification
"""
try:
json_data = services.get_protein_target_classification()
http_response = jsonify(json_data)
return http_response
except services.VisualisationServiceError as error:
abort(500, msg=f'Internal server error: {str(error)}')
"""
Services for the eubopen visualisations
"""
class VisualisationServiceError(Exception):
"""
Base class for errors in this module
"""
def get_protein_target_classification():
"""
:return: the json response with the protein target classification
"""
return {
'msg': 'hello'
}
......@@ -201,7 +201,7 @@ chembl_target:
sortable: true
'target_synonyms':
based_on: 'target_components'
label: 'Target Synonyms'
label: 'Synonyms'
'length':
label: 'Length'
label_mini: 'Length'
......
......@@ -472,6 +472,20 @@ paths:
description: "success"
schema:
$ref: '#/definitions/COVIDEntitiesRecordsResponse'
/eubopen/visualisations/target_classifications/protein_classification:
get:
tags:
- 'Visualisations'
summary: 'Get the Protein Target classification tree for EUbOPEN'
description: 'Returns the EUbOPEN Protein Target classification tree'
operationId: 'get_euobpen_protein_target_classification'
produces:
- 'application/json'
responses:
'200':
description: "success"
schema:
$ref: '#/definitions/EUbOPENProteinTargetClassificationResponse'
/utils/identify_separator:
post:
tags:
......@@ -669,6 +683,8 @@ definitions:
type: 'string'
ProteinTargetClassificationResponse:
type: "object"
EUbOPENProteinTargetClassificationResponse:
type: "object"
OrganismTaxonomyTargetClassificationResponse:
type: "object"
GOSlimTargetClassificationResponse:
......
......@@ -10,6 +10,6 @@ Flask-Caching==1.8.0
pylibmc==1.6.1
Flask-Limiter==1.2.1
pymemcache==3.1.0
requests==2.23.0
requests==2.26.0
Arpeggio==1.9.2
Werkzeug==1.0.1
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment