Get Dataset Reviews use case#457
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for retrieving “review datasets” associated with a target dataset via the Dataverse GET /api/datasets/{identifier}/reviews endpoint, including model/transformer wiring, public exports, and test coverage (unit + integration).
Changes:
- Introduces
DatasetReviewdomain model + payload/response transformer, and addsgetDatasetReviewstoIDatasetsRepository+DatasetsRepository. - Adds
GetDatasetReviewsuse case and exports it from the datasets public API; updates docs and changelog. - Adds unit tests for the use case/repository method and an integration test that bootstraps required metadata blocks and Solr schema for the endpoint.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/datasets/GetDatasetReviews.test.ts | Unit tests for the new GetDatasetReviews use case. |
| test/unit/datasets/DatasetsRepository.test.ts | Unit tests for DatasetsRepository.getDatasetReviews (numeric + persistent id). |
| test/testHelpers/search/solrHelper.ts | New helper to verify/update Solr schema in the test Docker environment. |
| test/testHelpers/datasets/datasetReviewHelper.ts | Test factories for DatasetReview model/payload. |
| test/testHelpers/datasets/datasetHelper.ts | Adds helper to load a metadata block via admin API for integration setup. |
| test/testHelpers/collections/collectionHelper.ts | Adds helper to configure allowed dataset types on a collection for integration setup. |
| test/integration/metadataBlocks/MetadataFieldsInfoRepository.test.ts | Makes facetable field count assertion tolerant to added metadata blocks. |
| test/integration/datasets/DatasetsRepository.test.ts | Adds integration coverage for dataset reviews (with Solr/metadata bootstrapping). |
| test/functional/metadataBlocks/GetAllFacetableMetadataFields.test.ts | Makes facetable field count assertion tolerant to added metadata blocks. |
| src/datasets/infra/repositories/transformers/datasetReviewTransformers.ts | Transforms reviews endpoint response into DatasetReview[]. |
| src/datasets/infra/repositories/transformers/DatasetReviewPayload.ts | Defines the API payload shape for reviews. |
| src/datasets/infra/repositories/DatasetsRepository.ts | Implements getDatasetReviews repository method. |
| src/datasets/index.ts | Exports the new use case instance and DatasetReview types. |
| src/datasets/domain/useCases/GetDatasetReviews.ts | Adds the GetDatasetReviews use case. |
| src/datasets/domain/repositories/IDatasetsRepository.ts | Extends repository interface with getDatasetReviews. |
| src/datasets/domain/models/DatasetReview.ts | Adds the new DatasetReview domain model. |
| docs/useCases.md | Documents the new use case and usage example. |
| CHANGELOG.md | Adds release note entry for dataset reviews support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2108
to
+2111
| await assertDatasetReviewsEndpointAvailable() | ||
| await ensureReviewMetadataBlocksExist() | ||
| await ensureReviewSolrSchemaFieldsExist() | ||
| await ensureReviewDatasetTypeExists() |
Comment on lines
+2253
to
+2265
| const reviewDatasetType = await getDatasetAvailableDatasetType | ||
| .execute(reviewDatasetTypeName) | ||
| .catch(async () => { | ||
| reviewDatasetTypeCreatedByTest = true | ||
| return await addDatasetType.execute({ | ||
| name: reviewDatasetTypeName, | ||
| displayName: 'Review', | ||
| description: 'A review of a dataset compiled by the expert community.', | ||
| linkedMetadataBlocks: [], | ||
| availableLicenses: [] | ||
| }) | ||
| }) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds a use case for getting dataset reviews
Which issue(s) this PR closes:
Special notes for your reviewer:
The integration test includes setup code that adds the review.tsv metadatablock, and updates the solar schema. This is required because the API endpoint uses solr search to find the reviews related to a dataset.
Suggestions on how to test this:
Is there a release notes or changelog update needed for this change?:
yes, an item as added to the CHANGELOG.md
Additional documentation: