Skip to content

Commit 9717f47

Browse files
author
Shawn O'Connor
committed
Merge branch 'main' into vpodcqa
2 parents e87ccd9 + 998befe commit 9717f47

File tree

10 files changed

+48
-16
lines changed

10 files changed

+48
-16
lines changed

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ NEXT_PUBLIC_DATACOMMONS="vpodc_data_commons"
44
# uncomment and set the follow to connect the development frontend to a Gen3 commons backend. Note that the
55
# configuration in config needs to match the backend.
66
NEXT_PUBLIC_GEN3_API_TARGET=https://qa-vpodc.planx-pla.net
7+
# use /api for the mock responses in src/pages/api, or try same value as NEXT_PUBLIC_GEN3_API_TARGET for qa server responses:
8+
NEXT_VPODC_APPS_TARGET=/api

next.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const nextConfig = {
4242
if (isDev) {
4343
const GEN3_TARGET =
4444
process.env.NEXT_PUBLIC_GEN3_API_TARGET || 'https://localhost';
45+
const APP_TARGET =
46+
process.env.NEXT_VPODC_APPS_TARGET || GEN3_TARGET;
4547
return [
4648
{ source: '/_status', destination: `${GEN3_TARGET}/_status` },
4749
{ source: '/user/:path*', destination: `${GEN3_TARGET}/user/:path*` },
@@ -80,6 +82,14 @@ const nextConfig = {
8082
source: '/requestor/:path*',
8183
destination: `${GEN3_TARGET}/requestor/:path*`,
8284
},
85+
{
86+
source: '/cohort-middleware/:path*',
87+
destination: `${APP_TARGET}/cohort-middleware/:path*`,
88+
},
89+
{
90+
source: '/ga4gh/wes/v2/:path*',
91+
destination: `${APP_TARGET}/ga4gh/wes/v2/:path*`,
92+
},
8393
];
8494
} else {
8595
return [];

src/lib/AnalysisApps/GWASResults/Views/Input/JobDetails/JobDetails.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const JobDetails = ({ data }: {data?: WorkflowDetails}) => {
99
if (!(data?.arguments?.parameters)) {
1010
return <LoadingErrorMessage message='Issue Loading Data for Job Details' />;
1111
}
12-
const dataPeramiters = data?.arguments?.parameters.reduce((acc: {[key: string]: string}, param) => {
12+
const dataParameters = data?.arguments?.parameters.reduce((acc: {[key: string]: string}, param) => {
1313
acc[param.name] = param.value;
1414
return acc;
1515
}, {});
@@ -35,40 +35,40 @@ const JobDetails = ({ data }: {data?: WorkflowDetails}) => {
3535
<Group mt='sm' mb='sm'>
3636
<Group justify="space-between" className='w-full px-4'>
3737
<span>Dataset ID</span>
38-
<span>{dataPeramiters.dataset_id}</span>
38+
<span>{dataParameters.dataset_id}</span>
3939
</Group>
4040
<Group justify="space-between" className='w-full px-4'>
4141
<span>Dataset Observation Window</span>
42-
<span>{dataPeramiters.dataset_observation_window} days</span>
42+
<span>{dataParameters.dataset_observation_window} days</span>
4343
</Group>
4444
<Group justify="space-between" className='w-full px-4'>
4545
<span>Outcome of Interest ID</span>
46-
<span>{dataPeramiters.outcome_id}</span>
46+
<span>{dataParameters.outcome_id}</span>
4747
</Group>
4848
<Group justify="space-between" className='w-full px-4'>
4949
<span>Outcome Window</span>
50-
<span>{dataPeramiters.outcome_observation_window} days</span>
50+
<span>{dataParameters.outcome_observation_window} days</span>
5151
</Group>
5252
<Group justify="space-between" className='w-full px-4'>
5353
<span>Dataset size (after time window filters)</span>
54-
<span>see attrition table</span>
54+
<span>{dataParameters.dataset_size}</span>
5555
</Group>
5656
<Group justify="space-between" className='w-full px-4'>
5757
<span>Training set size</span>
58-
<span>see attrition table</span>
58+
<span>{dataParameters.training_set_size}</span>
5959
</Group>
6060
<Group justify="space-between" className='w-full px-4'>
6161
<span>Testing set size</span>
62-
<span>see attrition table</span>
62+
<span>{dataParameters.test_set_size}</span>
6363
</Group>
6464
<Group justify="space-between" className='w-full px-4'>
6565
<span>Cross-validation</span>
66-
<span>{dataPeramiters.n_fold} folds</span>
66+
<span>{dataParameters.n_fold} folds</span>
6767
</Group>
6868
</Group>
6969
<Divider />
7070
<Group mt='sm' mb='sm'>
71-
{modelRenderer(dataPeramiters.model_list).map(({name, value}, index) => (
71+
{modelRenderer(dataParameters.model_list).map(({name, value}, index) => (
7272
<Group
7373
key={`${name}-${index}`}
7474
justify="space-between"

src/lib/AnalysisApps/PLP/Components/AttritionTableWrapper/AttritionTableWrapper.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22
import { AttritionTable } from './AttritionTable/AttritionTable';
33
import { IconChevronUp, IconChevronDown } from '@tabler/icons-react';
4+
import ACTIONS from '../../Utils/StateManagement/Actions';
45

56
interface AttritionTableWrapperProps {
67
dispatch: (action: any) => void;
@@ -10,6 +11,7 @@ interface AttritionTableWrapperProps {
1011
outcomeObservationWindow: number;
1112
removeIndividualsWithPriorOutcome: boolean;
1213
percentageOfDataToUseAsTest: number | null;
14+
isOpen: boolean;
1315
}
1416

1517
interface cohort { // TODO - centralize this interface
@@ -26,9 +28,13 @@ const AttritionTableWrapper: React.FC<AttritionTableWrapperProps> = ({
2628
outcomeObservationWindow,
2729
removeIndividualsWithPriorOutcome,
2830
percentageOfDataToUseAsTest,
31+
isOpen,
2932
}) => {
30-
const [isOpen, setIsOpen] = useState(false);
31-
const toggleArrow = () => setIsOpen((prev) => !prev);
33+
const toggleArrow = () =>
34+
dispatch({
35+
type: ACTIONS.SET_ATTRITION_TABLE_OPEN,
36+
payload: !isOpen,
37+
});
3238

3339
return (
3440
<div data-tour="attrition-table">

src/lib/AnalysisApps/PLP/Components/JobSubmitModal/JobSubmitModal.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ const JobSubmitModal: React.FC<Props> = ({
7676

7777
// Submit workflow request
7878
const handleSubmit = async () => {
79+
if (!datasetRemainingSize) {
80+
setSubmitError('Please wait while the attrition table calculations finish and "Dataset size" is known...');
81+
return;
82+
}
7983
if (jobName === '') {
8084
handleEnterJobName(jobName);
8185
return; // do not submit if job name invalid
@@ -98,6 +102,9 @@ const JobSubmitModal: React.FC<Props> = ({
98102
covariate_min_fraction: minimumCovariateOccurrence,
99103
test_fraction: percentageOfDataToUseAsTest/100,
100104
n_fold: numberOfCrossValidationFolds,
105+
dataset_size: datasetRemainingSize,
106+
training_set_size: datasetRemainingSize ? Math.round((100-percentageOfDataToUseAsTest)*datasetRemainingSize/100) : null,
107+
test_set_size: datasetRemainingSize ? calculateTestSetSize(percentageOfDataToUseAsTest, datasetRemainingSize) : null,
101108
template_version: "plp-template",
102109
workflow_name: jobName,
103110
team_project: selectedTeamProject,
@@ -223,23 +230,23 @@ const JobSubmitModal: React.FC<Props> = ({
223230
Dataset size (after time window filters):
224231
</td>
225232
<td className="align-top">
226-
{datasetRemainingSize !== null ? datasetRemainingSize : 'see attrition table'}
233+
{datasetRemainingSize !== null ? datasetRemainingSize : 'waiting for attrition table...'}
227234
</td>
228235
</tr>
229236
<tr>
230237
<td className="font-semibold pr-4 text-right align-top whitespace-nowrap">
231238
Training set size:
232239
</td>
233240
<td className="align-top">
234-
{datasetRemainingSize !== null ? `${Math.round((100-percentageOfDataToUseAsTest)*datasetRemainingSize/100)}` : 'see attrition table'}
241+
{datasetRemainingSize !== null ? `${Math.round((100-percentageOfDataToUseAsTest)*datasetRemainingSize/100)}` : 'waiting for attrition table...'}
235242
</td>
236243
</tr>
237244
<tr>
238245
<td className="font-semibold pr-4 text-right align-top whitespace-nowrap">
239246
Testing set size:
240247
</td>
241248
<td className="align-top">
242-
{datasetRemainingSize !== null ? `${calculateTestSetSize(percentageOfDataToUseAsTest, datasetRemainingSize)}` : 'see attrition table'}
249+
{datasetRemainingSize !== null ? `${calculateTestSetSize(percentageOfDataToUseAsTest, datasetRemainingSize)}` : 'waiting for attrition table...'}
243250
</td>
244251
</tr>
245252
<tr>

src/lib/AnalysisApps/PLP/PLPContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ const PLPContainer = () => {
215215
outcomeObservationWindow={state.outcomeObservationWindow}
216216
removeIndividualsWithPriorOutcome={state.removeIndividualsWithPriorOutcome}
217217
percentageOfDataToUseAsTest={state.percentageOfDataToUseAsTest}
218+
isOpen={state.showExpandedAttritionTable}
218219
/>
219220
<div data-testid="GWASApp" className="p-4">
220221
<div className="steps-wrapper">
@@ -252,6 +253,7 @@ const PLPContainer = () => {
252253
data-tour="next-button"
253254
className="GWASUI-navBtn GWASUI-navBtn__next"
254255
onClick={() => {
256+
dispatch({ type: ACTIONS.SET_ATTRITION_TABLE_OPEN, payload: true });
255257
dispatch({ type: ACTIONS.SET_WORKFLOW_SUBMISSION_STATUS, payload: {status: '', response: null}});
256258
dispatch({ type: ACTIONS.SHOW_JOB_SUBMIT_MODAL });
257259
}}

src/lib/AnalysisApps/PLP/Utils/StateManagement/Actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ACTIONS = {
2929
SET_SELECTED_MODEL: 'setSelectedModel',
3030
SET_SELECTED_MODEL_PARAMETERS: 'setSelectedModelParameters',
3131
SET_WORKFLOW_SUBMISSION_STATUS: 'setWorkflowSubmissionStatus',
32+
SET_ATTRITION_TABLE_OPEN: 'setAttritionTableOpen',
3233
};
3334

3435
export default ACTIONS;

src/lib/AnalysisApps/PLP/Utils/StateManagement/InitialState.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const initialState = {
2020
workflowSubmissionStatus: null,
2121
workflowSubmissionId: null,
2222
selectedTeamProject: '',
23+
showExpandedAttritionTable: false,
2324
};
2425

2526
export default initialState;

src/lib/AnalysisApps/PLP/Utils/StateManagement/reducer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface State {
2727
jobName: string;
2828
workflowSubmissionStatus: string | null;
2929
workflowSubmissionId: string | null;
30+
showExpandedAttritionTable: boolean;
3031
};
3132

3233
const reducer = (state: State, action: Action): State => {
@@ -83,6 +84,8 @@ const reducer = (state: State, action: Action): State => {
8384
return { ...state, modelParameters: action.payload };
8485
case ACTIONS.SET_WORKFLOW_SUBMISSION_STATUS:
8586
return { ...state, workflowSubmissionStatus: action.payload.status, workflowSubmissionId: action.payload.response };
87+
case ACTIONS.SET_ATTRITION_TABLE_OPEN:
88+
return { ...state, showExpandedAttritionTable: action.payload };
8689
default:
8790
throw new Error(`Unknown action passed to reducer: ${action}`);
8891
}

src/pages/api/cohort-middleware/cohortdefinition-stats/by-source-id/[sourceId]/by-cohort-definition-ids/[cohort1]/[cohort2]/by-observation-window-1st-cohort/[datasetObservationWindow]/by-outcome-window-2nd-cohort/[outcomeObservationWindow]/remove-prior-outcome/[removePrior]/index.ts renamed to src/pages/api/cohort-middleware/cohortdefinition-stats/by-source-id/[sourceId]/by-cohort-definition-ids/[cohort1]/[cohort2]/by-observation-window-1st-cohort/[datasetObservationWindow]/by-outcome-window-2nd-cohort/[outcomeObservationWindow]/index.ts

File renamed without changes.

0 commit comments

Comments
 (0)