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

Website Centric Stats Page #475

Merged
merged 17 commits into from Nov 25, 2020
Merged

Website Centric Stats Page #475

merged 17 commits into from Nov 25, 2020

Conversation

sarathms
Copy link
Contributor

@sarathms sarathms commented Jul 17, 2020

Fixes #474

TODO

  • Improve the logic for calculating percentages for each country
  • Add a content loader for the Global data
  • Add a title or lead text to the country specific page
  • [ ] Use swr's timeout features to update page when query times out (not that important for this issue)

Screenshot from 2020-07-17 06-37-15
Screenshot from 2020-07-17 06-34-54

@sarathms
Copy link
Contributor Author

sarathms commented Aug 27, 2020

@hellais Can you help me understand how to calculate the percentages for each country? This is how I am doing it right now, which I realized is not what you may have intended. Nor does it seem like a sound way to compare the countries.

We also need some content/text before the country specific charts (2nd screenshot). To help the rebuild the context for you, here's what data is available on this page:

  • Country Code / Name
  • Website
  • Date Range

And then of course the data we receive from the aggregation API.

Comment on lines 35 to 56
let outcome = {
color: colorNormal,
subtext: 'not blocked',
percent: Number(ok_count / measurement_count * 100).toFixed(0),
icon: <MdCheckCircle size={ICON_SIZE} />
}

if (anomaly_count > ok_count) {
outcome = {
color: colorAnomaly,
subtext: 'high anomaly count',
percent: Number(anomaly_count / measurement_count * 100).toFixed(0),
icon: <FaExclamationCircle size={ICON_SIZE} />
}
}

if (confirmed_count > ok_count) {
outcome = {
color: colorConfirmed,
subtext: 'confirmed blocked',
percent: Number(confirmed_count / measurement_count * 100).toFixed(0),
icon: <IoCloseCircled size={ICON_SIZE} />
}
}
Copy link
Member

Choose a reason for hiding this comment

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

The percentage for a country should be:

Total of anomalous measurement (anomaly_count + confirmed_count) / total_measurement_count

We should display in the list first countries which have a confirmed count that is non-zero, then it should be sorted by the the percentages.

It would be useful to have input from @FedericoCeratto on this as well.

@hellais
Copy link
Member

hellais commented Sep 1, 2020

@sarathms

Can you help me understand how to calculate the percentages for each country?

I replied in an inline comment:
https://github.com/ooni/explorer/pull/475/files#r480950127

I am also not very convinced by this approach, but I don't have much time to think about a better way. Input from @FedericoCeratto would also help, but we are a bit swamped at the moment.

Let's address the low hanging fruit first (implement the algorythm I suggested) and document as next steps to improve it based on future iterations.

We also need some content/text before the country specific charts (2nd screenshot).

Yes I agree. What is your question?

Copy link
Member

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

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

We should have a chat later today about this code. I think I need some guidance to think about it in a more structured way, as my JavaScript knowledge is slowly improving. 📚

@sarathms
Copy link
Contributor Author

Rebased this branch over latest master. Merging it based on discussion with @hellais. We will collect feedback on how to make this page more useful and continue developing it based on what we find.

@sarathms sarathms merged commit 131c810 into master Nov 25, 2020
@sarathms sarathms deleted the aggregation-api-sample branch November 25, 2020 20:09
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.

Implement website centric mockups for country listing & website graph
3 participants