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

feat: user officer experiment safety review workflow #917

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

yoganandaness
Copy link
Contributor

@yoganandaness yoganandaness commented Jan 22, 2025

Description

Workflow for Experiment Safety Review

Motivation and Context

Leveraging Proposal workflow to implement the experiment workflow. This process includes generalizing the Backend architecture to make it agnostic to Proposal and extensible for Experiment as well.

How Has This Been Tested

Unit test and e2e

Fixes

Changes

Depends on

Tests included/Docs Updated?

  • [*] I have added tests to cover my changes.
  • All relevant doc has been updated

@yoganandaness yoganandaness changed the title Swap 4396 user officer experiment safety review workflow feat: user officer experiment safety review workflow Jan 27, 2025
@yoganandaness yoganandaness force-pushed the SWAP-4396-user-officer-experiment-safety-review-workflow branch 8 times, most recently from 270832e to de6b18a Compare January 30, 2025 10:59
@yoganandaness yoganandaness marked this pull request as ready for review January 30, 2025 11:00
@yoganandaness yoganandaness requested a review from a team as a code owner January 30, 2025 11:00
@yoganandaness yoganandaness requested review from William-Edwards-STFC and removed request for a team January 30, 2025 11:00
@yoganandaness yoganandaness force-pushed the SWAP-4396-user-officer-experiment-safety-review-workflow branch from 7a22bf6 to 4f2a54d Compare January 30, 2025 15:05
@yoganandaness yoganandaness force-pushed the SWAP-4396-user-officer-experiment-safety-review-workflow branch 5 times, most recently from 302773a to c08d013 Compare January 30, 2025 19:38
@yoganandaness yoganandaness force-pushed the SWAP-4396-user-officer-experiment-safety-review-workflow branch 2 times, most recently from 8bde1dd to 6dd03ff Compare January 30, 2025 20:34
…re into SWAP-4396-user-officer-experiment-safety-review-workflow
@yoganandaness yoganandaness force-pushed the SWAP-4396-user-officer-experiment-safety-review-workflow branch from 6dd03ff to 657061c Compare January 30, 2025 21:02
@yoganandaness
Copy link
Contributor Author

Screen.Recording.2025-01-31.at.11.11.50.2.mov

@Scott-James-Hurley
Copy link
Contributor

Is ELI planning on using this feature? If so, perhaps @gnyiri would be better suited to review this than STFC.

Comment on lines +7 to +8
ALTER TABLE proposal_statuses RENAME TO statuses;
ALTER TABLE proposal_status_actions RENAME TO status_actions;
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is there a reason why these are not workflow_statuses and workflow_status_actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the idea here is to make a generic table for statuses and workflows, and use it for various purposes including Proposal and Experiment and much more.

This is the reason, why we have the new column entity_type


BEGIN
/* Creating enum for entity_type */
CREATE TYPE entity_type AS ENUM ('PROPOSAL', 'EXPERIMENT');
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Should we call this EXPERIMENT_SAFETY ? Calling it just EXPERIMENT could be a little too general

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Good point. Will update in the next PR.

@@ -79,6 +79,11 @@ export enum Event {
INSTRUMENTS_ASSIGNED_TO_TECHNIQUE = 'INSTRUMENTS_ASSIGNED_TO_TECHNIQUE',
INSTRUMENTS_REMOVED_FROM_TECHNIQUE = 'INSTRUMENTS_REMOVED_FROM_TECHNIQUE',
PROPOSAL_ASSIGNED_TO_TECHNIQUES = 'PROPOSAL_ASSIGNED_TO_TECHNIQUES',
EXPERIMENT_ESF_SUBMITTED = 'EXPERIMENT_ESF_SUBMITTED',
Copy link
Contributor

@jekabs-karklins jekabs-karklins Feb 10, 2025

Choose a reason for hiding this comment

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

Question: I do not see these events being sent to the event bus, is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part is not yet done. Coming soon.

Copy link
Contributor

@jekabs-karklins jekabs-karklins left a comment

Choose a reason for hiding this comment

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

One nice improvement would be if it would be possible to make sure to use typescript discriminated unions to make sure an invalid combination of entityType and shortcode is not possible.

Something of this type was done in
apps/frontend/src/models/questionary/QuestionarySubmissionState.ts
and then when used in the reducer
apps/frontend/src/models/questionary/QuestionarySubmissionState.ts
when you do a switch or an if statement or in any other way let TS know to reduce the datatype, it prevents you from accessing attributes of the event that do not exist. workflows case it would prevent expecting status shortCode that is impossible, e.g. ESF approved for proposal workflow

@@ -2,11 +2,11 @@ query getCallSubmissionDetails($callId: Int!) {
call(callId: $callId) {
proposalWorkflowId
submissionMessage
proposalWorkflow {
proposalWorkflowConnectionGroups {
workflow {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I think you might have left the proposal workflow here as that is what the call will have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

proposalWorkflow resolver has been replaced with workflow

Copy link
Contributor

@jekabs-karklins jekabs-karklins left a comment

Choose a reason for hiding this comment

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

Looks very good.
Nice feature and we could use in the future for more things.

…re into SWAP-4396-user-officer-experiment-safety-review-workflow
@yoganandaness
Copy link
Contributor Author

yoganandaness commented Feb 11, 2025

Is ELI planning on using this feature? If so, perhaps @gnyiri would be better suited to review this than STFC.

Even though it is a ESS exclusive feature for now, this involves changes to the existing system and architecture. So i think it is a good idea to go through the change and let me know in case of any concerns. The most significant changes are in the tables: proposal_statuses, proposal_workflows

@Scott-James-Hurley

@yoganandaness yoganandaness requested a review from gnyiri February 11, 2025 09:41
@yoganandaness
Copy link
Contributor Author

@gnyiri Requesting you to review this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants