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

Annotation visualisation #1121

Conversation

aishikanandi
Copy link

This is the first draft of the visualisation component for OncoKB annotations.

To do:

  • Tabs for annotation type
  • Publish OncoKB reused components to decrease the package size
  • Dropdown for columns

zhx828 and others added 2 commits May 24, 2024 15:39
* Update to API access request feature

- Do not auto approve when academic user requested API access
- Include justification in slack channel
- Show API Access Justification in User page
- Allow admin to change API access justification in User page

* update screenshot tests
selectedAnnotationColumns: string[];
selectedTreatmentColumns: string[];
}
export class AnnotationVisualisation extends React.Component<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this a function component. So just export function AnnotationVisualisation() { ... }

'selectedTreatmentColumns'
);

if (savedAnnotationColumns && savedTreatmentColumns) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can only one of them be set? What happens in that case?

return filteredColumns.map(column => ({
...getDefaultColumnDefinition(
column.key,
1200 / this.state.selectedAnnotationColumns.length
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't just make every column have an even portion of the table width. Also you assume the table width is always 1200 I imagine. What about on changing screen sizes?

);
};

export function getDefaultColumnDefinition<T>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using template parameter

);
};

handleTreatmentColumnsChange = (selectedOptions: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the type instead of any?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment applies above as well and in most places you see any unless there is a good reason to use it

);
const totalColumns = selectedKeys.length;
const calculatedWidth = hasAnnotation
? 800 / (totalColumns - 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'd be careful with these hardcoded widths. See my other comment for details.

render() {
return (
<>
{this.props.isPatientInfoVisible && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like patientId and patientInfo are only used when isPatientInfoVisible === true. However, the first two props I mentioned are not optional. I would prefer to have these bundled into an optional object like the following:

patientInfo?: {
    id: string
    info: string
}

id and info could also be optional.

</div>
</div>
)}
<Tabs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why you didn't use the Tabs component we already had?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants