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

refactor getSupportedChartTypes() to clarify the rules by chartType #2359

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

siosonel
Copy link
Member

@siosonel siosonel commented Nov 8, 2024

Description

... instead of using procedural code. Closes #2229

Tested with TermdbTest only, other datasets will need to be migrated in sjpp repo. The chart buttons in localhost should match the ones in prp1 (11 charts).

Screenshot 2024-11-08 at 4 46 24 PM

Tested with http://localhost:3000/testrun.html?name=*.unit and cd client && npm run test:integration.

Checklist

Check each task that has been performed or verified to be not applicable.

  • Tests: added and/or passed unit and integration tests, or N/A
  • Todos: commented or documented, or N/A
  • Notable Changes: updated release.txt, prefixed a commit message with "fix:" or "feat:", added to an internal tracking document, or N/A

@siosonel siosonel requested review from airenzp, congyu-lu and xzhou82 and removed request for airenzp and congyu-lu November 8, 2024 22:47
supportedChartTypes[r.cohort].add('cuminc')
if (numericTypes.has(r.type)) numericTypeCount[r.cohort] += r.samplecount
}
const isSupportedChart = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a good design. it can be improved by removing profile charts. this should only define general chart types that can be determined by term type availability. profile charts and any other special purpose charts are only defined in their own ds.cohort.specialCharts[]. and will be added to supportedChartTypes as-is.

Copy link
Member Author

@siosonel siosonel Nov 9, 2024

Choose a reason for hiding this comment

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

So that would mean that any chartType that's listed in specialCharts, is not meant to be be listed in hiddenCharts, right? In other words, if it's listed in specialCharts, just ignore hiddenCharts for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

correct. special charts will simply be added and will not be explicitly coded here, this simplifies logic

Copy link
Collaborator

@airenzp airenzp Nov 9, 2024

Choose a reason for hiding this comment

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

Maybe we can have a method that does a switch with cases for the charts with more complex logic and a default behaviour, something like:


isSupported(chart)
{
switch(chart):
...

default:
return specialCharts.includes(chart) && !hiddenCharts.includes(chart)
}

@xzhou82 xzhou82 marked this pull request as draft November 11, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getSupportedChartTypes() should assess ds.cohort{addCharts{},hideCharts{}} and replace allowedChartTypes[]
3 participants