Skip to content

Commit 424fb50

Browse files
committed
Merge branch 'main' into feature/TED-407
2 parents 9bb868d + 5bbd8eb commit 424fb50

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

ted_sws/data_manager/adapters/mapping_suite_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shutil
55
from typing import Iterator, List, Optional
66

7-
from pymongo import MongoClient
7+
from pymongo import MongoClient, ASCENDING
88

99
from ted_sws import config
1010
from ted_sws.core.model.transform import MappingSuite, FileResource, TransformationRuleSet, SHACLTestSuite, \
@@ -66,7 +66,7 @@ def get(self, reference) -> MappingSuite:
6666
:param reference:
6767
:return: MappingSuite
6868
"""
69-
result_dict = self.collection.find_one({"identifier": reference})
69+
result_dict = self.collection.find_one({"_id": reference})
7070
return MappingSuite(**result_dict) if result_dict else None
7171

7272
def list(self) -> Iterator[MappingSuite]:

ted_sws/data_manager/adapters/notice_repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Iterator, Union, Optional
44

55
import gridfs
6-
from pymongo import MongoClient
6+
from pymongo import MongoClient, ASCENDING
77
from bson import ObjectId
88
from ted_sws import config
99
from ted_sws.core.model.manifestation import XMLManifestation, RDFManifestation, METSManifestation, Manifestation
@@ -28,6 +28,8 @@ def __init__(self, mongodb_client: MongoClient, database_name: str = _database_n
2828
notice_db = mongodb_client[self._database_name]
2929
self.file_storage = gridfs.GridFS(notice_db)
3030
self.collection = notice_db[self._collection_name]
31+
self.file_storage_collection = notice_db["fs.files"]
32+
self.file_storage_collection.create_index([("notice_id", ASCENDING)])
3133

3234
def get_file_content_from_grid_fs(self, file_id: str) -> str:
3335
"""
@@ -188,7 +190,7 @@ def get(self, reference) -> Optional[Notice]:
188190
:param reference:
189191
:return: Notice
190192
"""
191-
result_dict = self.collection.find_one({"ted_id": reference})
193+
result_dict = self.collection.find_one({"_id": reference})
192194
if result_dict is not None:
193195
notice = NoticeRepository._create_notice_from_repository_result(result_dict)
194196
notice = self.load_notice_fields_from_grid_fs(notice)

ted_sws/mapping_suite_processor/services/conceptual_mapping_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def mapping_suite_processor_zip_package(mapping_suite_package_path: pathlib.Path
5656
def mapping_suite_processor_expand_package(mapping_suite_package_path: pathlib.Path):
5757
"""
5858
This function reads data from conceptual_mappings.xlsx and expand provided package.
59+
Note: we don't use this at the moment
5960
:param mapping_suite_package_path:
6061
:return:
6162
"""
@@ -149,7 +150,6 @@ def mapping_suite_processor_from_github_expand_and_load_package_in_mongo_db(mapp
149150
mapping_suite_package_downloader.download(mapping_suite_package_name=mapping_suite_package_name,
150151
output_mapping_suite_package_path=tmp_dir_path)
151152
mapping_suite_package_path = tmp_dir_path / mapping_suite_package_name
152-
mapping_suite_processor_expand_package(mapping_suite_package_path=mapping_suite_package_path)
153153
mapping_suite_processor_load_package_in_mongo_db(mapping_suite_package_path=mapping_suite_package_path,
154154
mongodb_client=mongodb_client,
155155
load_test_data=load_test_data

tests/unit/mapping_suite_processor/test_mapping_suite_processor_from_github_expand_and_load_package_in_mongo_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
mapping_suite_processor_from_github_expand_and_load_package_in_mongo_db
44

55
MAPPING_SUITE_PACKAGE_NAME = "package_F03_test"
6-
MAPPING_SUITE_PACKAGE_ID = "test_package"
6+
MAPPING_SUITE_PACKAGE_ID = "package_F03_test"
77

88

99
def test_mapping_suite_processor_from_github_expand_and_load_package_in_mongo_db(mongodb_client):

0 commit comments

Comments
 (0)