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

Delete mutation/tumor/treatment as last step to avoid stale index #444

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

calvinlu3
Copy link
Contributor

@calvinlu3 calvinlu3 added the fix Fix tag for release label Sep 20, 2024
@@ -42,3 +42,20 @@ export const extractArrayPath = (valuePath: string) => {
const firebaseArrayPath = pathParts.join('/');
return { firebaseArrayPath, deleteIndex };
};

export enum FIREBASE_PATH_TYPE {
Copy link
Member

Choose a reason for hiding this comment

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

Name is too generic. Maybe

Suggested change
export enum FIREBASE_PATH_TYPE {
export enum FIREBASE_LIST_PATH_TYPE {

@@ -115,17 +126,15 @@ export class FirebaseGeneReviewService {
} else if (isDeleteReview(reviewLevel)) {
const { firebaseArrayPath, deleteIndex } = extractArrayPath(reviewLevel.valuePath);
const firebasePath = geneFirebasePath + '/' + firebaseArrayPath;
const firebasePathType = getFirebasePathType(firebaseArrayPath + '/' + deleteIndex);
if (firebasePathType !== undefined) {
const innerMap = itemsToDelete[firebasePathType];
Copy link
Member

Choose a reason for hiding this comment

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

Is innerMap used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use it on the next line, so I don't have to do itemsToDelete[firebasePathType][firebasepath]

Comment on lines 167 to 171
for (const pathType of [FIREBASE_PATH_TYPE.TREATMENT_LIST, FIREBASE_PATH_TYPE.TUMOR_LIST, FIREBASE_PATH_TYPE.MUTATION_LIST]) {
for (const [firebasePath, deleteIndices] of Object.entries(itemsToDelete[pathType])) {
await this.firebaseRepository.deleteFromArray(firebasePath, deleteIndices);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I see here we are trying to delete deeper list first to avoid mismatch. But how are you addressing deleting/updating the next index?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question.
firebaseRepository.deleteFromArray(firebasePath, deleteIndices) will perform the deletion of the array of index in a transaction. The index will never be stale because we loop through the original list to construct a new firebase list.

Check out the code: https://github.com/oncokb/oncokb-transcript/blob/rc/src/main/webapp/app/stores/firebase/firebase-repository.ts#L83-L92

@zhx828
Copy link
Member

zhx828 commented Sep 21, 2024

We need some comments about these logics. We ned test to make sure after approving deletion will not affect the update on other indices.

Copy link

@bprize15 bprize15 left a comment

Choose a reason for hiding this comment

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

One minor comment, otherwise LGTM

// Todo: We should use multi-location updates for deletions once all our arrays use firebase auto-generated keys
// instead of using sequential number indices.
/* eslint-disable no-console */
console.log(itemsToDelete);

Choose a reason for hiding this comment

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

Remove

@zhx828 zhx828 self-requested a review September 23, 2024 14:54
await this.firebaseRepository.deleteFromArray(firebasePath, deleteIndices);
}
}
// If user accepts a deletion individually, we need to refresh the ReviewPage with the latest data to make sure the indices are up to date.
if (reviewLevels.length === 1 && hasDeletion) {

Choose a reason for hiding this comment

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

Why do we only refresh if the length is 1? If a review level corresponds to some change that needs to be reviewed, wouldn't we want to refresh if length > 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only time reviewLevels length is > 1 is when we use the accept all feature. In that case a refresh is not needed because everything should be accepted all together.

Copy link
Member

@zhx828 zhx828 left a comment

Choose a reason for hiding this comment

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

Once Ben's comment is addressed, it's good to go.

Copy link

@bprize15 bprize15 left a comment

Choose a reason for hiding this comment

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

LGTM

@calvinlu3 calvinlu3 merged commit f269cf8 into oncokb:rc Sep 23, 2024
2 checks passed
@calvinlu3 calvinlu3 deleted the fix/deleted-mutation branch September 23, 2024 16:04
jfkonecn added a commit that referenced this pull request Oct 3, 2024
* Handle when Instant json element is a json object

The completedDate in the DB could be ISO 8601 string, or json object. I think this has to do with the recent spring boot upgrade, but I can't find the specific version of the change. I will handle both scenarios for now

* Textarea in review mode should fit text content (#427)

* Update pom version

* Fix reject cancer type name review (#428)

* Add reference to oncokb sop alteration nomenclature in add mutation modal helper (#432)

* Update pom version

* Avoid fetching management info repeatedly

* Do not rerender the side bar when loading session

The getSession is an async method which updates the loading status.

* Fix drug code not selectable (#435)

* Bump actions to latest version (#438)

* resize text area when input changes (#440)

* add sorting by firebase index (#443)

* Delete mutation/tumor/treatment as last step to avoid stale index (#444)

* Review no longer removes data for core submission

* Added comments to useLastReviewOnly

* Add children review paths

* Fixed approve all

* Fixed UI tests

* Fixed UI tests

* break in middle of word to fix collapsible title overlfow (#442)

* Change searchEntities to readHandler instead of updateHandler (#445)

* Fixed submit all

* Fixed submission bug

* Fixed data validation tool (#447)

* Allow curating mutation summary (#433)

* Fixed submit all

* Fixed tests

* Fixed gene type submissions

* Removed last review check inside getevidences and gene type

* Added mutation summary

---------

Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Calvin Lu <[email protected]>
Co-authored-by: oncokb-bot <[email protected]>
Co-authored-by: bprize15 <[email protected]>
jfkonecn added a commit that referenced this pull request Oct 14, 2024
* Handle when Instant json element is a json object

The completedDate in the DB could be ISO 8601 string, or json object. I think this has to do with the recent spring boot upgrade, but I can't find the specific version of the change. I will handle both scenarios for now

* Textarea in review mode should fit text content (#427)

* Update pom version

* Fix reject cancer type name review (#428)

* Add reference to oncokb sop alteration nomenclature in add mutation modal helper (#432)

* Update pom version

* Avoid fetching management info repeatedly

* Do not rerender the side bar when loading session

The getSession is an async method which updates the loading status.

* Fix drug code not selectable (#435)

* Bump actions to latest version (#438)

* resize text area when input changes (#440)

* add sorting by firebase index (#443)

* Delete mutation/tumor/treatment as last step to avoid stale index (#444)

* break in middle of word to fix collapsible title overlfow (#442)

* Change searchEntities to readHandler instead of updateHandler (#445)

* Fixed data validation tool (#447)

* Allow curating mutation summary (#433)

* Parse protein change case insensitive (#441)

* Fix adding CDx biomarker association (#450)

* use firebase properties directly in backend (#451)

* fix references tab (#452)

* Added Heap (#448)

* Added Heap

* Updated CSP

* Reduce width so sidebar does not go offscren (#446)

* allow comma in mutation name when transcripts present (#453)

* allow comma in mutation name when transcripts present

* add missing colon

* rename transcripts to reference genomes

* Make core API call non-blocking

* Add tests for stale indices check (#455)

* Added loading icon when review is accepted

* Update setup-java action

* Update pom version

* Put feature flag in app config

* Now showing loading icon on accept all

---------

Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Calvin Lu <[email protected]>
Co-authored-by: oncokb-bot <[email protected]>
Co-authored-by: bprize15 <[email protected]>
jfkonecn added a commit that referenced this pull request Oct 24, 2024
* Added core submission logic

* Added Save Gene Logic (#385)

* Added name changes to review logic (#393)

* Added name change to core submission logic

* Added missing unit tests

* Addessed PR comments

* Removed unneeded uuid

* added comments to collectUUIDs function

* Added gene type submission (#396)

* Can now delete evidences (#398)

* fixed logging in

* fixed build errors

* updated drugs mapping

* updated drugs mapping

* Add releaseGene param when saving gene data to core

* Update to allow save all genes

* Fix excludedRCTs

* Add method to undo gene release

* Use reviewed content only (#430)

* Use reviewed content only

* Ignore if in review added state

* Save Genes now checks if added

* Delete parent node if added field is true

* Fixed build

* don't save undefined

* Addressed PR comments

* Addressed PR comments

* Feature/fix submit to core (#439)

* Handle when Instant json element is a json object

The completedDate in the DB could be ISO 8601 string, or json object. I think this has to do with the recent spring boot upgrade, but I can't find the specific version of the change. I will handle both scenarios for now

* Textarea in review mode should fit text content (#427)

* Update pom version

* Fix reject cancer type name review (#428)

* Add reference to oncokb sop alteration nomenclature in add mutation modal helper (#432)

* Update pom version

* Avoid fetching management info repeatedly

* Do not rerender the side bar when loading session

The getSession is an async method which updates the loading status.

* Fix drug code not selectable (#435)

* Bump actions to latest version (#438)

* resize text area when input changes (#440)

* add sorting by firebase index (#443)

* Delete mutation/tumor/treatment as last step to avoid stale index (#444)

* Review no longer removes data for core submission

* Added comments to useLastReviewOnly

* Add children review paths

* Fixed approve all

* Fixed UI tests

* Fixed UI tests

* break in middle of word to fix collapsible title overlfow (#442)

* Change searchEntities to readHandler instead of updateHandler (#445)

* Fixed submit all

* Fixed submission bug

* Fixed data validation tool (#447)

* Allow curating mutation summary (#433)

* Fixed submit all

* Fixed tests

* Fixed gene type submissions

* Removed last review check inside getevidences and gene type

* Added mutation summary

---------

Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Calvin Lu <[email protected]>
Co-authored-by: oncokb-bot <[email protected]>
Co-authored-by: bprize15 <[email protected]>

* Added Vus submissions to core (#456)

* Make core API call non-blocking (#454)

* Handle when Instant json element is a json object

The completedDate in the DB could be ISO 8601 string, or json object. I think this has to do with the recent spring boot upgrade, but I can't find the specific version of the change. I will handle both scenarios for now

* Textarea in review mode should fit text content (#427)

* Update pom version

* Fix reject cancer type name review (#428)

* Add reference to oncokb sop alteration nomenclature in add mutation modal helper (#432)

* Update pom version

* Avoid fetching management info repeatedly

* Do not rerender the side bar when loading session

The getSession is an async method which updates the loading status.

* Fix drug code not selectable (#435)

* Bump actions to latest version (#438)

* resize text area when input changes (#440)

* add sorting by firebase index (#443)

* Delete mutation/tumor/treatment as last step to avoid stale index (#444)

* break in middle of word to fix collapsible title overlfow (#442)

* Change searchEntities to readHandler instead of updateHandler (#445)

* Fixed data validation tool (#447)

* Allow curating mutation summary (#433)

* Parse protein change case insensitive (#441)

* Fix adding CDx biomarker association (#450)

* use firebase properties directly in backend (#451)

* fix references tab (#452)

* Added Heap (#448)

* Added Heap

* Updated CSP

* Reduce width so sidebar does not go offscren (#446)

* allow comma in mutation name when transcripts present (#453)

* allow comma in mutation name when transcripts present

* add missing colon

* rename transcripts to reference genomes

* Make core API call non-blocking

* Add tests for stale indices check (#455)

* Added loading icon when review is accepted

* Update setup-java action

* Update pom version

* Put feature flag in app config

* Now showing loading icon on accept all

---------

Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Calvin Lu <[email protected]>
Co-authored-by: oncokb-bot <[email protected]>
Co-authored-by: bprize15 <[email protected]>

---------

Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Hongxin <[email protected]>
Co-authored-by: Calvin Lu <[email protected]>
Co-authored-by: oncokb-bot <[email protected]>
Co-authored-by: bprize15 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix tag for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants