Skip to content
Snippets Groups Projects
Commit a50908c8 authored by AndiMajore's avatar AndiMajore
Browse files

fixing backend routes

parent 558ab6fd
No related branches found
No related tags found
No related merge requests found
Pipeline #63165 failed
......@@ -3,6 +3,7 @@ from celery.schedules import crontab
CELERY_BEAT_SCHEDULE = {
'update_db': {
'task': 'drugstone.tasks.task_update_db_from_nedrex',
'schedule': crontab(day_of_week=1, hour=5, minute=0),
'schedule': crontab(day_of_week=1, hour=6, minute=0),
# 'schedule': crontab(minute='*/1'),
},
}
......@@ -34,7 +34,7 @@ urlpatterns = [
path('adjacent_drugs/', adjacent_drugs),
path('adjacent_disorders/', adjacent_disorders),
path('tissue_expression/', TissueExpressionView.as_view()),
path('tissue_max_expression/', get_max_tissue_expression()),
path('tissue_max_expression/', get_max_tissue_expression),
path('tissues/', TissueView.as_view()),
path('admin/', admin.site.urls),
path('create_network', create_network),
......
......@@ -653,21 +653,30 @@ class TissueView(APIView):
return Response(TissueSerializer(many=True).to_representation(tissues))
class TissueExpressionView(APIView):
"""
Expression of host proteins in tissues.
"""
def get(self, request) -> Response:
tissue = Tissue.objects.get(id=request.query_params.get('tissue'))
proteins = request.query_params.get('proteins')
token = request.query_params.get('token')
return self.get_tissue_expression(tissue, proteins, token)
def post(self, request) -> Response:
tissue = Tissue.objects.get(id=request.data.get('tissue'))
proteins = request.data.get('proteins')
token = request.data.get('token')
return self.get_tissue_expression(tissue, proteins, token)
if request.data.get('proteins'):
ids = json.loads(request.data.get('proteins'))
def get_tissue_expression(self, tissue, proteins, token):
if proteins is not None:
ids = json.loads(proteins)
proteins = list(Protein.objects.filter(id__in=ids).all())
elif request.data.get('token'):
elif token is not None:
proteins = []
task = Task.objects.get(token=request.data['token'])
task = Task.objects.get(token=token)
result = task_result(task)
network = result['network']
node_attributes = result.get('node_attributes')
......
......@@ -4,7 +4,7 @@ python3 manage.py makemigrations drugstone
python3 manage.py migrate
python3 manage.py createfixtures
python3 manage.py cleanuptasks
#python3 manage.py populate_db --update -a
python3 manage.py populate_db --update -a
python3 manage.py make_graphs
/usr/bin/supervisord -c "/etc/supervisor/conf.d/supervisord.conf"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment