Skip to content

refactor(Dataset): change endpoints from V3 to V4 - #2380

Open
abdimo101 wants to merge 1 commit into
masterfrom
change-dataset-endpoints-to-v4
Open

refactor(Dataset): change endpoints from V3 to V4#2380
abdimo101 wants to merge 1 commit into
masterfrom
change-dataset-endpoints-to-v4

Conversation

@abdimo101

@abdimo101 abdimo101 commented May 18, 2026

Copy link
Copy Markdown
Contributor

Description

This PR replaces dataset related API calls from V3 to V4, updating DTOs, effects, reducers, components and various tests to align with V4. Also added a utils file inside shared-condition folder that handles the scientific metadata query logic to be used for the findAllV4 endpoint.

Skipped test file:

  • datasets-metadata.cy.js

Reason for the test skips are because backend does not yet support:

Motivation

Background on use case, changes needed

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Migrate dataset operations and frontend models from API V3 to V4 while supporting V4 query semantics and multi-valued dataset relationships.

New Features:

  • Support dataset queries through the V4 API, including authenticated and public access paths.
  • Support multiple proposals, samples, and instruments associated with a dataset.
  • Add scientific metadata condition-to-query conversion with SI unit handling and decimal range values.

Bug Fixes:

  • Correct dataset creation and filtering payloads to use V4 field and query formats.
  • Improve dataset detail loading and state clearing when resolving multiple related entities.

Enhancements:

  • Replace legacy dataset DTOs and state types with V4-compatible dataset models across dataset views, effects, reducers, and shared services.
  • Update dataset-related Cypress commands, fixtures, intercepts, and coverage for V4 behavior.
  • Simplify dataset detail tab and data-loading behavior around the current dataset.

Tests:

  • Update unit and end-to-end tests for V4 services, DTOs, payloads, and multi-valued relationships.
  • Skip scientific metadata metadata-key Cypress coverage until backend encoding and decoding support is available.

@abdimo101
abdimo101 marked this pull request as ready for review June 22, 2026 15:04
@abdimo101
abdimo101 requested a review from a team as a code owner June 22, 2026 15:04

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @abdimo101, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates dataset-related frontend logic from V3 to V4 APIs, updating NgRx state/actions/effects and multiple consuming components to use V4 DTOs (including new array-based relations like proposalIds/sampleIds/instrumentIds). It also introduces a shared utility for converting scientific condition filters into a Mongo-style query for the V4 findAll endpoint, and updates Cypress API paths/config to match the new versioned endpoints.

Changes:

  • Switch dataset fetch/create/count/facet effects from V3 controllers to V4/public V4 controllers; update state to use PartialOutputDatasetDto plus a CurrentDataset union type.
  • Update components/services/tests to accept V4 DTO shapes (notably proposalIds/sampleIds/instrumentIds) and new query/sort structures.
  • Add shared-condition/utils.ts for scientific-metadata query building; update Cypress config and intercepts to /api/v3//api/v4 as appropriate.

Reviewed changes

