Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide async service API for sample management #1056

Merged

Conversation

sven1103
Copy link
Contributor

@sven1103 sven1103 commented Mar 5, 2025

Extends the current asynchronous service API for sample management tasks.

@sven1103 sven1103 requested a review from a team as a code owner March 5, 2025 12:45
Copy link
Member

@KochTobi KochTobi left a comment

Choose a reason for hiding this comment

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

Hi @sven1103
Some remarks on the suggested api

* @throws RequestFailedException if the request could not be executed
* @since 1.10.0
*/
Flux<SamplePreview> getSamplePreviews(String experimentId) throws RequestFailedException;
Copy link
Member

Choose a reason for hiding this comment

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

You will need the project identifier as well as we need to make sure that the access rights are correct. This holds true for all api methods

* @throws RequestFailedException in case the request cannot be executed
* @since 1.10.0
*/
Flux<Sample> getSamples(String experimentId) throws RequestFailedException;
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to still expose the domain model sample here? Tracking which information we actually use later on is part of coming up with a good API.

Copy link
Member

Choose a reason for hiding this comment

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

Does this actually throw an exception or does the Flux have an error element?

* @throws RequestFailedException in case the request cannot be executed
* @since 1.10.0
*/
Flux<Sample> getSamplesForBatch(String batchId) throws RequestFailedException;
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to still expose the domain model sample here? Tracking which information we actually use later on is part of coming up with a good API.

Copy link
Member

Choose a reason for hiding this comment

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

Does this actually throw an exception or does the Flux have an error element?

* @throws RequestFailedException in case the request cannot be executed
* @since 1.10.0
*/
Mono<SampleIdCodeEntry> findSampleId(String sampleCode) throws RequestFailedException;
Copy link
Member

Choose a reason for hiding this comment

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

Does this actually throw an exception or does the Mono have an error element?

* @param requests a collection of {@link SampleRegistrationRequest} items
* @since 1.10.0
*/
record SampleCreationRequest(String projectId, Collection<SampleRegistrationRequest> requests) {
Copy link
Member

Choose a reason for hiding this comment

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

I guess we need the experiment id here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of the request objects

record SampleCreationRequest(String projectId, Collection<SampleRegistrationRequest> requests) {
public SampleCreationRequest(String projectId, Collection<SampleRegistrationRequest> requests) {
this.projectId = projectId;
this.requests = List.copyOf(requests);
Copy link
Member

Choose a reason for hiding this comment

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

You need to overwrite the getter for the requests as well to ensure they are not altered by accessing methods.

* @param requests a collection for {@link SampleUpdate} items
* @since 1.10.0
*/
record SampleUpdateRequest(String projectId, Collection<SampleUpdate> requests) {
Copy link
Member

Choose a reason for hiding this comment

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

You probably want to overwrite the getter for the requests as well to return an unmodifiable list.

@@ -62,6 +66,31 @@ public Mono<ProjectCreationResponse> create(ProjectCreationRequest request)
throw new RuntimeException("not implemented");
}

@Override
public Flux<SamplePreview> getSamplePreviews(String experimentId) throws RequestFailedException {
Copy link
Member

Choose a reason for hiding this comment

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

Does this method throw or does the flux contain an error element?

}

@Override
public Flux<Sample> getSamples(String experimentId) throws RequestFailedException {
Copy link
Member

Choose a reason for hiding this comment

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

Does this method throw or does the flux contain an error element?

}

@Override
public Flux<Sample> getSamplesForBatch(String batchId) throws RequestFailedException {
Copy link
Member

Choose a reason for hiding this comment

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

Does this method throw or does the flux contain an error element?

@KochTobi KochTobi self-requested a review March 7, 2025 09:18
KochTobi
KochTobi previously approved these changes Mar 7, 2025
Copy link
Member

@KochTobi KochTobi left a comment

Choose a reason for hiding this comment

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

Approved. We will open another PR for the record immutability

Copy link

sonarqubecloud bot commented Mar 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sven1103 sven1103 merged commit 4d9e9b3 into development Mar 7, 2025
5 of 6 checks passed
@sven1103 sven1103 deleted the feature/#1055-api-for-downloading-sample-metadata branch March 7, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API for downloading sample metadata API for listing sample metadata (grid)
2 participants