Skip to content

Commit

Permalink
Merge pull request #671 from neuroscout/590_540_fix_subject_filter
Browse files Browse the repository at this point in the history
Add  ReplaceNA to scale xform, fix unselect all predictors error.
  • Loading branch information
adelavega committed Oct 9, 2019
2 parents 33b8449 + 2134b24 commit df763f6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions neuroscout/frontend/src/analysis_builder/Builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ export default class AnalysisBuilder extends Reflux.Component<any, BuilderProps
if (data === null) {
return;
}

// If there is a statusCode we do not have a list of predictors
if ((data as any).statusCode === undefined) {
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class ParameterField extends React.Component<ParameterFieldProps> {
</div>
</Row>
)}
{name === 'replace_na' && this.ReplaceNAField()}
{name === 'ReplaceNA' && this.ReplaceNAField()}
</span>
);
}
Expand Down
3 changes: 2 additions & 1 deletion neuroscout/frontend/src/analysis_builder/transforms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transformation } from '../coretypes';
import { Transformation, ReplaceNA } from '../coretypes';

// Todo: Add more transformations, from pybids
// At first, only allow transformations that occur in place
Expand All @@ -13,6 +13,7 @@ const transformDefinitions: Transformation[] = [
Name: 'Scale',
Demean: true,
Rescale: true,
ReplaceNA: 'None' as ReplaceNA
},
{
Name: 'Orthogonalize',
Expand Down
7 changes: 6 additions & 1 deletion neuroscout/frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export const api = {
},

getPredictors: (ids: (number[] | string[])): Promise<Predictor[] | null> => {
return jwtFetch(`${domainRoot}/api/predictors?run_id=${ids}`);
return jwtFetch(`${domainRoot}/api/predictors?run_id=${ids}`).then((data) => {
if (data.statusCode && data.statusCode === 422) {
return [] as Predictor[];
}
return data;
});
},

getDataset: (datasetId: (number | string)): Promise<(Dataset | null)> => {
Expand Down
2 changes: 1 addition & 1 deletion neuroscout/frontend/src/coretypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export type ReplaceNA = 'before' | 'after' | undefined;

export interface Transformation {
Name: TransformName;
ReplaceNa?: ReplaceNA;
ReplaceNA?: ReplaceNA;
Input?: string[]; // predictor IDs
Output?: string[];
Demean?: boolean;
Expand Down

0 comments on commit df763f6

Please sign in to comment.