Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created specific info meta response to adjust to Beacon v2 standards #358

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon/api_version.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
api_version: v2.0-1ef4350
api_version: v2.0-39cc125
21 changes: 20 additions & 1 deletion beacon/response/build_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ def build_meta(qparams: RequestParams, entity_schema: Optional[DefaultSchemas],
}
return meta

def build_info_meta(qparams: RequestParams, entity_schema: Optional[DefaultSchemas], returned_granularity: Granularity):
""""Builds the `meta` part of the response

We assume that receivedRequest is the evaluated request (qparams) sent by the user.
"""
try:
meta = {
'beaconId': conf.beacon_id,
'apiVersion': conf.api_version,
'returnedSchemas': [entity_schema.value] if entity_schema is not None else []
}
except Exception:
meta = {
'beaconId': conf.beacon_id,
'apiVersion': conf.api_version,
'returnedSchemas': [entity_schema.value] if entity_schema is not None else []
}
return meta

def build_response_summary(exists, num_total_results):
LOG.debug(num_total_results)
if num_total_results is None:
Expand Down Expand Up @@ -234,7 +253,7 @@ def build_beacon_info_response(data, qparams, func_response_type, authorized_dat
authorized_datasets = []

beacon_response = {
'meta': build_meta(qparams, None, Granularity.RECORD),
'meta': build_info_meta(qparams, None, Granularity.RECORD),
'response': {
'id': conf.beacon_id,
'name': conf.beacon_name,
Expand Down
Loading