-
Notifications
You must be signed in to change notification settings - Fork 5
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
PEPPER-1388 remove angio from pancan redirect #2933
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
84 changes: 84 additions & 0 deletions
84
...main/java/org/broadinstitute/ddp/studybuilder/task/pancan/PancanAngioRedirectRemoval.java
This file contains 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,84 @@ | ||
package org.broadinstitute.ddp.studybuilder.task.pancan; | ||
|
||
import com.typesafe.config.Config; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.broadinstitute.ddp.db.DBUtils; | ||
import org.broadinstitute.ddp.db.dao.JdbiUmbrellaStudy; | ||
import org.broadinstitute.ddp.exception.DDPException; | ||
import org.broadinstitute.ddp.studybuilder.task.CustomTask; | ||
import org.jdbi.v3.core.Handle; | ||
import org.jdbi.v3.sqlobject.SqlObject; | ||
import org.jdbi.v3.sqlobject.customizer.Bind; | ||
import org.jdbi.v3.sqlobject.statement.SqlQuery; | ||
import org.jdbi.v3.sqlobject.statement.SqlUpdate; | ||
|
||
import java.nio.file.Path; | ||
|
||
@Slf4j | ||
public class PancanAngioRedirectRemoval implements CustomTask { | ||
|
||
private Path cfgPath; | ||
private Config studyCfg; | ||
private Config varsCfg; | ||
private SqlHelper sqlHelper; | ||
|
||
@Override | ||
public void init(Path cfgPath, Config studyCfg, Config varsCfg) { | ||
this.cfgPath = cfgPath; | ||
this.studyCfg = studyCfg; | ||
this.varsCfg = varsCfg; | ||
} | ||
|
||
@Override | ||
public void run(Handle handle) { | ||
var studyDto = handle.attach(JdbiUmbrellaStudy.class).findByStudyGuid(studyCfg.getString("study.guid")); | ||
if (!studyDto.getGuid().equals("cmi-pancan")) { | ||
throw new DDPException("This task is only for the pancan study!"); | ||
} | ||
|
||
sqlHelper = handle.attach(SqlHelper.class); | ||
|
||
//find and delete the ANGIO study redirect workflow transition | ||
long workflowTransitionId = sqlHelper.findPancanAngioStudyRedirectWorkflowId(); | ||
DBUtils.checkDelete(1, sqlHelper.updatePancanAngioRedirectPex(workflowTransitionId)); | ||
log.info("Deleted workflow transition with ID: {}", workflowTransitionId); | ||
|
||
//update pex expressions to remove ANGIO (C_SARCOMAS_ANGIOSARCOMA) | ||
int rowCount = sqlHelper.updatePancanAngioRedirectPex(); | ||
log.info("Updated {} rows in expression table", rowCount); | ||
} | ||
|
||
|
||
private interface SqlHelper extends SqlObject { | ||
|
||
@SqlQuery("select trans.workflow_transition_id " | ||
+ " from workflow_transition as trans " | ||
+ " join umbrella_study as s on s.umbrella_study_id = trans.umbrella_study_id " | ||
+ " join workflow_state as next_state on next_state.workflow_state_id = trans.next_state_id " | ||
+ " join workflow_state_type as next_state_type on next_state_type.workflow_state_type_id " | ||
+ " = next_state.workflow_state_type_id " | ||
+ " left join workflow_activity_state as next_act_state on next_act_state.workflow_state_id " | ||
+ " = next_state.workflow_state_id " | ||
+ " left join expression as expr on expr.expression_id = trans.precondition_expression_id " | ||
+ " left join workflow_study_redirect_state as next_redirect_state on " | ||
+ " next_redirect_state.workflow_state_id = next_state.workflow_state_id " | ||
+ " where s.guid = 'cmi-pancan' " | ||
+ " and trans.is_active " | ||
+ " and next_state_type.workflow_state_type_code = 'STUDY_REDIRECT' " | ||
+ " and study_guid = 'ANGIO'") | ||
long findPancanAngioStudyRedirectWorkflowId(); | ||
|
||
@SqlUpdate("delete workflow_transition " | ||
+ "from workflow_transition " | ||
+ "where workflow_transition_id = :workflowTransitionId") | ||
int updatePancanAngioRedirectPex(@Bind("workflowTransitionId") long workflowTransitionId); | ||
|
||
@SqlUpdate("update expression " | ||
+ "set expression_text = REPLACE(expression_text, '\"C_SARCOMAS_ANGIOSARCOMA\",', '') " | ||
+ "where expression_text like '%hasOptionStartsWith(\"C_SARCOMAS_ANGIOSARCOMA\", \"C_GASTRO_ESOPHAGEAL_CANCER\"%' ") | ||
int updatePancanAngioRedirectPex(); | ||
|
||
} | ||
|
||
|
||
} |
This file contains 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.
This file changes are just to keep config in sync with what patch is doing and patch doest use this file.