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

Project "Jiffy Lube": TypeScript, Continuous Integration, React 16.13, etc. #131

Merged
merged 70 commits into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d308287
github config and vscode settings
jdpigeon Jun 21, 2020
824b322
webpack
jdpigeon Jun 21, 2020
4faad36
Updated package.json
jdpigeon Jun 21, 2020
57b81c1
tsconfig
jdpigeon Jun 21, 2020
7760992
scripts and test
jdpigeon Jun 22, 2020
27b267a
everything else
jdpigeon Jun 22, 2020
9e1fb53
deps
jdpigeon Jun 22, 2020
aae9015
prepping for conversion
jdpigeon Jun 22, 2020
07f16d5
flow -> ts
jdpigeon Jun 22, 2020
6c7410b
prettier
jdpigeon Jun 22, 2020
ec212c7
more flow -ts
jdpigeon Jun 23, 2020
dc51ea3
Updated app root files
jdpigeon Jun 23, 2020
08178d6
updated routes
jdpigeon Jun 23, 2020
3efd627
added redux thunk back
jdpigeon Jun 25, 2020
914e9c4
Ran prettier
jdpigeon Jun 25, 2020
074a274
started adding ts and eslint rules
jdpigeon Jun 25, 2020
95b42b9
Started fixing things!
jdpigeon Jun 25, 2020
75cdb11
Object -> object
jdpigeon Jun 27, 2020
2ee02d0
updated constants to enum
peter7cole Jun 27, 2020
d51e9e0
Merge branch 'dano/boilerplate' of https://github.com/makebrainwaves/…
peter7cole Jun 27, 2020
09c14e3
Refactored Device Reducer to use toolkit
jdpigeon Jun 27, 2020
593ec0b
Updated experiment actions and reducer
jdpigeon Jul 11, 2020
ecd36ef
turned off default export rule
jdpigeon Jul 19, 2020
96adea6
Added typesafe actions
jdpigeon Jul 19, 2020
d338472
Finished experiment epics and refactored to use typesafe actions
jdpigeon Jul 19, 2020
29a312f
Updated jupyter redux tree
jdpigeon Jul 19, 2020
c4c43c0
updated await pipe
jdpigeon Jul 26, 2020
0277678
Post breaky changes with Teon
jdpigeon Jul 26, 2020
1fd968a
Some more changes
jdpigeon Jul 26, 2020
c3bdd7c
Merge branch 'master' of github.com:makebrainwaves/BrainWaves into da…
jdpigeon Jul 27, 2020
55897bd
Fixed a lot more errors
jdpigeon Jul 28, 2020
f0da762
Fixed a few more errors
jdpigeon Jul 28, 2020
b8e42d6
late night ASMR bug fixing
jdpigeon Jul 29, 2020
bc2f408
ASMR and error fixes
jdpigeon Jul 30, 2020
99e5ee0
work done on existing red errors only
peter7cole Jul 31, 2020
03b6082
Merge pull request #133 from makebrainwaves/peter
jdpigeon Aug 2, 2020
08c1047
fixed a few more errors
jdpigeon Aug 8, 2020
d38b042
Fixed last of the warnings
jdpigeon Aug 9, 2020
13bad5d
updated deps to match v.13 boilerplate
jdpigeon Aug 9, 2020
a55e19e
Removed some files from exclude tsconfig
jdpigeon Aug 9, 2020
5ab998c
updated internals and webpack configs
jdpigeon Aug 9, 2020
2eb02a7
updated app index and main
jdpigeon Aug 9, 2020
2b3485b
other minor updates
jdpigeon Aug 9, 2020
f8fb603
Fixed some build issues after upgrade and upgraded yarn lock
jdpigeon Aug 9, 2020
1229659
removed typescript-eslint rules
jdpigeon Aug 9, 2020
12c2fe2
Updated store
jdpigeon Aug 9, 2020
68d9191
Ran lint-fix
jdpigeon Aug 9, 2020
11d7eb2
Updated eslint and some configs
jdpigeon Aug 9, 2020
e83d424
Fixed errors with brittle file reading of previous experiments
jdpigeon Aug 14, 2020
f83cf40
Cleaning things up; Removing jspsych references; unmounted epics
jdpigeon Aug 14, 2020
56e5b47
Refactored ExperimentWindow
jdpigeon Aug 14, 2020
d3ef6d0
small left over changes
jdpigeon Aug 17, 2020
ea7e909
object -> Record<string,any>
jdpigeon Aug 17, 2020
7572f5e
fixed Redux
jdpigeon Aug 17, 2020
3567792
fixing last error
jdpigeon Aug 17, 2020
ff64c84
pinned react types version
jdpigeon Aug 17, 2020
fb77af6
HashHistory -> History
jdpigeon Aug 17, 2020
318bc7d
Removed some onerous ts rules
jdpigeon Aug 19, 2020
1e59a25
Fixing things
jdpigeon Aug 19, 2020
616bd6b
Fixed more errors; refactoring becoming clear
jdpigeon Aug 19, 2020
c02a780
Fixed all of the typescript errors while listening to mouth noises
jdpigeon Aug 20, 2020
994dcbf
Update app/utils/labjs/protocols/faceshouses.ts
jdpigeon Aug 21, 2020
e0ed7e6
Update .github/workflows/test.yml
jdpigeon Aug 21, 2020
8a3f56a
Addressed comments
jdpigeon Aug 21, 2020
5ad82f8
Merge branch 'dano/boilerplate' of https://github.com/makebrainwaves/…
jdpigeon Aug 21, 2020
814f486
fixed missing parenthesis in teons elegant faceshouse stimulus refactor
jdpigeon Aug 21, 2020
f5993cc
v0.14.0
jdpigeon Aug 21, 2020
99e1dbb
Massaged the import
jdpigeon Aug 21, 2020
35368fb
v0.14.1
jdpigeon Aug 21, 2020
961e165
Fixed out of bounds experiment window and broken start experiment button
jdpigeon Aug 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 71 additions & 69 deletions app/components/AnalyzeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
Button,
Checkbox,
Sidebar,
DropdownProps,
} from 'semantic-ui-react';
import { isNil } from 'lodash';
import { isNil, isArray, isString } from 'lodash';
import Plot from 'react-plotly.js';
import styles from './styles/common.css';
import {
Expand Down Expand Up @@ -50,64 +51,48 @@ const ANALYZE_STEPS_BEHAVIOR = {

interface Props {
title: string;
type: EXPERIMENTS | null | undefined;
type: EXPERIMENTS;
deviceType: DEVICES;
isEEGEnabled: boolean;
kernel: Kernel | null | undefined;
kernel: Kernel;
kernelStatus: KERNEL_STATUS;
mainChannel: any | null | undefined;
epochsInfo:
| Array<{
[key: string]: number | string;
}>
| null
| undefined;
channelInfo: Array<string> | null | undefined;
psdPlot:
| {
[key: string]: string;
}
| null
| undefined;
topoPlot:
| {
[key: string]: string;
}
| null
| undefined;
erpPlot:
| {
[key: string]: string;
}
| null
| undefined;
mainChannel: any;
epochsInfo: Array<{
[key: string]: number | string;
}>;

channelInfo: Array<string>;
psdPlot: {
[key: string]: string;
};

topoPlot: {
[key: string]: string;
};

erpPlot: {
[key: string]: string;
};

JupyterActions: typeof JupyterActions;
}

interface State {
activeStep: string;
selectedChannel: string;
eegFilePaths: Array<
| {
key: string;
text: string;
value: { name: string; dir: string };
}
| null
| undefined
>;
behaviorFilePaths: Array<
| {
key: string;
text: string;
value: string;
}
| null
| undefined
>;
selectedFilePaths: Array<string | null | undefined>;
selectedBehaviorFilePaths: Array<string | null | undefined>;
selectedSubjects: Array<string | null | undefined>;
eegFilePaths: Array<{
key: string;
text: string;
value: { name: string; dir: string };
}>;
behaviorFilePaths: Array<{
key: string;
text: string;
value: string;
}>;
selectedFilePaths: Array<string>;
selectedBehaviorFilePaths: Array<string>;
selectedSubjects: Array<string>;
selectedDependentVariable: string;
removeOutliers: boolean;
showDataPoints: boolean;
Expand All @@ -118,18 +103,15 @@ interface State {
dataToPlot: number[];
layout: Record<string, any>;
helpMode: string;
dependentVariables: Array<
| {
key: string;
text: string;
value: string;
}
| null
| undefined
>;
dependentVariables: Array<{
key: string;
text: string;
value: string;
}>;
}
// TODO: Add a channel callback from reading epochs so this screen can be aware of which channels are
// available in dataset
// TODO: Refactor component to DRY up handler functions
export default class Analyze extends Component<Props, State> {
constructor(props: Props) {
super(props);
Expand Down Expand Up @@ -212,12 +194,14 @@ export default class Analyze extends Component<Props, State> {
return subjects.reduce((acc, curr) => `${acc}-${curr}`);
};

handleDatasetChange(event: Record<string, any>, data: Record<string, any>) {
this.setState({
selectedFilePaths: data.value,
selectedSubjects: getSubjectNamesFromFiles(data.value),
});
this.props.JupyterActions.LoadCleanedEpochs(data.value);
handleDatasetChange(event: Record<string, any>, data: DropdownProps) {
if (isStringArray(data.value)) {
this.setState({
selectedFilePaths: data.value,
selectedSubjects: getSubjectNamesFromFiles(data.value),
});
this.props.JupyterActions.LoadCleanedEpochs(data.value);
}
}

handleBehaviorDatasetChange(
Expand Down Expand Up @@ -279,13 +263,17 @@ export default class Analyze extends Component<Props, State> {
}

handleRemoveOutliers(event: Record<string, any>, data: Record<string, any>) {
const { dataToPlot, layout } = aggregateDataForPlot(
const aggregatedData = aggregateDataForPlot(
readBehaviorData(this.state.selectedBehaviorFilePaths),
this.state.selectedDependentVariable,
!this.state.removeOutliers,
this.state.showDataPoints,
this.state.displayMode
);
if (!aggregatedData) {
return;
}
const { dataToPlot, layout } = aggregatedData;
this.setState({
removeOutliers: !this.state.removeOutliers,
dataToPlot,
Expand All @@ -295,13 +283,17 @@ export default class Analyze extends Component<Props, State> {
}

handleDataPoints(event: Record<string, any>, data: Record<string, any>) {
const { dataToPlot, layout } = aggregateDataForPlot(
const aggregatedData = aggregateDataForPlot(
readBehaviorData(this.state.selectedBehaviorFilePaths),
this.state.selectedDependentVariable,
this.state.removeOutliers,
!this.state.showDataPoints,
this.state.displayMode
);
if (!aggregatedData) {
return;
}
const { dataToPlot, layout } = aggregatedData;
this.setState({
showDataPoints: !this.state.showDataPoints,
dataToPlot,
Expand All @@ -314,13 +306,17 @@ export default class Analyze extends Component<Props, State> {
this.state.selectedBehaviorFilePaths &&
this.state.selectedBehaviorFilePaths.length > 0
) {
const { dataToPlot, layout } = aggregateDataForPlot(
const aggregatedData = aggregateDataForPlot(
readBehaviorData(this.state.selectedBehaviorFilePaths),
this.state.selectedDependentVariable,
this.state.removeOutliers,
this.state.showDataPoints,
displayMode
);
if (!aggregatedData) {
return;
}
const { dataToPlot, layout } = aggregatedData;
this.setState({
dataToPlot,
layout,
Expand Down Expand Up @@ -475,7 +471,9 @@ export default class Analyze extends Component<Props, State> {
selection
closeOnChange
value={this.state.selectedFilePaths}
options={this.state.eegFilePaths}
options={this.state.eegFilePaths.map(
(eegFilePath) => eegFilePath.value
)}
onChange={this.handleDatasetChange}
/>
{this.renderEpochLabels()}
Expand Down Expand Up @@ -659,3 +657,7 @@ export default class Analyze extends Component<Props, State> {
);
}
}

function isStringArray(data: any): data is string[] {
return isArray(data.value) && data.value.every(isString);
}
2 changes: 1 addition & 1 deletion app/components/CleanComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default class Clean extends Component<Props, State> {
<Button
primary
disabled={isNil(this.props.epochsInfo)}
onClick={this.props.JupyterActions.CleanEpochs()}
onClick={this.props.JupyterActions.CleanEpochs}
>
Clean Data
</Button>
Expand Down
6 changes: 3 additions & 3 deletions app/components/CollectComponent/ConnectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
SCREENS,
} from '../../constants/constants';
import styles from '../styles/collect.css';
import { SignalQualityData, PipesEpoch } from '../../constants/interfaces';
import { SignalQualityData } from '../../constants/interfaces';
import { DeviceActions } from '../../actions';

interface Props {
history: History;
open: boolean;
onClose: () => void;
connectedDevice: Record<string, any>;
signalQualityObservable?: Observable<PipesEpoch>;
signalQualityObservable?: Observable<SignalQualityData>;
deviceType: DEVICES;
deviceAvailability: DEVICE_AVAILABILITY;
connectionStatus: CONNECTION_STATUS;
Expand All @@ -27,7 +27,7 @@ interface Props {
}

interface State {
selectedDevice: any | null | undefined;
selectedDevice: any;
instructionProgress: INSTRUCTION_PROGRESS;
}

Expand Down
2 changes: 2 additions & 0 deletions app/components/CollectComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Observable } from 'rxjs';
import React, { Component } from 'react';
import { isNil } from 'lodash';
import { History } from 'history';
import {
EXPERIMENTS,
DEVICES,
Expand All @@ -11,6 +12,7 @@ import {
Trial,
ExperimentParameters,
SignalQualityData,
PipesEpoch,
} from '../../constants/interfaces';
import PreTestComponent from './PreTestComponent';
import ConnectModal from './ConnectModal';
Expand Down
47 changes: 31 additions & 16 deletions app/components/DesignComponent/CustomDesignComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Image,
Table,
} from 'semantic-ui-react';
import { isNil } from 'lodash';
import { isNil, isString } from 'lodash';
import { History } from 'history';

import styles from '../styles/common.css';
Expand Down Expand Up @@ -158,15 +158,18 @@ export default class CustomDesign extends Component<Props, State> {
label={FIELDS.QUESTION}
value={this.state.description.question}
placeholder="Explain your research question here."
onChange={(event, data) =>
onChange={(event, data) => {
if (!isString(data.value)) {
teonbrooks marked this conversation as resolved.
Show resolved Hide resolved
return;
}
this.setState({
description: {
...this.state.description,
question: data.value,
},
saved: false,
})
}
});
}}
/>
</Form>
</Grid.Column>
Expand All @@ -185,15 +188,18 @@ export default class CustomDesign extends Component<Props, State> {
label={FIELDS.HYPOTHESIS}
value={this.state.description.hypothesis}
placeholder="Describe your hypothesis here."
onChange={(event, data) =>
onChange={(event, data) => {
if (!isString(data.value)) {
return;
}
this.setState({
description: {
...this.state.description,
hypothesis: data.value,
},
saved: false,
})
}
});
}}
/>
</Form>
</Grid.Column>
Expand All @@ -212,15 +218,18 @@ export default class CustomDesign extends Component<Props, State> {
label={FIELDS.METHODS}
value={this.state.description.methods}
placeholder="Explain how you will design your experiment to answer the question here."
onChange={(event, data) =>
onChange={(event, data) => {
if (!isString(data.value)) {
return;
}
this.setState({
description: {
...this.state.description,
methods: data.value,
},
saved: false,
})
}
});
}}
/>
</Form>
</Grid.Column>
Expand Down Expand Up @@ -581,12 +590,15 @@ export default class CustomDesign extends Component<Props, State> {
autoHeight
value={this.state.params.intro}
placeholder="e.g., You will view a series of faces and houses. Press 1 when a face appears and 9 for a house. Press the the space bar on your keyboard to start doing the practice trials. If you want to skip the practice trials and go directly to the task, press the 'q' button on your keyboard."
onChange={(event, data) =>
onChange={(event, data) => {
if (!isString(data.value)) {
return;
}
this.setState({
params: { ...this.state.params, intro: data.value },
saved: false,
})
}
});
}}
/>
</Form>
</Segment>
Expand All @@ -608,12 +620,15 @@ export default class CustomDesign extends Component<Props, State> {
autoHeight
value={this.state.params.taskHelp}
placeholder="e.g., Press 1 for a face and 9 for a house"
onChange={(event, data) =>
onChange={(event, data) => {
if (!isString(data.value)) {
return;
}
this.setState({
params: { ...this.state.params, taskHelp: data.value },
saved: false,
})
}
});
}}
/>
</Form>
</Segment>
Expand Down
Loading