Copilot reviewed 54 out of 54 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/app/state-management/state/samples.store.ts Update sample state dataset DTO type to V4 partial dataset DTO.
src/app/state-management/state/proposals.store.ts Update proposals state dataset DTO type to V4 partial dataset DTO.
src/app/state-management/state/datasets.store.ts Introduce CurrentDataset type and migrate dataset state collections to V4 DTOs.
src/app/state-management/selectors/datasets.selectors.ts Build V4-compatible query/limits, including scientific-condition query conversion and sort object.
src/app/state-management/reducers/proposals.reducer.spec.ts Update proposal reducer tests to V4 dataset DTO shape.
src/app/state-management/reducers/datasets.reducer.ts Adjust reducer logic for optional attachments/origdatablocks handling with new types.
src/app/state-management/reducers/datasets.reducer.spec.ts Update dataset reducer tests for V4 DTO fields (e.g. principalInvestigators, datasetName).
src/app/state-management/effects/published-data.effects.ts Update dataset batch selection typing to V4 dataset DTO.
src/app/state-management/effects/ingestor.effects.ts Switch ingestor dataset creation from V3 service to V4 service.
src/app/state-management/effects/ingestor.effects.spec.ts Update ingestor effects tests for V4 dataset creation call.
src/app/state-management/effects/datasets.effects.ts Migrate core dataset effects to V4/public V4 endpoints and new filter payload shape.
src/app/state-management/effects/datasets.effects.spec.ts Update dataset effects tests for V4 services and new filter/sort payload shape.
src/app/state-management/actions/samples.actions.ts Update sample datasets action payload types to V4 partial dataset DTO.
src/app/state-management/actions/proposals.actions.ts Update proposal datasets action payload types to V4 partial dataset DTO.
src/app/state-management/actions/ingestor.actions.ts Update ingestor create-dataset success payload to V4 output dataset DTO.
src/app/state-management/actions/datasets.actions.ts Update dataset action payload types for V4 DTO usage and V4 create request type.
src/app/state-management/actions/datasets.actions.spec.ts Update dataset actions tests for V4 DTO/request types.
src/app/shared/services/ownership.service.ts Update ownership checks to accept CurrentDataset.
src/app/shared/services/datasets-list.service.ts Update instrument display logic to use V4 instrumentIds array.
src/app/shared/modules/shared-condition/utils.ts New: convert scientific conditions (incl. unit conversion) into Mongo-style query for V4 endpoints.
src/app/shared/modules/shared-condition/shared-condition.component.ts Add range-input buffering to support decimal range entry and improved display text.
src/app/shared/MockStubs.ts Update shared mock dataset type to CurrentDataset.
src/app/samples/sample-detail/sample-detail.component.ts Update sample detail dataset table typing to V4 partial dataset DTO.
src/app/proposals/proposal-table/proposal-table.component.ts Update proposal table dataset typing to V4 dataset DTO.
src/app/proposals/proposal-datasets/proposal-datasets.component.ts Update proposal datasets table and row events to V4 partial dataset DTO.
src/app/proposals/proposal-datasets/proposal-datasets.component.spec.ts Update proposal datasets component tests to V4 dataset DTO.
src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts Update current dataset typing to CurrentDataset.
src/app/ingestor/ingestor-page/helper/ingestor.component-helper.ts Update ingestor schema builder to V4 create dataset DTO fields (arrays for relations, plural PI).
src/app/ingestor/ingestor-dialogs/creation-dialog/creation-pages/ingestor.new-transfer-dialog-page.component.ts Update ingestor transfer header PI field to principalInvestigators array.
src/app/datasets/related-datasets/related-datasets.component.ts Update related datasets typing and click handler to V4 partial dataset DTO.
src/app/datasets/reduce/reduce.component.ts Update reduce flow dataset typing to CurrentDataset.
src/app/datasets/dataset-table/dataset-table.component.ts Update dataset table typing and selection events to V4 partial dataset DTO.
src/app/datasets/dataset-table/dataset-inline-edit-cell.component.ts Update inline edit row typing to V4 dataset DTO.
src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts Update selected set typing to V4 partial dataset DTO.
src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts Update lifecycle dataset typing to CurrentDataset.
src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts Update lifecycle tests to V4 partial dataset DTO + history.
src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts Update uploader dataset typing to CurrentDataset.
src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Update related document fetching to array-based IDs and CurrentDataset typing.
src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.ts Update dataset detail component typing to CurrentDataset.
src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.spec.ts Update dataset detail tests to V4 dataset DTO.
src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html Render related documents for array-based IDs (proposals/samples/instruments).
src/app/datasets/dataset-detail/dataset-detail-dynamic/dataset-detail-dynamic.component.ts Update dynamic detail component typing to CurrentDataset.
src/app/datasets/dashboard/dashboard.component.ts Update dashboard row click typing to V4 partial dataset DTO.
src/app/datasets/batch-view/batch-view.component.ts Update batch view typing and export helpers to V4 partial dataset DTO.
src/app/datasets/archiving.service.ts Update archiving service typing to CurrentDataset[].
src/app/datasets/admin-tab/admin-tab.component.ts Update admin tab dataset typing to CurrentDataset.
cypress/support/commands.js Update Cypress API command URLs to include explicit /v3 or /v4 prefixes.
cypress/fixtures/testData.js Update dataset fixture fields for V4 (plural PI, plural relation IDs).
cypress/e2e/mainPage/main-page.cy.js Update dataset creation payload to use proposalIds array.
cypress/e2e/datasets/datasets-public.cy.js Update intercept path to V4 datasets endpoint.
cypress/e2e/datasets/datasets-metadata.cy.js Skip metadata test and update intercept to V4 datasets endpoint.
cypress/e2e/datasets/datasets-keyword.cy.js Update intercept path to V4 datasets endpoint.
cypress/e2e/datasets/datasets-general.cy.js Update dataset creation payload for V4 and add scientific-condition range/decimal coverage.
cypress.config.ts Change Cypress API base URL to /api and rely on per-command version prefixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/state-management/actions/datasets.actions.ts
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/shared/modules/shared-condition/shared-condition.component.ts Outdated
Comment thread src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html Outdated
Comment thread src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html Outdated
Comment thread cypress/e2e/datasets/datasets-general.cy.js
Comment thread src/app/state-management/reducers/datasets.reducer.ts
@Junjiequan Junjiequan self-assigned this Jul 3, 2026

@Junjiequan Junjiequan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v4 datasets lookup feature integration is missing here, which was the main driver for the v3 to v4 migration. Since this lookup capability is the core reason we moved to v4, we should make sure it's included before this is considered complete, otherwise the migration doesn't deliver its primary benefit.

@Junjiequan
Junjiequan force-pushed the change-dataset-endpoints-to-v4 branch from 6fa89ba to 91a310f Compare September 3, 2026 12:07
@Junjiequan
Junjiequan force-pushed the change-dataset-endpoints-to-v4 branch from 66b2358 to eb96d53 Compare September 4, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants