diff --git a/drugstone/settings/celery_schedule.py b/drugstone/settings/celery_schedule.py index b066327c53c3c8f9beb7f969723311d538371221..83ee1d3cc6f2ff8192707e58814d705491f51758 100644 --- a/drugstone/settings/celery_schedule.py +++ b/drugstone/settings/celery_schedule.py @@ -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'), }, } diff --git a/drugstone/urls.py b/drugstone/urls.py index 886dbdd75f3ba34cc6fe475760096a12eee94879..7e0d16a49c23fdbbccef3c1f1d6f39fe833eb162 100755 --- a/drugstone/urls.py +++ b/drugstone/urls.py @@ -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), diff --git a/drugstone/views.py b/drugstone/views.py index 5ddea2f3fc451d33408945aa1b55861118b3f6dc..3175ef60a0f82b8b7779dd93c13b4f834df9fb1c 100755 --- a/drugstone/views.py +++ b/drugstone/views.py @@ -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') diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index 3c90d86f54ec7daebdfb9694939d1038ed24857c..43bf32df3da5898d25d96f8abd734edf4872ea3c 100755 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -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"