Skip to content

Commit

Permalink
Feature/fix submit to core (#439)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
6 people authored Oct 3, 2024
1 parent 4204647 commit dafac59
Show file tree
Hide file tree
Showing 43 changed files with 849 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/after-branch-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
version: ${{ steps.find_release.outputs.tag }}

- name: 'Setup Java'
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.12.2'
- uses: actions/setup-java@v2
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
name: OncoKB Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.12.2"
- uses: actions/setup-java@v2
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/webdriver-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build Docker images
run: docker compose build
Expand All @@ -19,7 +19,7 @@ jobs:
- name: Archive screenshots
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: visual-regression-screenshots
path: ./src/test/javascript/screenshots
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>org.mskcc.oncokb.curation</groupId>
<artifactId>oncokb-curation</artifactId>
<version>2.0.21</version>
<version>2.0.23</version>
<packaging>jar</packaging>
<name>OncoKB Curation</name>
<description>Description for oncokb-curation</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ public class InstantTypeAdapter implements JsonSerializer<Instant>, JsonDeserial

@Override
public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
return Instant.parse(json.getAsString());
if (json.isJsonPrimitive()) {
// Handle the ISO 8601 string format
return Instant.parse(json.getAsString());
} else if (json.isJsonObject()) {
// Handle the {"seconds":..., "nanos":...} object format
JsonObject jsonObject = json.getAsJsonObject();
long seconds = jsonObject.get("seconds").getAsLong();
int nanos = jsonObject.get("nanos").getAsInt();
return Instant.ofEpochSecond(seconds, nanos);
} else {
throw new JsonParseException("Unexpected JSON type: " + json.getClass().getSimpleName());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
!path.startsWith("/login") &&
!path.startsWith("/oauth2") &&
!path.startsWith("/legacy-api") &&
!path.startsWith("/websocket") &&
!path.contains(".") &&
path.matches("/(.*)")
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ProxyWebSocketHandler(ApplicationProperties applicationProperties) {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
try {
String incomingUri = session.getUri().toString();
String incomingUri = session.getUri().getPath();
StandardWebSocketClient client = new StandardWebSocketClient();
OncoCoreWebSocketHandler handler = new OncoCoreWebSocketHandler(session);
client.doHandshake(handler, this.baseUrl + "/api" + incomingUri);
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ const App: React.FunctionComponent<IAppProps> = (props: IAppProps) => {
pauseOnFocusLoss
/>
<BetaSiteMessage />
{props.loadingAuth ? (
<LoadingIndicator isLoading size={LoaderSize.LARGE} center={true} />
) : (
{props.loadingAuth && <LoadingIndicator isLoading size={LoaderSize.LARGE} center={true} />}
{props.authAccount && (
<div>
{props.isAuthorized && <NavigationSidebar />}
<div className="app-center-content-wrapper" style={{ margin: props.centerContentMargin }}>
Expand All @@ -63,6 +62,7 @@ const mapStoreToProps = ({ authStore, layoutStore, firebaseAppStore }: IRootStor
authorities: authStore.account.authorities,
isCurator: hasAnyAuthority(authStore.account.authorities ?? [], [AUTHORITIES.CURATOR]),
loadingAuth: authStore.loading,
authAccount: authStore.account,
navigationSidebarWidth: layoutStore.navigationSidebarWidth,
toggleNavSidebar: layoutStore.toggleNavigationSidebar,
centerContentMargin: layoutStore.centerContentMargin,
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/app/components/sidebar/NavigationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ export const NavigationSidebar: React.FunctionComponent<StoreProps> = ({ isNavSi
.value();

setEntityMenuOrder(order);
}, []);

props.fetchManagementInfo!();
props.getManagementInfo!();
}, []);

return (
<Sidebar
Expand Down Expand Up @@ -318,7 +318,7 @@ const mapStoreToProps = ({ layoutStore, authStore, managementStore }: IRootStore
account: authStore.account,
managementVersion: managementStore.version,
managementCommit: managementStore.commit,
fetchManagementInfo: flow(managementStore.fetchManagementInfo),
getManagementInfo: managementStore.getManagementInfo,
});

type StoreProps = Partial<ReturnType<typeof mapStoreToProps>>;
Expand Down
9 changes: 3 additions & 6 deletions src/main/webapp/app/entities/drug/drug-update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IRootStore } from 'app/stores';
import { SaveButton } from 'app/shared/button/SaveButton';
import { getEntityActionRoute } from 'app/shared/util/RouteUtils';
import { ENTITY_ACTION, ENTITY_TYPE } from 'app/config/constants/constants';
import NcitCodeSelect, { parseNcitUniqId } from 'app/shared/select/NcitCodeSelect';
import NcitCodeSelect from 'app/shared/select/NcitCodeSelect';
import { mapIdList } from 'app/shared/util/entity-utils';
import { IDrug } from 'app/shared/model/drug.model';
import { INciThesaurus } from 'app/shared/model/nci-thesaurus.model';
Expand Down Expand Up @@ -46,7 +46,6 @@ export const DrugUpdate = (props: IDrugUpdateProps) => {
props.getEntity(props.match.params.id);
}

props.getNciThesauruses({});
props.getFlags({});
props.getAssociations({});
}, []);
Expand Down Expand Up @@ -148,9 +147,9 @@ export const DrugUpdate = (props: IDrugUpdateProps) => {
<FormGroup>
<Label>Code</Label>
<NcitCodeSelect
ncit={drugEntity.nciThesaurus}
ncit={drugEntity.nciThesaurus ?? selectedNcit}
onChange={selectedOption => {
setSelectedNcit(selectedOption ? parseNcitUniqId(selectedOption.value) : undefined);
setSelectedNcit(selectedOption ? selectedOption.ncit : undefined);
}}
/>
</FormGroup>
Expand All @@ -164,14 +163,12 @@ export const DrugUpdate = (props: IDrugUpdateProps) => {
};

const mapStoreToProps = (storeState: IRootStore) => ({
nciThesauruses: storeState.nciThesaurusStore.entities,
flags: storeState.flagStore.entities,
associations: storeState.associationStore.entities,
drugEntity: storeState.drugStore.entity,
loading: storeState.drugStore.loading,
updating: storeState.drugStore.updating,
updateSuccess: storeState.drugStore.updateSuccess,
getNciThesauruses: storeState.nciThesaurusStore.getEntities,
getFlags: storeState.flagStore.getEntities,
getAssociations: storeState.associationStore.getEntities,
getEntity: storeState.drugStore.getEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { isSectionRemovableWithoutReview } from 'app/shared/util/firebase/fireba
import EditIcon from 'app/shared/icons/EditIcon';
import ModifyCancerTypeModal from 'app/shared/modal/ModifyCancerTypeModal';
import { notifyError } from 'app/oncokb-commons/components/util/NotificationUtils';
import _ from 'lodash';
import { getLevelDropdownOptions } from 'app/shared/util/firebase/firebase-level-utils';
import { DIAGNOSTIC_LEVELS_ORDERING, READABLE_FIELD, PROGNOSTIC_LEVELS_ORDERING } from 'app/config/constants/firebase';
import { RealtimeTextAreaInput } from 'app/shared/firebase/input/RealtimeInputs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { IRootStore } from 'app/stores';
import { get, onValue, ref } from 'firebase/database';
import _ from 'lodash';
import { observer } from 'mobx-react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Button } from 'reactstrap';
import BadgeGroup from '../BadgeGroup';
import { DeleteSectionButton } from '../button/DeleteSectionButton';
Expand All @@ -49,6 +49,7 @@ import { NestLevelColor, NestLevelMapping, NestLevelType } from './NestLevel';
import { RemovableCollapsible } from './RemovableCollapsible';
import { Unsubscribe } from 'firebase/database';
import { getLocationIdentifier } from 'app/components/geneHistoryTooltip/gene-history-tooltip-utils';
import { SimpleConfirmModal } from 'app/shared/modal/SimpleConfirmModal';

export interface IMutationCollapsibleProps extends StoreProps {
mutationPath: string;
Expand Down Expand Up @@ -77,15 +78,21 @@ const MutationCollapsible = ({
annotatedAltsCache,
genomicIndicators,
showLastModified,
handleFirebaseUpdate,
}: IMutationCollapsibleProps) => {
const firebaseMutationsPath = `${getFirebaseGenePath(isGermline, hugoSymbol)}/mutations`;

const [mutationUuid, setMutationUuid] = useState<string>('');
const [mutationName, setMutationName] = useState<string>('');
const [mutationNameReview, setMutationNameReview] = useState<Review | null>(null);
const [mutationSummary, setMutationSummary] = useState<string>('');
const [mutationAlterations, setMutationAlterations] = useState<Alteration[] | null>(null);
const [isRemovableWithoutReview, setIsRemovableWithoutReview] = useState(false);
const [relatedAnnotationResult, setRelatedAnnotationResult] = useState<AlterationAnnotationStatus[]>([]);
const [oncogenicity, setOncogenicity] = useState<string>('');
const [showSimpleConfirmModal, setShowSimpleConfirmModal] = useState<boolean>(false);
const [simpleConfirmModalBody, setSimpleConfirmModalBody] = useState<string | undefined>(undefined);
const [mutationSummaryRef, setMutationSummaryRef] = useState<HTMLElement | null>(null);

useEffect(() => {
const arr = annotatedAltsCache?.get(hugoSymbol ?? '', [{ name: mutationName, alterations: mutationAlterations }]) ?? [];
Expand Down Expand Up @@ -157,6 +164,11 @@ const MutationCollapsible = ({
setMutationName(snapshot.val());
}),
);
callbacks.push(
onValue(ref(firebaseDb, `${mutationPath}/summary`), snapshot => {
setMutationSummary(snapshot.val());
}),
);
callbacks.push(
onValue(ref(firebaseDb, `${mutationPath}/alterations`), snapshot => {
setMutationAlterations(snapshot.val());
Expand All @@ -169,6 +181,11 @@ const MutationCollapsible = ({
setIsRemovableWithoutReview(isSectionRemovableWithoutReview(review));
}),
);
callbacks.push(
onValue(ref(firebaseDb, `${mutationPath}/mutation_effect/oncogenic`), snapshot => {
setOncogenicity(snapshot.val());
}),
);

onValue(
ref(firebaseDb, `${mutationPath}/name_uuid`),
Expand Down Expand Up @@ -197,6 +214,34 @@ const MutationCollapsible = ({
[mutationPath, mutationName, parsedHistoryList],
);

async function simpleConfirmModalOnConfirm() {
await handleFirebaseUpdate?.(mutationPath, { summary: '' });
if (mutationSummaryRef) {
mutationSummaryRef.click();
}
setShowSimpleConfirmModal(false);
setSimpleConfirmModalBody(undefined);
}

function oncogenicityRadioOnClick(
event: React.MouseEvent<HTMLInputElement> | React.MouseEvent<HTMLLabelElement> | React.MouseEvent<HTMLDivElement>,
) {
if (mutationSummary && event.target) {
let newOncogenicityVal;
if (event.target instanceof HTMLInputElement) {
newOncogenicityVal = event.target.value;
} else if (event.target instanceof HTMLDivElement || event.target instanceof HTMLLabelElement) {
newOncogenicityVal = event.target.innerText;
}
if (newOncogenicityVal === RADIO_OPTION_NONE) {
event.preventDefault();
setMutationSummaryRef(event.target as HTMLElement);
setShowSimpleConfirmModal(true);
setSimpleConfirmModalBody(`Mutation summary will be removed after removing oncogenicity.`);
}
}
}

async function handleDeleteMutation(toVus = false) {
if (!firebaseDb) {
return;
Expand Down Expand Up @@ -308,6 +353,25 @@ const MutationCollapsible = ({
}
isPendingDelete={isMutationPendingDelete}
>
<RealtimeTextAreaInput
firebasePath={`${mutationPath}/summary`}
inputClass={styles.summaryTextarea}
label="Mutation Summary (Optional)"
labelIcon={
<GeneHistoryTooltip
historyData={parsedHistoryList}
location={`${getMutationName(mutationName, mutationAlterations)}, ${READABLE_FIELD.SUMMARY}`}
locationIdentifier={getLocationIdentifier({
mutationUuid,
fields: [READABLE_FIELD.SUMMARY],
})}
/>
}
name="mutationSummary"
parseRefs
disabled={oncogenicity === ''}
disabledMessage={'Not curatable: mutation summary is only curatable when oncogenicity is specified.'}
/>
<Collapsible
idPrefix={`${mutationName}-mutation-effect`}
title="Mutation Effect"
Expand Down Expand Up @@ -369,6 +433,10 @@ const MutationCollapsible = ({
}
</>
}
/** Radio a bit tricky. Have to use onMouseDown event to cancel the default event.
* The onclick event does not like to be overwritten **/
onMouseDown={oncogenicityRadioOnClick}
labelOnClick={oncogenicityRadioOnClick}
isRadio
options={[...ONCOGENICITY_OPTIONS, RADIO_OPTION_NONE].map(label => ({
label,
Expand Down Expand Up @@ -598,6 +666,12 @@ const MutationCollapsible = ({
}}
/>
) : undefined}
<SimpleConfirmModal
show={showSimpleConfirmModal}
body={simpleConfirmModalBody}
onConfirm={simpleConfirmModalOnConfirm}
onCancel={() => setShowSimpleConfirmModal(false)}
/>
</>
);
};
Expand All @@ -623,6 +697,7 @@ const mapStoreToProps = ({
firebaseDb: firebaseAppStore.firebaseDb,
annotatedAltsCache: curationPageStore.annotatedAltsCache,
genomicIndicators: firebaseGenomicIndicatorsStore.data,
handleFirebaseUpdate: firebaseGeneService.updateObject,
});

type StoreProps = Partial<ReturnType<typeof mapStoreToProps>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

.collapsibleTitleWrapper {
display: flex;
word-break: break-word;
align-items: center;
:hover {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export enum SortOptions {
LAST_MODIFIED = 'Last Modified',
POSITION_INCREASING = 'Position Increasing',
POSITION_DECREASING = 'Position Decreasing',
FIREBASE = 'Firebase',
}

const YES = 'Yes';
Expand Down
Loading

0 comments on commit dafac59

Please sign in to comment.