Skip to content

Commit

Permalink
Merge pull request #40 from omics-datascience/celery-integration
Browse files Browse the repository at this point in the history
Celery integration
  • Loading branch information
Genarito authored Oct 5, 2023
2 parents c30d923 + 7b69414 commit cead8f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/api_service/mrna_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from json.decoder import JSONDecodeError
from typing import Any, Dict, Optional, Literal
from typing import Any, Dict, Optional, Literal, Union
import requests
from django.conf import settings
from django.http import QueryDict
Expand Down Expand Up @@ -35,7 +35,7 @@ def __get_service_content(
url_prefix: str,
method: Literal['get', 'post'],
append_slash: bool
) -> Optional[Any]:
) -> Optional[Union[Dict, str]]:
"""
Generic function to make a request to a Modulector/BioAPI service
@param service_name: Modulector/BioAPI service to consume
Expand Down Expand Up @@ -66,9 +66,8 @@ def __get_service_content(
logging.warning(f'{method.upper()} to {url} returned status_code {data.status_code} and '
f'message: {data.content}')
return None

content_type = data.headers.get('Content-Type', '')
print(content_type)
if 'application/json' in content_type:
return data.json()
elif 'text/plain' in content_type or 'text/html' in content_type:
Expand Down
2 changes: 1 addition & 1 deletion src/molecules_details/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
path('gene-ontology-term-terms', views.GeneOntologyTermsOfTerm.as_view(), name='gene_ontology_term_terms'),
path('actionable-cancer-genes', views.ActionableAndCancerGenes.as_view(), name='actionable_cancer_genes'),
path('drugs-pharmgkb', views.DrugsPharmGKB.as_view(), name='drugs_pharmgkb'),
path('predicted-functiona-associations-network', views.PredictedFunctionalAssociationsNetwork.as_view(), name='predicted_functiona_associations_network'),
path('predicted-functional-associations-network', views.PredictedFunctionalAssociationsNetwork.as_view(), name='predicted_functional_associations_network'),
path('drugs-regulating-gene', views.DrugsRegulatingGene.as_view(), name='drugs_regulating_gene')
]
5 changes: 2 additions & 3 deletions src/molecules_details/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ class PredictedFunctionalAssociationsNetwork(APIView):
"""
Gets a list of genes and relations related to a gene.
Examples:
http://localhost:8000/molecules/predicted-functiona-associations-network?gene=MX2&score=996
http://localhost:8000/molecules/predicted-functiona-associations-network?gene=BRCA1&score=995
http://localhost:8000/molecules/predicted-functional-associations-network?gene=MX2&score=996
http://localhost:8000/molecules/predicted-functional-associations-network?gene=BRCA1&score=995
"""

permission_classes = [permissions.IsAuthenticated]
Expand Down Expand Up @@ -401,4 +401,3 @@ def get(request: HttpRequest):
return Response({
'data': data
})

0 comments on commit cead8f0

Please sign in to comment.