Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
31eed77
chore: Seed optimisation
yoganandaness Feb 25, 2026
da0a21f
WIP
yoganandaness Feb 26, 2026
b7dc488
wip
yoganandaness Apr 1, 2026
6d08628
Merge branch SWAP-4949-workflow-overhaul of github.com:UserOfficeProj…
yoganandaness Apr 14, 2026
8b5fa6b
fix: status action execution on manual proposal status change
yoganandaness Apr 14, 2026
4424b33
Merge branch 'SWAP-4949-workflow-overhaul' of github.com:UserOfficePr…
yoganandaness Apr 14, 2026
8fb3145
chore: Seggregating Proposal Entity workflow
yoganandaness Apr 15, 2026
42fe3fd
feat: status action implemented for experiment safety
yoganandaness Apr 21, 2026
a343a99
feat: manual status change of experiment safety implemented
yoganandaness Apr 23, 2026
f6b38cb
feat: Added logs to the Experiment
yoganandaness Apr 23, 2026
e24fb29
want to cfeat: Added logs to the Experiment
yoganandaness Apr 23, 2026
d7a47d6
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Apr 28, 2026
f89279d
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
yoganandaness Apr 29, 2026
9537ece
Merge branch 'SWAP-4949-workflow-overhaul' of github.com:UserOfficePr…
yoganandaness Apr 29, 2026
7b20e08
fix: only userofficer can use the experiment actions
yoganandaness Apr 29, 2026
267e6db
Merge develop and resolve conflicts
Copilot May 29, 2026
2b2f8fa
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 1, 2026
aaaf253
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 2, 2026
6da5832
fix: fix flaky tests
yoganandaness Jun 2, 2026
272e27f
feat: add guard function to check if experiment is rejected by instru…
yoganandaness Jun 3, 2026
ded5fa3
feat: add workflow status handling and implement experiment safety ch…
yoganandaness Jun 3, 2026
cc9f0cc
refactor: remove redundant feasibility status creation from instrumen…
yoganandaness Jun 3, 2026
5263707
refactor: remove unused proposal workflow handler and skip flaky test…
yoganandaness Jun 3, 2026
826be48
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 3, 2026
9f437d3
refactor: update workflow handler to skip exempted events and remove …
yoganandaness Jun 3, 2026
8ed2a73
refactor: reorganize state machine imports and remove simpleStateMach…
yoganandaness Jun 3, 2026
347b625
refactor: integrate proposal workflow into custom handler and export …
yoganandaness Jun 3, 2026
8e76ee6
refactor: remove experimentSafetyWorkflow handler and associated tests
yoganandaness Jun 3, 2026
9dde3b9
refactor: streamline experiment safety workflow handling and improve …
yoganandaness Jun 4, 2026
8a5d1db
refactor: replace string literal with StatusCode constant for exclude…
yoganandaness Jun 4, 2026
3db5539
refactor: undoing merge conflict resolving changes
yoganandaness Jun 4, 2026
951f241
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 4, 2026
795a1c4
Potential fix for pull request finding
yoganandaness Jun 4, 2026
a022a24
Potential fix for pull request finding
yoganandaness Jun 4, 2026
b307bb8
Potential fix for pull request finding
yoganandaness Jun 4, 2026
f7c4c35
Potential fix for pull request finding
yoganandaness Jun 4, 2026
56c041e
Fix docs: update rabbitMQActionHandler type from WorkflowEngineType[]…
Copilot Jun 4, 2026
f58c079
Potential fix for pull request finding
yoganandaness Jun 4, 2026
8a69a56
Potential fix for pull request finding
yoganandaness Jun 4, 2026
6164143
fix: use strict equality in ESI wizard status check
Copilot Jun 4, 2026
86e86e0
Fix ProposalDataSourceMock workflow status signature
Copilot Jun 4, 2026
48e1a08
feat: publish visit updated for approved visit registration updates a…
yoganandaness Jun 4, 2026
70b0789
chore: change favicon from ess to generic (#1550)
Copilot Jun 4, 2026
308a248
Merge develop and resolve proposal seed conflict
Copilot Jun 4, 2026
59c159e
Merge origin/develop into SWAP-5222-user-office-experiment-workflow-i…
Copilot Jun 4, 2026
51e5c74
Merge remote branch updates and resolve seed SQL conflict
Copilot Jun 4, 2026
e981380
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 4, 2026
1d54a84
fix: correct column order in instrument_has_proposals and questionari…
yoganandaness Jun 8, 2026
0141550
feat: implement experiment safety review workflow improvements and UI…
yoganandaness Jun 8, 2026
db70b5d
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 8, 2026
43c8c5f
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 9, 2026
369cff4
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 15, 2026
046add4
refactor: clean up unused dummyProposalEvents and improve rejection h…
yoganandaness Jun 19, 2026
ef1c386
feat: enhance experiment safety workflow with new status codes and im…
yoganandaness Jun 19, 2026
1f2bcf2
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jun 19, 2026
06ba852
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Jun 19, 2026
1b508b6
fix: correct spelling of ESF_APPROVED in ExperimentSafetyWorkflowStat…
yoganandaness Jul 1, 2026
225f2e5
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
jekabs-karklins Jul 3, 2026
0905f4f
feat: enhance experiment and proposal workflows with status connectio…
yoganandaness Jul 6, 2026
a481c92
Merge branch develop of github.com:UserOfficeProject/user-office-core…
yoganandaness Jul 6, 2026
d4e1401
feat: enhance experiment and proposal workflows with status connectio…
yoganandaness Jul 10, 2026
2812a2b
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 13, 2026
00eea47
feat: remove getWorkflowConnectionByNextStatusId method from Workflow…
yoganandaness Jul 13, 2026
5879718
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Jul 13, 2026
3388d70
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 13, 2026
e3be5a0
feat: improve experiment safety status handling and refactor related …
yoganandaness Jul 13, 2026
fc41e0f
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Jul 13, 2026
fba709b
Initial plan
Copilot Jul 14, 2026
1873cc3
Add unit tests for workflowHandler covering extraction, dispatch and …
Copilot Jul 14, 2026
5dc39b3
feat: implement changeExperimentsSafetyStatus mutation logic
yoganandaness Jul 14, 2026
135ef4b
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Jul 14, 2026
6fff014
Add unit tests for the unified workflowHandler (#1644)
yoganandaness Jul 14, 2026
80dc3c4
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 14, 2026
23449b1
feat: enhance workflow management by adding status handling and impro…
yoganandaness Jul 14, 2026
34f7f64
Merge branch 'SWAP-5222-user-office-experiment-workflow-improvement' …
yoganandaness Jul 14, 2026
213bf61
fix: implement changeExperimentsSafetyStatus mutation logic
yoganandaness Jul 14, 2026
fe52589
fix: prevent unnecessary workflow status updates when no valid entiti…
yoganandaness Jul 14, 2026
ca58ea0
fix: prevent onWorkflowStatusChange calls when no statuses have changed
yoganandaness Jul 14, 2026
bcef8ab
feat: add logging for experiment safety status changes by user and en…
yoganandaness Jul 14, 2026
14ed6e0
fix: update grouping properties to use workflowStatusConnectionId for…
yoganandaness Jul 16, 2026
8cf76d8
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 16, 2026
5485b37
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 20, 2026
33c726d
chore: start merge conflict resolution from develop
Copilot Jul 20, 2026
70e4c3a
fix: resolve merge conflicts in ExperimentsTable.tsx from develop branch
Copilot Jul 20, 2026
dfece1f
fix: reorder import statements in ExperimentsTable.tsx for consistency
yoganandaness Jul 20, 2026
27b142b
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 20, 2026
4be56ab
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 20, 2026
a109b8f
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 21, 2026
a590209
Merge branch 'develop' into SWAP-5222-user-office-experiment-workflow…
yoganandaness Jul 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
DO
$$
DECLARE
exp_safety_review_template_id_var int;
BEGIN
IF register_patch(
'ActivateExperimentSafetyReviewTemplate.sql',
'Yoganandan Pandiyan',
'Mark an experiment safety review template as active when none is active.',
'2026-06-08'
) THEN

SELECT template_id
INTO exp_safety_review_template_id_var
FROM templates
WHERE group_id = 'EXPERIMENT_SAFETY_REVIEW_TEMPLATE'
AND NOT EXISTS (
SELECT 1
FROM active_templates
WHERE group_id = 'EXPERIMENT_SAFETY_REVIEW_TEMPLATE'
)
ORDER BY template_id
LIMIT 1;

IF exp_safety_review_template_id_var IS NOT NULL THEN
INSERT INTO active_templates(group_id, template_id)
VALUES (
'EXPERIMENT_SAFETY_REVIEW_TEMPLATE',
exp_safety_review_template_id_var
)
ON CONFLICT (group_id) DO NOTHING;
END IF;

END IF;
END;
$$
LANGUAGE plpgsql;
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ BEGIN
, comment_for_management
, comment_for_user
, notified
, management_decision_submitted
, management_decision_submitted
, submitted
)
VALUES
Expand All @@ -98,11 +98,11 @@ BEGIN
, NULL
, NULL
, true
, true
, true
, true
, true
);

INSERT INTO instrument_has_proposals(instrument_id, proposal_pk) VALUES (1, 1);
INSERT INTO instrument_has_proposals(instrument_id, proposal_pk, management_time_allocation) VALUES (1, 1, 100);

INSERT INTO technical_review(proposal_pk, comment, time_allocation, status, public_comment, reviewer_id, technical_review_assignee_id, instrument_id, questionary_id)
VALUES (1, '', 2, 0, '', 0, 0, 1, technical_review_questionary_id_var);
Expand All @@ -122,7 +122,7 @@ BEGIN
, comment_for_management
, comment_for_user
, notified
, management_decision_submitted
, management_decision_submitted
, submitted
)
VALUES
Expand All @@ -140,11 +140,11 @@ BEGIN
, NULL
, NULL
, true
, true
, true
, true
, true
);

INSERT INTO instrument_has_proposals(instrument_id, proposal_pk) VALUES (2, 2);
INSERT INTO instrument_has_proposals(instrument_id, proposal_pk, management_time_allocation) VALUES (2, 2, 100);

END;
$DO$
Expand Down
285 changes: 283 additions & 2 deletions apps/backend/db_patches/db_seeds/0004_Experiments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ DECLARE
instrument_id_1_var int;
instrument_id_2_var int;
experiment_workflow_id_var int;
awaiting_esf_workflow_status_id_var int;
esf_is_review_workflow_status_id_var int;
esf_esr_review_workflow_status_id_var int;
esf_approved_workflow_status_id_var int;
esf_rejected_workflow_status_id_var int;
workflow_status_connection_id_var int;
email_action_id_var int;
rabbitmq_action_id_var int;
BEGIN
-- Get instrument ids
SELECT instrument_id INTO instrument_id_1_var FROM instruments WHERE name='Instrument 1' limit 1;
Expand All @@ -18,8 +26,277 @@ DECLARE

UPDATE call SET experiment_workflow_id = experiment_workflow_id_var;

INSERT INTO workflow_has_statuses(workflow_id, status_id)
VALUES (experiment_workflow_id_var, (SELECT status_id FROM statuses WHERE status_id='AWAITING_ESF'));
SELECT workflow_status_action_id
INTO email_action_id_var
FROM workflow_status_actions
WHERE type = 'EMAIL'
LIMIT 1;

SELECT workflow_status_action_id
INTO rabbitmq_action_id_var
FROM workflow_status_actions
WHERE type = 'RABBITMQ'
LIMIT 1;

INSERT INTO workflow_has_statuses(workflow_id, status_id, pos_x, pos_y)
VALUES (experiment_workflow_id_var, 'AWAITING_ESF', -191, -117)
RETURNING workflow_status_id INTO awaiting_esf_workflow_status_id_var;

INSERT INTO workflow_has_statuses(workflow_id, status_id, pos_x, pos_y)
VALUES (experiment_workflow_id_var, 'ESF_IS_REVIEW', -190, 5)
RETURNING workflow_status_id INTO esf_is_review_workflow_status_id_var;

INSERT INTO workflow_has_statuses(workflow_id, status_id, pos_x, pos_y)
VALUES (experiment_workflow_id_var, 'ESF_ESR_REVIEW', -189, 189)
RETURNING workflow_status_id INTO esf_esr_review_workflow_status_id_var;

