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
Conversation
@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:
And then of course the data we receive from the aggregation API. |
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} /> | ||
} | ||
} |
There was a problem hiding this comment.
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.
I replied in an inline comment: 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.
Yes I agree. What is your question? |
3a2086c
to
c037cad
Compare
There was a problem hiding this 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. 📚
1af1023
to
a1736ae
Compare
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. |
Fixes #474
TODO
[ ] Use(not that important for this issue)swr
's timeout features to update page when query times out