-
Notifications
You must be signed in to change notification settings - Fork 0
Feat 58 submission workflow #60
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
Open
karimouf
wants to merge
16
commits into
project-31-eiwa
Choose a base branch
from
feat-58-submission_workflow
base: project-31-eiwa
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
07e5304
feat: add refrence to previous submission
karimouf e3a8d4e
feat: add previous submission refrence functionality
karimouf 6e47c3e
feat: new workflow migration
karimouf 143caf1
fix: create and adapt to revision workflow
karimouf 33572e1
fix: fix doucment_data duplication
karimouf 9954445
fix: fix previousSubmissionId refrence
karimouf 8a38c5e
feat: create new assigment mode
karimouf 4491c56
fix: adapted the component based readonly
karimouf 58df51a
refactor: adapt pdf components to accomadate multiple pdfs in same study
karimouf f802f49
Merge remote-tracking branch 'origin/feat-37-grading_review_workflow'…
karimouf fd31f39
Merge branch 'project-31-eiwa' into feat-58-submission_workflow
dennis-zyska f6ebcf7
fix: fix renconfiguration renamed variable
karimouf 8c56b8b
fix: rename showDefualtAnnotations to showAllDocumentsAnnotations
karimouf 4330794
fix: unified code usage + fix error from merge
karimouf 9e020b1
refactor: add new key for previous assessment data
karimouf 07b3bce
fix: fix comments
karimouf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
backend/db/migrations/20260103134710-extend-submission-previousSubmissionId.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| 'use strict'; | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = { | ||
| async up (queryInterface, Sequelize) { | ||
| await queryInterface.addColumn('submission', 'previousSubmissionId', { | ||
| type: Sequelize.INTEGER, | ||
| allowNull: true, | ||
| references: { | ||
| model: 'submission', | ||
| key: 'id' | ||
| }, | ||
| onUpdate: 'CASCADE', | ||
| onDelete: 'SET NULL' | ||
| }); | ||
| }, | ||
|
|
||
| async down (queryInterface, Sequelize) { | ||
| await queryInterface.removeColumn('submission', 'previousSubmissionId'); | ||
| } | ||
| }; |
188 changes: 188 additions & 0 deletions
188
backend/db/migrations/20260103145255-extend-workflow-revision_workflow.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| 'use strict'; | ||
|
|
||
| const workflows = [ | ||
| { | ||
| name: "Revision Workflow", | ||
| description: "Two-step annotation workflow: review previous submission, then annotate with assessment", | ||
| steps: [ | ||
| { | ||
| stepType: 1, | ||
| allowBackward: false, | ||
| workflowStepDocument: null, | ||
| configuration: { | ||
| settings: { | ||
| fields: [ | ||
| { | ||
| key: "configurationId", | ||
| label: "Assessment Configuration File:", | ||
| type: "select", | ||
| required: true, | ||
| options: { | ||
| table: "configuration", | ||
| name: "name", | ||
| value: "id", | ||
| filter: [ | ||
| { key: "type", value: 0 }, | ||
| { key: "deleted", value: false } | ||
| ] | ||
| }, | ||
| help: "Select the configuration file for assessment sidebar." | ||
| }, | ||
| { | ||
| key: "forcedAssessment", | ||
| label: "Forced Assessment", | ||
| type: "switch", | ||
| required: false, | ||
| default: false, | ||
| help: "If enabled, users must save a score and justification for every criterion before they can proceed." | ||
| }, | ||
| { | ||
| key: "showAllDocumentAnnotations", | ||
| label: "Show all document Annotations", | ||
| type: "switch", | ||
| required: false, | ||
| default: true, | ||
| help: "If enabled, all document annotations will be shown to the reviewer." | ||
| } | ||
| ], | ||
| }, | ||
| readOnlyComponents: ["annotator", "assessment"], | ||
| placeholders: false | ||
| } | ||
| }, | ||
| { | ||
| stepType: 1, | ||
| allowBackward: true, | ||
| workflowStepDocument: null, | ||
| configuration: { | ||
| settings: { | ||
| fields: [ | ||
| { | ||
| key: "configurationId", | ||
| label: "Assessment Configuration File:", | ||
| type: "select", | ||
| required: true, | ||
| options: { | ||
| table: "configuration", | ||
| name: "name", | ||
| value: "id", | ||
| filter: [ | ||
| { key: "type", value: 0 }, | ||
| { key: "deleted", value: false } | ||
| ] | ||
| }, | ||
| help: "Select the configuration file for assessment sidebar." | ||
| }, | ||
| { | ||
| key: "forcedAssessment", | ||
| label: "Forced Assessment", | ||
| type: "switch", | ||
| required: false, | ||
| default: false, | ||
| help: "If enabled, users must save a score and justification for every criterion before they can proceed." | ||
| } | ||
| ], | ||
| }, | ||
| previousAssessmentData: 1, | ||
| readOnlyComponents: [], | ||
| placeholders: false | ||
| } | ||
| }, | ||
| ], | ||
| } | ||
| ]; | ||
|
|
||
| module.exports = { | ||
| async up(queryInterface, Sequelize) { | ||
| // Insert workflows | ||
| const workflowInsertions = await queryInterface.bulkInsert( | ||
| 'workflow', | ||
| workflows.map(w => ({ | ||
| name: w.name, | ||
| description: w.description, | ||
| createdAt: new Date(), | ||
| updatedAt: new Date() | ||
| })), | ||
| { returning: true } | ||
| ); | ||
|
|
||
| const workflowMap = {}; | ||
| workflowInsertions.forEach((w, index) => { | ||
| workflowMap[workflows[index].name] = w.id; | ||
| }); | ||
|
|
||
| // Insert workflow steps | ||
| for (const workflow of workflows) { | ||
| const workflowId = workflowMap[workflow.name]; | ||
| let previousStepId = null; | ||
| const stepMap = {}; | ||
| const innerStepMap = {}; | ||
|
|
||
| for (let innerStepId = 1; innerStepId <= workflow.steps.length; innerStepId++) { | ||
| const step = workflow.steps[innerStepId - 1]; | ||
|
|
||
| const stepInsertion = await queryInterface.bulkInsert( | ||
| 'workflow_step', | ||
| [{ | ||
| workflowId: workflowId, | ||
| stepType: step.stepType, | ||
| workflowStepPrevious: previousStepId, | ||
| allowBackward: step.allowBackward, | ||
| workflowStepDocument: null, | ||
| configuration: JSON.stringify(step.configuration || {}), | ||
| createdAt: new Date(), | ||
| updatedAt: new Date() | ||
| }], | ||
| { returning: true } | ||
| ); | ||
|
|
||
| const dbStepId = stepInsertion[0].id; | ||
| stepMap[innerStepId] = dbStepId; | ||
| innerStepMap[innerStepId] = dbStepId; | ||
| previousStepId = dbStepId; | ||
| } | ||
|
|
||
| // Update workflowStepDocument with correct references | ||
| for (let innerStepId = 1; innerStepId <= workflow.steps.length; innerStepId++) { | ||
| const step = workflow.steps[innerStepId - 1]; | ||
|
|
||
| if (step.workflowStepDocument !== null) { | ||
| await queryInterface.bulkUpdate( | ||
| 'workflow_step', | ||
| { workflowStepDocument: innerStepMap[step.workflowStepDocument] }, | ||
| { id: innerStepMap[innerStepId] } | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| async down(queryInterface, Sequelize) { | ||
| const workflowNames = workflows.map(w => w.name); | ||
|
|
||
| // First get workflow IDs | ||
| const workflowRecords = await queryInterface.sequelize.query( | ||
| `SELECT id, name FROM workflow WHERE name IN (:names)`, | ||
| { | ||
| replacements: { names: workflowNames }, | ||
| type: queryInterface.sequelize.QueryTypes.SELECT | ||
| } | ||
| ); | ||
|
|
||
| const workflowIds = workflowRecords.map(w => w.id); | ||
|
|
||
| if (workflowIds.length > 0) { | ||
| await queryInterface.bulkDelete('workflow_step', { | ||
| workflowId: { | ||
| [Sequelize.Op.in]: workflowIds | ||
| } | ||
| }, {}); | ||
|
|
||
| await queryInterface.bulkDelete('workflow', { | ||
| name: { | ||
| [Sequelize.Op.in]: workflowNames | ||
| } | ||
| }, {}); | ||
| } | ||
| } | ||
| }; | ||
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
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
Oops, something went wrong.
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.
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.
We should add to the configuration that the assessment from the previous step should be loaded, maybe sometimes this is not needed
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.
You mean like we add a check that the previous assessment is loaded why do wee need that though?