Skip to content

Refactor Base Schema to not require Donor/Specimen/Sample#878

Merged
joneubank merged 24 commits intodevelopfrom
feat/refactor-analyis-data-model
Jan 28, 2025
Merged

Refactor Base Schema to not require Donor/Specimen/Sample#878
joneubank merged 24 commits intodevelopfrom
feat/refactor-analyis-data-model

Conversation

@joneubank
Copy link
Copy Markdown
Contributor

@joneubank joneubank commented Jan 22, 2025

Issue Reference

Summary

Important

Breaking change! This pull requests changes the core data model. With this change, analyses are no longer required to link to a specific donor, or reference specific samples. This data can be optionally added to a Custom Schema if that is relevant to that type of analysis.

This change removes all references to donors, specimens, and samples from the base schema. Analyses now have very little required information, primarily the Study and list of Files. Since Analyses no longer require donor or sample information, the relation between donors, specimens, and samples is no longer built and validated during analysis submission. See the linked issue for details on the motivation for this change.

Changes

Bug Fixes

The following fixes are included in this work but not captured in the above tickets

  • Paginated search was broken due to the fileType enum removal. The stored procedure for get_analysis is updated to no longer join with the donor/specimen/sample tables and fixes this type issue
  • Analysis schema options properties, including fileTypes are set to empty lists by default, and can be cleared by providing an empty list.

Azher2Ali and others added 19 commits October 11, 2024 15:52
…cimen-sample-from-analysis

Remove Donor, Specimen, and Sample from Analysis Data Classes in SONG
…cimen-sample-from-base-schema

Remove Donor, Specimen, and Samples from Base Schema and Allow in Dynamic Schemas
…cimen-sample-search

Remove Donor/Specimen/Sample References from Study and Search APIs
…on-rules-for-analysis

Add External Validation Rules for Analysis Properties Based on Dynamic Schema
@joneubank joneubank marked this pull request as ready for review January 27, 2025 21:17
- when missing, uses value from previous schema or sets as empty (default) value
- when set as empty array, replaces current value with empty array (removes optional validations)
- sets options in get registration by version query
@joneubank joneubank changed the title Feat/refactor analyis data model Refactor Base Schema to not require Donor/Specimen/Sample Jan 28, 2025
Copy link
Copy Markdown
Member

@justincorrigible justincorrigible left a comment

Choose a reason for hiding this comment

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

This is just awesome! long time coming too.
thanks for taking the time to get this done!

Left a couple comments on the docs side, the rest of the changes LGTM 👍 (except for that random semicolon 😆 maybe I'm missing something?)

Comment thread docs/custom-schemas.md Outdated

## Options

All properties in options are optional. If no value is provided, a default configuration will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and the value will be maintained from the previous version.
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.

Suggested change
All properties in options are optional. If no value is provided, a default configuration will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and the value will be maintained from the previous version.
All properties in "options" are elective. If no value is provided, a default configuration (shown bellow) will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and its value will be maintained from the previous version (if one is available).

is the following object a representation of the default options? added note here in case that is so, to make it explicit. otherwise, we could include a link to the file/code that contains said default options.

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.

also, if I omit an option because I'm trying to clear it for whatever reason, but it was already set (and therefor the existing value will be maintained), should we explain here how to remove it?

Comment thread docs/custom-schemas.md Outdated

### External Validation

External validations configure Song to check a value in the analysis against an external service by sending an HTTP GET request to a configurable URL. The URL needs to return 2XX status message to indicate that if the provided value "is valid", typically meaning that the value for this property is known by that service.
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.

Suggested change
External validations configure Song to check a value in the analysis against an external service by sending an HTTP GET request to a configurable URL. The URL needs to return 2XX status message to indicate that if the provided value "is valid", typically meaning that the value for this property is known by that service.
External validations configure Song to check a value in the analysis against an external service, by sending an HTTP GET request to a configurable URL. The service should respond with a 2XX status message to indicate the value "is valid".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Including all these changes in my next commit, some of them conflict with a change I made so I'll commit the suggestions but not through the GH UI.

Comment thread docs/custom-schemas.md Outdated
}
```

Song would attempt to validate the donorId by sending a URL to `http://example.com/ABC123/donor/id01`.
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.

Suggested change
Song would attempt to validate the donorId by sending a URL to `http://example.com/ABC123/donor/id01`.
Song would attempt to validate the donorId by sending a validation request to `http://example.com/ABC123/donor/id01`.

Comment thread docs/custom-schemas.md Outdated

Song would attempt to validate the donorId by sending a URL to `http://example.com/ABC123/donor/id01`.

It is allowable to use either the `{study}` or `{value}` multiple times in the URL, each instance will be replaced by the corresponding value.
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.

Suggested change
It is allowable to use either the `{study}` or `{value}` multiple times in the URL, each instance will be replaced by the corresponding value.
The URL parsing allows using either the `{study}` or `{value}` placeholders multiple times (e.g. `http://example.com/{study}-{value}/{value}`), each instance will be interpolated accordingly.

Comment thread docs/custom-schemas.md Outdated
It is allowable to use either the `{study}` or `{value}` multiple times in the URL, each instance will be replaced by the corresponding value.

> [!Warning]
> The URL may cause errors in song if it contains any tokens matching the `{word}` format other than `{study}` and `{value}` No newline at end of file
Copy link
Copy Markdown
Member

@justincorrigible justincorrigible Jan 28, 2025

Choose a reason for hiding this comment

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

Changing this here for consistency with the rest of your additions... and now I realize I've been noticing we spell SONG/Song/song in different places (beyond this repo).
Is it worth making a pass in a different PR to unify those here? if so, which spelling should we use? in Overture docs, we've been using all caps. TBD

Suggested change
> The URL may cause errors in song if it contains any tokens matching the `{word}` format other than `{study}` and `{value}`
> The URL may cause errors in Song if it contains any tokens matching the `{word}` format other than `{study}` and `{value}`

}

private boolean isIdSearchMode() {
return nonNull(fileId) || nonNull(sampleId) || nonNull(specimenId) || nonNull(donorId);
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.

🎉

import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.*;
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.

How's Maven's tree shaking these days? I recall this `.* pattern could add some pounds to the code back when

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure on this but I know the common practice for code formatters is that after a minimum number of imports from a package the formatter will switch to the .* form. So I would assume there is not a meaningful package size change associated with this. Important to know that this affects docker image size, less impactful than a web page bundle size increase.

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.

This makes me soooooo happy! 👏

.setSubmitterSpecimenId(randomGenerator.generateRandomUUID().toString());
x.getDonor().setSubmitterDonorId(randomGenerator.generateRandomUUID().toString());
});
;
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.

typo?

Suggested change
;

@joneubank
Copy link
Copy Markdown
Contributor Author

joneubank commented Jan 28, 2025

I changed the optional property name from externalValidation to externalValidations to be consistent with naming of array properties. It matches fileTypes now (both plural).

Comment thread docs/custom-schemas.md Outdated

## Options

The `options` property is not required, if provided extra validations for this analysis can be specified. Similarly, each property in `options` is also optional. If no value is provided for an option, a default configuration will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and its value will be maintained from the previous version.
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.

Suggested change
The `options` property is not required, if provided extra validations for this analysis can be specified. Similarly, each property in `options` is also optional. If no value is provided for an option, a default configuration will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and its value will be maintained from the previous version.
The `options` property is not required. If provided, extra validations for this analysis can be specified. Similarly, each property in `options` is also optional. If no value is provided for an option, a default configuration will be used for the analysis. If this is an update to an existing analysis type, you can omit any option and its value will be maintained from the previous version.

Comment thread docs/custom-schemas.md

If you want to remove the previous value of an option so that this validation is no longer required, for instance removing the restriction on file types so that any file type could be provided, you should provide an empty list for that option.

In the example below, both `fileTypes` and `externalValidations` properties are set to empty arrays, which means that these validations will not be applied to submitted analysis:
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.

love it. very helpful description 👍

@joneubank joneubank merged commit 03acf8b into develop Jan 28, 2025
@joneubank joneubank deleted the feat/refactor-analyis-data-model branch January 28, 2025 15:11
@joneubank joneubank mentioned this pull request May 29, 2025
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.

3 participants