Skip to content

Commit

Permalink
1.3.6
Browse files Browse the repository at this point in the history
see docs/changes.md (or the website)
  • Loading branch information
mbaudis committed Nov 27, 2023
1 parent 48c337d commit be19a12
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 428 deletions.
6 changes: 0 additions & 6 deletions bycon/beaconServer/beacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ def beacon():
run_beacon_init_stack(byc)
r = BeaconDataResponse(byc).resultsetResponse()
print_json_response(r, byc["env"])
# byc.update({
# "service_response": r.resultsetResponse(),
# "error_response": r.errorResponse()
# })
# cgi_print_response(byc, 200)

elif f:
# dynamic package/function loading; e.g. `filtering_terms` loads
# `filtering_terms` from `filtering_terms.py`...
Expand Down
4 changes: 2 additions & 2 deletions bycon/config/datatable_mappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ definitions:
type: string
db_key: variant_state.label
compact: True
reference_bases:
reference_sequence:
type: string
db_key: reference_sequence
indexed: True
compact: True
alternate_bases:
sequence:
type: string
db_key: sequence
indexed: True
Expand Down
11 changes: 9 additions & 2 deletions bycon/lib/beacon_response_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, byc: dict):
self.service_config = self.byc.get("service_config", {})
self.response_schema = byc["response_schema"]
self.requested_granularity = self.form_data.get("requested_granularity", "record")
self.include_handovers = self.form_data.get("include_handovers", False)
self.beacon_schema = self.byc["response_entity"].get("beacon_schema", "___none___")
self.record_queries = {}
self.data_response = object_instance_from_schema_name(byc, self.response_schema, "")
Expand All @@ -94,7 +95,13 @@ def resultsetResponse(self):
self.data_response["response"].update({"result_sets": self.result_sets})
self.__resultset_response_update_summaries()
if not "record" in self.requested_granularity:
self.data_response.pop("response", None)
# TODO /CUSTOM: This non-standard modification removes the results
# but keeps the resultSets nstructure (handovers ...)
if self.include_handovers is True:
for rs in self.data_response["response"]["result_sets"]:
rs.pop("results", None)
else:
self.data_response.pop("response", None)
if "boolean" in self.requested_granularity:
self.data_response["response_summary"].pop("num_total_results", None)

Expand Down Expand Up @@ -585,14 +592,14 @@ def __init__(self, byc: dict):
# -------------------------------------------------------------------------#

def populatedResultSets(self):

self.__retrieve_datasets_data()
self.__retrieve_variants_data()
self.__populate_result_sets()
self.__result_sets_save_handovers()

return self.result_sets, self.record_queries


# -------------------------------------------------------------------------#

def datasetsData(self):
Expand Down
12 changes: 6 additions & 6 deletions bycon/lib/cgi_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ def parse_GET(byc):
if not "filters" in form:
form.update({"filters": []})

form.update({
"requested_granularity": get.getvalue("requestedGranularity", b_defs.get("requested_granularity", "record")),
"include_resultset_responses": get.getvalue("includeResultsetResponses",
b_defs.get("include_resultset_responses", "HIT")),
"include_handovers": get.getvalue("includeHandovers", b_defs.get("include_handovers", False))
})
# form.update({
# "requested_granularity": get.getvalue("requestedGranularity", b_defs.get("requested_granularity", "record")),
# "include_resultset_responses": get.getvalue("includeResultsetResponses",
# b_defs.get("include_resultset_responses", "HIT")),
# "include_handovers": get.getvalue("includeHandovers", b_defs.get("include_handovers", False))
# })

if "requested_schema" in form:
try:
Expand Down
30 changes: 16 additions & 14 deletions bycon/lib/dataset_parsing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pymongo
import re
from pymongo import MongoClient
from os import environ

from bycon.lib.cgi_parsing import rest_path_value


################################################################################

def select_dataset_ids(byc):
Expand All @@ -24,17 +23,6 @@ def select_dataset_ids(byc):

################################################################################

def ds_id_from_default(byc):
ds_id = byc.get("default_dataset_id", "___undefined___")

if ds_id not in byc["dataset_definitions"].keys():
return False

byc.update({"dataset_ids": [ ds_id ]})
return True

################################################################################

def ds_id_from_rest_path_value(byc):
ds_id = rest_path_value("datasets")
if ds_id is None:
Expand All @@ -60,7 +48,7 @@ def ds_id_from_accessid(byc):
if any(x is False for x in [accessid, ho_db, ho_collname]):
return False

ho_client = pymongo.MongoClient(host=environ.get("BYCON_MONGO_HOST", "localhost"))
ho_client = MongoClient(host=environ.get("BYCON_MONGO_HOST", "localhost"))
h_o = ho_client[ho_db][ho_collname].find_one({"id": accessid})
if not h_o:
return False
Expand Down Expand Up @@ -107,3 +95,17 @@ def ds_ids_from_args(byc):
return True

return False


################################################################################

def ds_id_from_default(byc):
ds_id = byc.get("default_dataset_id", "___undefined___")

if ds_id not in byc["dataset_definitions"].keys():
return False

byc.update({"dataset_ids": [ ds_id ]})
return True


Loading

0 comments on commit be19a12

Please sign in to comment.