Skip to content

Commit

Permalink
Merge branch 'master' into features/filtering-terms-from-config
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfk committed Aug 22, 2024
2 parents 748f1d6 + 7ad800d commit c7bb887
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
5 changes: 3 additions & 2 deletions bento_beacon/config_files/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ class Config:
KATSU_DISEASES_TERMS_ENDPOINT = "/api/disease_term_autocomplete"
KATSU_SAMPLED_TISSUES_TERMS_ENDPOINT = "/api/biosample_sampled_tissue_autocomplete"
KATSU_PUBLIC_CONFIG_ENDPOINT = "/api/public_search_fields"
KATSU_INDIVIDUAL_SCHEMA_ENDPOINT = "/api/chord_phenopacket_schema"
KATSU_EXPERIMENT_SCHEMA_ENDPOINT = "/api/experiment_schema"
KATSU_INDIVIDUAL_SCHEMA_ENDPOINT = "/api/schemas/phenopacket"
KATSU_EXPERIMENT_SCHEMA_ENDPOINT = "/api/schemas/experiment"
KATSU_BEACON_SEARCH = "/api/beacon_search"
KATSU_SEARCH_OVERVIEW = "/api/search_overview"
KATSU_PRIVATE_OVERVIEW = "/api/overview"
KATSU_PUBLIC_OVERVIEW = "/api/public_overview"
KATSU_PUBLIC_RULES = "/api/public_rules"
KATSU_TIMEOUT = int(os.environ.get("BEACON_KATSU_TIMEOUT", 180))

MAP_EXTRA_PROPERTIES_TO_INFO = os.environ.get("MAP_EXTRA_PROPERTIES_TO_INFO", True)
Expand Down
2 changes: 1 addition & 1 deletion bento_beacon/endpoints/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def build_ga4gh_service_info():
"name": info["name"],
"type": {"artifact": "Beacon v2", "group": "org.ga4gh", "version": info["apiVersion"]},
"environment": info["environment"],
"organization": {"name": info["organization"]["name"], "url": info["organization"]["welcomeUrl"]},
"organization": {"name": info["organization"]["name"], "url": info["organization"].get("welcomeUrl", "")},
"contactUrl": info["organization"]["contactUrl"],
"version": info["version"],
"bento": {"serviceKind": "beacon"},
Expand Down
7 changes: 4 additions & 3 deletions bento_beacon/utils/katsu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ def overview_statistics():


def katsu_censorship_settings() -> tuple[int | None, int | None]:
overview = katsu_get(current_app.config["KATSU_PUBLIC_OVERVIEW"])
max_filters = overview.get("max_query_parameters")
count_threshold = overview.get("count_threshold")
# TODO: should be project-dataset scoped
rules = katsu_get(current_app.config["KATSU_PUBLIC_RULES"])
max_filters = rules.get("max_query_parameters")
count_threshold = rules.get("count_threshold")
# return even if None
return max_filters, count_threshold

Expand Down
6 changes: 6 additions & 0 deletions bento_beacon/utils/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from flask import current_app
from functools import reduce
from .gohan_utils import query_gohan
from .katsu_utils import katsu_filters_query, search_from_config, biosample_ids_for_individuals
from .beacon_response import add_info_to_response


# TODO: search by linked field set elements instead of hardcoding
Expand All @@ -11,6 +13,10 @@ def biosample_id_search(variants_query=None, phenopacket_filters=None, experimen
return []

if variants_query:
if not current_app.config["BEACON_CONFIG"].get("useGohan"):
# variants query even though there are no variants in this beacon, this can happen in a network context
add_info_to_response("No variants available at this beacon, query by metadata values only")
return []
variant_sample_ids = query_gohan(variants_query, "count", ids_only=True)
if not variant_sample_ids:
return []
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
aiohttp==3.9.5
aiohttp==3.10.2
aiosignal==1.3.1
annotated-types==0.6.0
arrow==1.2.3
async-timeout==4.0.3
attrs==22.2.0
autopep8==1.6.0
bento-lib==10.1.1
certifi==2024.6.2
certifi==2024.7.4
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.7
Expand Down Expand Up @@ -49,4 +49,4 @@ urllib3==1.26.19
webcolors==1.12
Werkzeug==2.2.3
yarl==1.9.3
zipp==3.17.0
zipp==3.19.1

0 comments on commit c7bb887

Please sign in to comment.