Add External Validation Rules for Analysis Properties Based on Dynamic Schema#877
Merged
joneubank merged 9 commits intofeat/refactor-analyis-data-modelfrom Jan 27, 2025
Conversation
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
leoraba
reviewed
Nov 4, 2024
Contributor
leoraba
left a comment
There was a problem hiding this comment.
So far so good! Just left some comments to consider 📝
joneubank
requested changes
Dec 12, 2024
Comment on lines
+3
to
+4
| ALTER TABLE public.analysis_schema | ||
| DROP COLUMN file_types; |
Contributor
There was a problem hiding this comment.
Have we published this version with file types yet? We would need to migrate all the file_types that have already been set into the new analysis schema format.
Did you consider storign analysis_schema in a separate column instead of storing options as a JSON?
Contributor
There was a problem hiding this comment.
I think that in the long term it would be best to store all options as their own dedicated columns in postgres. For the scope of this PR, we'll just leave it as a column for options since this is working today.
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.
This PR introduces external validation capabilities for analysis properties, allowing for dynamic schemas to specify validation rules that are stored in the database. Each rule specifies a
jsonPathto identify the property for validation and a URL to an external service for validation logic. During analysis submission, the system will validate specific property values by querying the external service, confirming that the values (e.g., donor IDs) meet the criteria defined by the external registry or ontology.Adds support for configurable external validation rules per analysis type.
Enables database storage of validation rules tied to specific analysis types.
Implements web request calls to validate property values according to the rules during submission.
This update also introduces external validation checks for analyses during creation and update in SONG. These checks are applied after JSON schema validation and file type validation. For each configured external validation rule on an analysis type, the system will:
Check Analysis Properties: Determine if the property at the specified path has a value. If no value exists, the validation is considered passed.
Validate Using External Source: If a value is present, SONG constructs a GET request to the external validation URL. The URL includes query parameters:
studyId: the study identifier the analysis is associated with.
value: the value of the property being validated.
Process the External Validation Response:
If the value is valid, the external service returns an HTTP 200 status with no response body.
If invalid, the external service returns an HTTP 400 status and optionally includes a JSON error message explaining why the value is invalid. This message is provided to the submitter for clarity.
Other HTTP errors indicate a validation failure, and a message is returned to the submitter stating that external validation was unsuccessful, preventing the analysis submission/update.
This update sets the groundwork for calling external validation services, but the actual call to the external service is pending final implementation .We added this feature with an exception that the actual call to the external service is skipped as the service is not up and running and if we start invoking it, this will fail all the validations #872 #875