Skip to content

Commit

Permalink
editing Makefile and max granularity
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Dec 9, 2024
1 parent 648139e commit 4c0674c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion beacon/conf/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
alternative_url = 'https://beacon.ega-archive.org/api'
create_datetime = '2021-11-29T12:00:00.000000'
update_datetime = ''
default_beacon_granularity = "record" # boolean, count or record
max_beacon_granularity = "record" # boolean, count or record
security_levels = ['PUBLIC', 'REGISTERED', 'CONTROLLED']
documentation_url = 'https://b2ri-documentation-demo.ega-archive.org/'
alphanumeric_terms = ['libraryStrategy', 'molecularAttributes.geneIds', 'diseases.ageOfOnset.iso8601duration', 'molecularAttributes.aminoacidChanges','phenotypicFeatures.onset.iso8601duration']
Expand Down
27 changes: 9 additions & 18 deletions beacon/connections/mongo/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
build:
docker cp data/analyses.json mongoprod:tmp/analyses.json
docker cp data/biosamples.json mongoprod:tmp/biosamples.json
docker cp data/cohorts.json mongoprod:tmp/cohorts.json
docker cp data/datasets.json mongoprod:tmp/datasets.json
docker cp data/genomicVariations.json mongoprod:tmp/genomicVariations.json
docker cp data/individuals.json mongoprod:tmp/individuals.json
docker cp data/runs.json mongoprod:tmp/runs.json
docker cp data/targets.json mongoprod:tmp/targets.json
docker cp data/caseLevelData.json mongoprod:tmp/caseLevelData.json
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/datasets.json --collection datasets
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/individuals.json --collection individuals
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/cohorts.json --collection cohorts
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/analyses.json --collection analyses
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/biosamples.json --collection biosamples
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/genomicVariations.json --collection genomicVariations
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/runs.json --collection runs
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/targets.json --collection targets
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /tmp/caseLevelData.json --collection caseLevelData
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/datasets.json --collection datasets
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/individuals.json --collection individuals
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/cohorts.json --collection cohorts
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/analyses.json --collection analyses
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/biosamples.json --collection biosamples
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/genomicVariations.json --collection genomicVariations
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/runs.json --collection runs
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/targets.json --collection targets
docker exec mongoprod mongoimport --jsonArray --uri "mongodb://root:[email protected]:27017/beacon?authSource=admin" --file /data/caseLevelData.json --collection caseLevelData
4 changes: 2 additions & 2 deletions beacon/request/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from strenum import StrEnum
from typing import List, Optional, Union
from beacon.conf.conf import api_version, default_beacon_granularity
from beacon.conf.conf import api_version, max_beacon_granularity
from humps.main import camelize
from aiohttp.web_request import Request
from aiohttp import web
Expand Down Expand Up @@ -83,7 +83,7 @@ class RequestQuery(CamelModel):
pagination: Pagination = Pagination()
request_parameters: Union[list,dict] = {}
test_mode: bool = False
requested_granularity: Granularity = Granularity(default_beacon_granularity)
requested_granularity: Granularity = Granularity(max_beacon_granularity)
scope: str = None

class SequenceQuery(BaseModel):
Expand Down
8 changes: 4 additions & 4 deletions beacon/response/builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from aiohttp.web_request import Request
from beacon.response.catalog import build_beacon_record_response_by_dataset, build_beacon_count_response, build_beacon_collection_response, build_beacon_info_response, build_map, build_configuration, build_entry_types, build_beacon_service_info_response, build_filtering_terms_response, build_beacon_boolean_response, build_beacon_none_response
from beacon.logs.logs import log_with_args, LOG
from beacon.conf.conf import level, default_beacon_granularity
from beacon.conf.conf import level, max_beacon_granularity
from beacon.request.classes import Granularity
from beacon.source.manage import analyses, biosamples, cohorts, datasets, g_variants, individuals, runs, filtering_terms

Expand Down Expand Up @@ -39,11 +39,11 @@ async def builder(self, request: Request, datasets, qparams, entry_type, entry_i
if testMode == True:
datasets = ['test']
datasets_docs, datasets_count, count, entity_schema, include, datasets = await module.execute_function(self, entry_type, datasets, qparams, entry_id)
if include != 'NONE' and granularity == Granularity.RECORD and default_beacon_granularity == 'record':
if include != 'NONE' and granularity == Granularity.RECORD and max_beacon_granularity == 'record':
response = build_beacon_record_response_by_dataset(self, datasets, datasets_docs, datasets_count, count, qparams, entity_schema)
elif include == 'NONE' and granularity == Granularity.RECORD and default_beacon_granularity == 'record':
elif include == 'NONE' and granularity == Granularity.RECORD and max_beacon_granularity == 'record':
response = build_beacon_none_response(self, datasets_docs["NONE"], count, qparams, entity_schema)
elif granularity == Granularity.COUNT or granularity == Granularity.RECORD and default_beacon_granularity in ['count', 'record']:
elif granularity == Granularity.COUNT and max_beacon_granularity in ['count', 'record'] or granularity == Granularity.RECORD and max_beacon_granularity in ['count']:
response = build_beacon_count_response(self, count, qparams, entity_schema)
else:
response = build_beacon_boolean_response(self, count, qparams, entity_schema)
Expand Down
2 changes: 1 addition & 1 deletion beacon/response/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def build_configuration(self):
'productionStatus': conf.environment.upper()
},
'securityAttributes': {
'defaultGranularity': conf.default_beacon_granularity,
'defaultGranularity': conf.max_beacon_granularity,
'securityLevels': conf.security_levels
},
'entryTypes': entry_types['entryTypes']
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ services:

db:
image: mongo:5
command: --wiredTigerCacheSizeGB 4
command: --wiredTigerCacheSizeGB 4 -port 27018
hostname: mongo
container_name: mongoprod
ports:
- 27017:27017
- 27018:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
Expand Down

0 comments on commit 4c0674c

Please sign in to comment.