INSERT INTO workflow_has_statuses(workflow_id, status_id, pos_x, pos_y)
VALUES (experiment_workflow_id_var, 'ESF_APPROVED', 303, 135)
RETURNING workflow_status_id INTO esf_approved_workflow_status_id_var;

INSERT INTO workflow_has_statuses(workflow_id, status_id, pos_x, pos_y)
VALUES (experiment_workflow_id_var, 'ESF_REJECTED', -187, 361)
RETURNING workflow_status_id INTO esf_rejected_workflow_status_id_var;

INSERT INTO workflow_status_connections(
workflow_id,
prev_workflow_status_id,
next_workflow_status_id,
source_handle,
target_handle
)
VALUES (
experiment_workflow_id_var,
awaiting_esf_workflow_status_id_var,
esf_is_review_workflow_status_id_var,
'bottom-source',
'top-target'
)
RETURNING workflow_status_connection_id INTO workflow_status_connection_id_var;

INSERT INTO workflow_status_connection_has_events(
workflow_status_connection_id,
status_changing_event
)
VALUES (workflow_status_connection_id_var, 'EXPERIMENT_ESF_SUBMITTED');

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
email_action_id_var,
experiment_workflow_id_var,
'{"recipientsWithEmailTemplate":[{"recipient":{"name":"INSTRUMENT_SCIENTISTS","description":"Instrument scientists including the manager on the instrument related to the proposal"},"emailTemplate":{"id":"instrument-scientist-esf-review","name":"Instrument Scientist ESF Review"}}]}'
);

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
rabbitmq_action_id_var,
experiment_workflow_id_var,
'{"exchanges":["user_office_backend.fanout"]}'
);

INSERT INTO workflow_status_connections(
workflow_id,
prev_workflow_status_id,
next_workflow_status_id,
source_handle,
target_handle
)
VALUES (
experiment_workflow_id_var,
esf_is_review_workflow_status_id_var,
esf_approved_workflow_status_id_var,
'right-source',
'top-target'
)
RETURNING workflow_status_connection_id INTO workflow_status_connection_id_var;

INSERT INTO workflow_status_connection_has_events(
workflow_status_connection_id,
status_changing_event
)
VALUES (workflow_status_connection_id_var, 'EXPERIMENT_ESF_APPROVED_BY_IS');

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
email_action_id_var,
experiment_workflow_id_var,
'{"recipientsWithEmailTemplate":[{"recipient":{"name":"PI","description":"Principal investigator on the proposal"},"emailTemplate":{"id":"esf-approved","name":"ESF Approved"}}]}'
);

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
rabbitmq_action_id_var,
experiment_workflow_id_var,
'{"exchanges":["user_office_backend.fanout"]}'
);

INSERT INTO workflow_status_connections(
workflow_id,
prev_workflow_status_id,
next_workflow_status_id,
source_handle,
target_handle
)
VALUES (
experiment_workflow_id_var,
esf_esr_review_workflow_status_id_var,
esf_rejected_workflow_status_id_var,
'bottom-source',
'top-target'
)
RETURNING workflow_status_connection_id INTO workflow_status_connection_id_var;

