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

sort coutries alphabetically on case page #317

Conversation

umaxyon
Copy link

@umaxyon umaxyon commented Jun 15, 2022

issue #315

image

@vercel
Copy link

vercel bot commented Jun 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
covariants ✅ Ready (Inspect) Visit Preview Jun 15, 2022 at 4:42AM (UTC)

@emmahodcroft
Copy link
Collaborator

Hi @umaxyon - thanks for this! However, the current way that countries are sorted is based on the number of sequences, which provides a nice top-to-bottom gradient of (generally) how confident we can be in the patterns we see. I would be happy to have an option to change this sorting to alphabetical, but it should be a button or slider on the web-page that allows this view to change depending on what the user wants to see (either by sequence count or alphabetically).
I'd be happy to integrate something like this, if that's something you're able to do!

@umaxyon
Copy link
Author

umaxyon commented Jun 15, 2022

Hi @emmahodcroft 😃
I gave up because I did not know the original sort order criteria.
It is neither the number of "distribution" arrays nor the sum of "total_sequences", but a subtle difference.

USA            :	 distribution size: 55:	sum totla_sequence: 3168562
United Kingdom :	 distribution size: 55:	sum totla_sequence: 2637606
Germany        :	 distribution size: 54:	sum totla_sequence: 632128
Denmark        :	 distribution size: 55:	sum totla_sequence: 509391
France         :	 distribution size: 55:	sum totla_sequence: 285611
Canada         :	 distribution size: 55:	sum totla_sequence: 316619  <-- ? 
Japan          :	 distribution size: 55:	sum totla_sequence: 298010
Sweden         :	 distribution size: 54:	sum totla_sequence: 186642
Switzerland    :	 distribution size: 55:	sum totla_sequence: 129169
...

I used the following debugging code

// CasesPage.tsx  line 41
  withClustersFiltered.forEach(d => {
    const total = d.distribution.map(d => d.total_sequences).reduce((a, b) => a + b, 0);
    console.log(`${d.country.padEnd(15, ' ')}:\t distribution size: ${d.distribution.length}:\tsum totla_sequence: ${total}`)
  });

sorry. good luck!

@umaxyon umaxyon closed this Jun 15, 2022
@umaxyon umaxyon deleted the issue315/sort_coutries_alphabetically_on_cases_page branch June 15, 2022 10:26
@emmahodcroft
Copy link
Collaborator

Hmm, that's interesting. I'll have to double-check how this is calculated. In fairness, I think I may 'steal' the order from the Per Country page, and it's possible that if we don't have case data to match the same time periods, some sequences are 'excluded' and thus the counts don't technically match. But I'll try to look into this!

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.

2 participants