Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
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
5 changes: 4 additions & 1 deletion beacon_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
__createtime__ = CONFIG_INFO.createtime
__updatetime__ = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ') # Every restart of the application means an update to it


__org_id__ = CONFIG_INFO.org_id
__org_name__ = CONFIG_INFO.org_name
__org_description__ = CONFIG_INFO.org_description
Expand All @@ -37,3 +36,7 @@
__org_info__ = {'orgInfo': CONFIG_INFO.org_info}

__sample_queries__ = SAMPLE_QUERIES

# GA4GH Discovery
__service_type__ = f'{CONFIG_INFO.service_type}:{__apiVersion__}'
__service_env__ = CONFIG_INFO.environment
17 changes: 11 additions & 6 deletions beacon_api/api/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .. import __apiVersion__, __title__, __version__, __description__, __url__, __alturl__, __handover_beacon__
from .. import __createtime__, __updatetime__, __org_id__, __org_name__, __org_description__
from .. import __org_address__, __org_logoUrl__, __org_welcomeUrl__, __org_info__, __org_contactUrl__
from .. import __sample_queries__, __handover_drs__, __docs_url__
from .. import __sample_queries__, __handover_drs__, __docs_url__, __service_type__, __service_env__
from ..utils.data_query import fetch_dataset_metadata
from ..extensions.handover import make_handover
from aiocache import cached
Expand All @@ -26,13 +26,18 @@ async def ga4gh_info(host):
# TO DO implement some fallback mechanism for ID
'id': '.'.join(reversed(host.split('.'))),
'name': __title__,
"type": "urn:ga4gh:beacon",
"type": __service_type__,
'description': __description__,
'documentationUrl': __docs_url__,
"organization": __org_id__,
"organization": {
"name": __org_name__,
"url": __org_welcomeUrl__,
},
'contactUrl': __org_contactUrl__,
'version': __version__,
"extension": {}
'documentationUrl': __docs_url__,
'createdAt': __createtime__,
'updatedAt': __updatetime__,
'environment': __service_env__,
'version': __version__
}
return beacon_info

Expand Down
2 changes: 2 additions & 0 deletions beacon_api/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def parse_config_file(path):
'url': config.get('beacon_api_info', 'url'),
'alturl': config.get('beacon_api_info', 'alturl'),
'createtime': config.get('beacon_api_info', 'createtime'),
'service_type': config.get('beacon_api_info', 'service_type'),
'environment': config.get('beacon_api_info', 'environment'),
'org_id': config.get('organisation_info', 'org_id'),
'org_name': config.get('organisation_info', 'org_name'),
'org_description': config.get('organisation_info', 'org_description'),
Expand Down
9 changes: 8 additions & 1 deletion beacon_api/conf/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
title=GA4GHBeacon at CSC

# Version of the Beacon implementation
version=1.4.0
version=1.4.1

# Author of this software
author=CSC developers
Expand Down Expand Up @@ -41,6 +41,13 @@ alturl=
# Datetime when this Beacon was created
createtime=2018-07-25T00:00:00Z

# GA4GH Discovery type `groupId` and `artifactId`, joined in /service-info with apiVersion
# See https://github.com/ga4gh-discovery/ga4gh-service-registry for more information and possible values
service_type=org.ga4gh:beacon

# GA4GH Discovery server environment, possible values: prod, dev, test
environment=prod


[organisation_info]
# Globally unique identifier for organisation that hosts this Beacon service
Expand Down
7 changes: 7 additions & 0 deletions deploy/test/auth_test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ alturl=https://ega-archive.org/
# Datetime when this Beacon was created
createtime=2018-07-25T00:00:00Z

# GA4GH Discovery type `groupId` and `artifactId`, joined in /service-info with apiVersion
# See https://github.com/ga4gh-discovery/ga4gh-service-registry for more information and possible values
service_type=org.ga4gh:beacon

# GA4GH Discovery server environment, possible values: prod, dev, test
environment=prod


[handover_info]
# The base url for all handovers
Expand Down
4 changes: 2 additions & 2 deletions deploy/test/integ_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,6 @@ async def test_32():
data = await resp.json()
# GA4GH Discovery Service-Info is small and its length should be between 3 and 6, when the Beacon info is very long
# https://github.com/ga4gh-discovery/service-info/blob/develop/service-info.yaml
assert 5 <= len(data) <= 9, 'Service info size error' # ga4gh service-info has 5 required keys and at most 9 with optionals
assert data['type'] == 'urn:ga4gh:beacon', 'Service type error' # a new key used in beacon network
assert len(data) >= 5, 'Service info size error' # ga4gh service-info has 5 required keys, and option to add custom keys
assert data['type'].startswith('org.ga4gh:beacon'), 'Service type error' # a new key used in beacon network
assert resp.status == 200, 'HTTP Status code error'
12 changes: 10 additions & 2 deletions docs/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,18 @@ Example Response:
{
"id": "localhost:5050",
"name": "GA4GHBeacon at CSC",
"type": "org.ga4gh:beacon:1.1.0",
"description": "Beacon API Web Server based on the GA4GH Beacon API",
"documentationUrl": "https://beacon-python.readthedocs.io/en/latest/",
"organization": {
"name": "CSC - IT Center for Science",
"url": "https://www.csc.fi/"
},
"contactUrl": "https://www.csc.fi/contact-info",
"version": "1.4.0"
"documentationUrl": "https://beacon-network.readthedocs.io/en/latest/",
"createdAt": "2019-09-04T12:00:00Z",
"updatedAt": "2019-09-05T05:55:18Z",
"environment": "prod",
"version": "1.4.1"
}

Query Endpoint
Expand Down
4 changes: 2 additions & 2 deletions docs/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pointing to the location of the file using `CONFIG_FILE` environment variable.

.. literalinclude:: /../beacon_api/conf/config.ini
:language: python
:lines: 1-68
:lines: 1-75

.. _oauth2:

Expand All @@ -81,7 +81,7 @@ The configuration variables reside in the same `CONFIG_FILE` as described above

.. literalinclude:: /../beacon_api/conf/config.ini
:language: python
:lines: 90-116
:lines: 97-123

* ``server`` should point to an API that returns a public key, which can be used to validate the received JWTBearer token.
* ``issuers`` is a string of comma separated values, e.g. `one,two,three` without spaces. The issuers string should contain
Expand Down
2 changes: 1 addition & 1 deletion docs/optionals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The handover protocol can be configured in ``config.ini`` as follows:

.. literalinclude:: /../beacon_api/conf/config.ini
:language: python
:lines: 71-87
:lines: 78-94

.. note:: Handover protocol is disabled by default, as shown by the commented out ``drs`` variable. This variable should point
to the server, which serves the additional data. To enable the handover protocol, uncomment the ``drs`` variable.
Expand Down
7 changes: 7 additions & 0 deletions tests/test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ alturl=https://ega-archive.org/
# Datetime when this Beacon was created
createtime=2018-07-25T00:00:00Z

# GA4GH Discovery type `groupId` and `artifactId`, joined in /service-info with apiVersion
# See https://github.com/ga4gh-discovery/ga4gh-service-registry for more information and possible values
service_type=org.ga4gh:beacon

# GA4GH Discovery server environment, possible values: prod, dev, test
environment=test


[handover_info]
# The base url for all handovers
Expand Down