INSERT INTO workflow_status_connection_has_events(
workflow_status_connection_id,
status_changing_event
)
VALUES (workflow_status_connection_id_var, 'EXPERIMENT_ESF_REJECTED_BY_ESR');

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
email_action_id_var,
experiment_workflow_id_var,
'{"recipientsWithEmailTemplate":[{"recipient":{"name":"PI","description":"Principal investigator on the proposal"},"emailTemplate":{"id":"esf-rejected","name":"ESF Rejected"}}]}'
);

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
rabbitmq_action_id_var,
experiment_workflow_id_var,
'{"exchanges":["user_office_backend.fanout"]}'
);

INSERT INTO workflow_status_connections(
workflow_id,
prev_workflow_status_id,
next_workflow_status_id,
source_handle,
target_handle
)
VALUES (
experiment_workflow_id_var,
esf_is_review_workflow_status_id_var,
esf_esr_review_workflow_status_id_var,
'bottom-source',
'top-target'
)
RETURNING workflow_status_connection_id INTO workflow_status_connection_id_var;

INSERT INTO workflow_status_connection_has_events(
workflow_status_connection_id,
status_changing_event
)
VALUES (workflow_status_connection_id_var, 'EXPERIMENT_ESF_REJECTED_BY_IS');

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
email_action_id_var,
experiment_workflow_id_var,
'{"recipientsWithEmailTemplate":[{"recipient":{"name":"EXPERIMENT_SAFETY_REVIEWERS","description":"The Experiment Safety email address"},"emailTemplate":{"id":"esr-esf-review","name":"ESR ESF Review"}}]}'
);

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
rabbitmq_action_id_var,
experiment_workflow_id_var,
'{"exchanges":["user_office_backend.fanout"]}'
);

INSERT INTO workflow_status_connections(
workflow_id,
prev_workflow_status_id,
next_workflow_status_id,
source_handle,
target_handle
)
VALUES (
experiment_workflow_id_var,
esf_esr_review_workflow_status_id_var,
esf_is_review_workflow_status_id_var,
'right-source',
'right-target'
)
RETURNING workflow_status_connection_id INTO workflow_status_connection_id_var;

INSERT INTO workflow_status_connection_has_events(
workflow_status_connection_id,
status_changing_event
)
VALUES (workflow_status_connection_id_var, 'EXPERIMENT_ESF_APPROVED_BY_ESR');

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
email_action_id_var,
experiment_workflow_id_var,
'{"recipientsWithEmailTemplate":[{"recipient":{"name":"INSTRUMENT_SCIENTISTS","description":"Instrument scientists including the manager on the instrument related to the proposal"},"combineEmails":null,"emailTemplate":{"id":"instrument-scientist-esf-review","name":"Instrument Scientist ESF Review"},"otherRecipientEmails":null}]}'
);

INSERT INTO workflow_status_connection_has_actions(
workflow_status_connection_id,
workflow_status_action_id,
workflow_id,
config
)
VALUES (
workflow_status_connection_id_var,
rabbitmq_action_id_var,
experiment_workflow_id_var,
'{"exchanges":["user_office_backend.fanout"]}'
);

INSERT INTO experiments(
experiment_pk, experiment_id, scheduled_event_id, starts_at, ends_at, proposal_pk, status, local_contact_id, instrument_id)
Expand Down Expand Up @@ -47,6 +324,10 @@ DECLARE
INTO exp_safety_review_template_id_var
from templates
where group_id = 'EXPERIMENT_SAFETY_REVIEW_TEMPLATE' limit 1;

INSERT INTO active_templates(group_id, template_id)
VALUES ('EXPERIMENT_SAFETY_REVIEW_TEMPLATE', exp_safety_review_template_id_var)
ON CONFLICT (group_id) DO NOTHING;

select topics.topic_id
INTO exp_safety_review_template_topic_id_var
Expand Down
Loading
Loading