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

Add Categorical Bar Chart on Study View #4951

Closed
Closed
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
custom-selection-added (#5064)
- in custom selection text box take inputs with commas, space or new line or all combined also
- add an example placeholder
anshuman-rai-27 authored and olzhasmukayev committed Jan 16, 2025
commit ff464471762ef007ed51656cb24b676760df6851
Original file line number Diff line number Diff line change
@@ -158,7 +158,15 @@ export default class CustomCaseSelection extends React.Component<

@action.bound
onChange(newContent: string) {
this.validContent = newContent;
// Preprocess content to allow spaces, tabs, and commas as valid delimiters
const normalizedContent = newContent
.split(/[, ]+/) // Split the content by either commas or spaces
.map(line => line.trim()) // Remove extra spaces around each line
.filter(line => line.length > 0) // Remove empty lines
.join('\n'); // Use newline as the final delimiter

// Assign normalized content and trigger validation
this.validContent = normalizedContent;
this.validateContent = true;
}

@@ -207,11 +215,26 @@ export default class CustomCaseSelection extends React.Component<
this.caseIdsMode === ClinicalDataTypeEnum.SAMPLE
? 'sample_id'
: 'patient_id';
return `Example:\nstudy_id:${caseIdentifier}1${

// Creating example strings for each delimiter type
const newLineExample = `study_id:${caseIdentifier}1${
this.props.disableGrouping ? '' : ' value1'
}\nstudy_id:${caseIdentifier}2${
this.props.disableGrouping ? '' : ' value2'
}`;
const commaExample = `study_id:${caseIdentifier}1${
this.props.disableGrouping ? '' : ' value1'
}, study_id:${caseIdentifier}2${
this.props.disableGrouping ? '' : ' value2'
}`;
const spaceExample = `study_id:${caseIdentifier}1${
this.props.disableGrouping ? '' : ' value1'
} study_id:${caseIdentifier}2${
this.props.disableGrouping ? '' : ' value2'
}`;

// Combining all three cases into one string
return `Example with newline:\n${newLineExample}\n\nExample with comma:\n${commaExample}\n\nExample with space:\n${spaceExample}`;
}

@computed