GenomicDataInfrastructure / gdi-userportal-dataset-discovery-service

0 stars 1 forks source link

chore: stop calling record counter if beacon is disable #116

Closed brunopacheco1 closed 2 months ago

brunopacheco1 commented 2 months ago

Summary by Sourcery

Refactor the dataset ID collection and search processes to use maps and sets for improved efficiency and clarity. Remove the RecordsCountCollector interface and its associated logic, consolidating record count handling within the DatasetIdsCollector.

Enhancements:

Chores:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request refactors the dataset search functionality to improve efficiency and remove redundant code. The main changes involve modifying the data structure used for dataset IDs and record counts, removing the separate RecordsCountCollector, and updating the related classes and interfaces to accommodate these changes.

File-Level Changes

Change Details Files
Refactored dataset search to use Map<String, Integer> instead of separate List and Map<String, Integer>
  • Modified DatasetIdsCollector interface to return Map<String, Integer> instead of List
  • Updated SearchDatasetsQuery to work with the new Map<String, Integer> structure
  • Removed RecordsCountCollector and its usage
  • Updated findIdsIntersection method to work with Map<String, Integer>
  • Modified CkanDatasetIdsCollector to return Map<String, Integer>
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/application/usecases/SearchDatasetsQuery.java
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/application/ports/DatasetIdsCollector.java
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/persistence/CkanDatasetIdsCollector.java
Updated BeaconDatasetIdsCollector to implement only DatasetIdsCollector interface
  • Removed implementation of RecordsCountCollector
  • Merged collect and collectRecordsCount methods into a single collect method
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/beacon/persistence/BeaconDatasetIdsCollector.java
Modified DatasetsRepository and CkanDatasetsRepository to use Set instead of List for datasetIds
  • Updated method signatures to accept Set for datasetIds parameter
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/application/ports/DatasetsRepository.java
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/persistence/CkanDatasetsRepository.java
Removed RecordsCountCollector interface
  • Deleted the RecordsCountCollector.java file
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/application/ports/RecordsCountCollector.java

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.