-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: develop
Are you sure you want to change the base?
Changes from all commits
25cb2cf
563c21e
aea58ca
ab18c7f
2a417cf
9c39296
849537a
cf8f2f4
3152822
7a756ef
aa7b0c4
c9821d5
3680675
f30b235
c19c27c
b8b3280
ce1eeef
39060e2
657061c
999c64c
b75216f
ce741bf
ef57198
bd6bbbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
IF register_patch('0168_ExperimentWorkflow', 'Yoganandan Pandiyan', 'Generalising Workflow and Statuses for supporting Experiments and Proposals', '2025-01-16') THEN | ||
BEGIN | ||
/* altering table names*/ | ||
ALTER TABLE proposal_statuses RENAME TO statuses; | ||
ALTER TABLE proposal_status_actions RENAME TO status_actions; | ||
ALTER TABLE proposal_workflows RENAME TO workflows; | ||
ALTER TABLE proposal_workflow_connections RENAME TO workflow_connections; | ||
ALTER TABLE proposal_workflow_connection_has_actions RENAME TO workflow_connection_has_actions; | ||
END; | ||
|
||
BEGIN | ||
/* Renaming the columns */ | ||
ALTER TABLE statuses RENAME COLUMN proposal_status_id TO status_id; | ||
ALTER TABLE status_actions RENAME COLUMN proposal_status_action_id TO status_action_id; | ||
ALTER TABLE workflows RENAME COLUMN proposal_workflow_id TO workflow_id; | ||
ALTER TABLE workflow_connections RENAME COLUMN proposal_workflow_connection_id TO workflow_connection_id; | ||
ALTER TABLE workflow_connections RENAME COLUMN proposal_workflow_id TO workflow_id; | ||
ALTER TABLE workflow_connections RENAME COLUMN proposal_status_id TO status_id; | ||
ALTER TABLE workflow_connections RENAME COLUMN next_proposal_status_id TO next_status_id; | ||
ALTER TABLE workflow_connections RENAME COLUMN prev_proposal_status_id TO prev_status_id; | ||
ALTER TABLE status_changing_events RENAME COLUMN proposal_workflow_connection_id TO workflow_connection_id; | ||
END; | ||
|
||
BEGIN | ||
/* Creating enum for entity_type */ | ||
CREATE TYPE entity_type AS ENUM ('PROPOSAL', 'EXPERIMENT'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Good point. Will update in the next PR. |
||
END; | ||
|
||
BEGIN | ||
/* Adding entity_type column to the workflow and status related tables. Set the default to proposal temporarily, so that the existing record get populated with the value as proposal. Remove the default value after this. */ | ||
ALTER TABLE statuses ADD COLUMN entity_type entity_type NOT NULL DEFAULT 'PROPOSAL'; | ||
ALTER TABLE workflows ADD COLUMN entity_type entity_type NOT NULL DEFAULT 'PROPOSAL'; | ||
END; | ||
|
||
BEGIN | ||
/* Drop the default value of proposal */ | ||
ALTER TABLE statuses ALTER COLUMN entity_type DROP DEFAULT; | ||
ALTER TABLE workflows ALTER COLUMN entity_type DROP DEFAULT; | ||
END; | ||
|
||
BEGIN | ||
-- Insert the Workflow Statuses | ||
INSERT INTO statuses (name, short_code, description, entity_type, is_default) VALUES ('AWAITING ESF', 'AWAITING_ESF', 'When an Experiment is created, the default status will be AWAITING_ESF. This means that the experimenter needs to submit the ESF(Experiment Safety Form).', 'EXPERIMENT', true); | ||
INSERT INTO statuses (name, short_code, description, entity_type, is_default) VALUES ('ESF IS REVIEW', 'ESF_IS_REVIEW', 'IS(Instrument Scientist) needs to review the ESF.', 'EXPERIMENT', true); | ||
INSERT INTO statuses (name, short_code, description, entity_type, is_default) VALUES ('ESF ESR REVIEW', 'ESF_ESR_REVIEW', 'ESR(Experiment Safety Reviewer) needs to review the ESF.', 'EXPERIMENT', true); | ||
INSERT INTO statuses (name, short_code, description, entity_type, is_default) VALUES ('ESF REJECTED', 'ESF_REJECTED', 'ESF rejected.', 'EXPERIMENT', true); | ||
INSERT INTO statuses (name, short_code, description, entity_type, is_default) VALUES ('ESF APROVED', 'ESF_APROVED', 'ESF approved.', 'EXPERIMENT', true); | ||
END; | ||
|
||
END IF; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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