GithubHelp home page GithubHelp logo

knjk04 / covid-19-dashboard-legacy Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 2.0 3.21 MB

Web app that displays COVID-19 data and comparisons in an easy-to-read format

Home Page: https://covid19.karankumar.com/

License: GNU General Public License v3.0

CSS 1.19% Java 97.01% JavaScript 1.71% Procfile 0.09%
covid-19 vaadin

covid-19-dashboard-legacy's Introduction

Hello!

Interests:

  • AI safety (alignment)
  • Machine learning & deep learning
  • Science
  • Maths

I was the original author and current maintainer of the Book Project and the Books API.

covid-19-dashboard-legacy's People

Contributors

dependabot[bot] avatar knjk04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

covid-19-dashboard-legacy's Issues

Fix JSON exception

Sometimes, the following JSON exception is thrown:

Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
	at org.json.JSONTokener.syntaxError(JSONTokener.java:507) ~[json-20200518.jar:na]
	at org.json.JSONObject.<init>(JSONObject.java:222) ~[json-20200518.jar:na]
	at org.json.JSONObject.<init>(JSONObject.java:406) ~[json-20200518.jar:na]
	at com.karankumar.covid19stats.backend.GlobalStats.fetchSummary(GlobalStats.java:38) ~[classes/:na]
	at com.karankumar.covid19stats.backend.GlobalStats.<init>(GlobalStats.java:24) ~[classes/:na]
	at com.karankumar.covid19stats.ui.views.global.GlobalView.<init>(GlobalView.java:31) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:200) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	... 74 common frames omitted

The culprit:

JSONObject jsonObject = new JSONObject(data);

I have tried to print out the data (a String) before passing it into the JSONObject constructor, but it did not print before the exception was thrown.

File: GlobalStats.java

Branch: master and ui (and possibly fetch-json)

Allow multiple accordion items to be open

Is your feature request related to a problem? Please describe.
It may frustrate some if only one Accordion item can be open at any one given time.

Describe the solution you'd like
Allow multiple accordion items to be open at any given time.

Additional context
image

In the screenshot above, only one accordion item is open. If I open another accordion item, the top item (currently open item) will close.

Cache fetched API data

Is your feature request related to a problem? Please describe.
The API allows 5 requests per day and around 30 overall.

Describe the solution you'd like
Cache the data to prevent going over the number of requests.

Show 'other' countries in global pie charts

  • Show pie slices for other countries in both pie charts

  • Change the pie chart titles

    • Instead of 'Top 5 countries with the most cases', the title should be 'Total confirmed cases'

    • Similarly, instead of 'Top 5 countries with the most deaths', the title on the right pie chart should be 'Total deaths'

Centre tabs in nav bar

The tabs should appear in the centre of the NavBar. Currently, they are on the left of the NavBar (see below).

image

Optimise for mobile

Is your feature request related to a problem? Please describe.
The pie charts in particular are too small on mobile.

Describe the solution you'd like
Show one pie chart per row, perhaps, on mobile.

Additional context

  • Tested on an iPhone 11 Pro Max

  • 500 x 768 px (small tablet, Polypane):
    covid19 karankumar com Small Tablet 2020-06-20 06 20 50

  • 320 x 568 px (mobile, Polypane):
    image

Graph of previously chosen country not removed

After selecting a country, the number of confirmed cases is shown. If another country is then selected from the list, the graph corresponding to number of cases for the first country should be deleted, but is not (see the image below).

image

Show number of cases tooltip

On the number of confirmed cases, show a tooltip over every data point that shows the number of cases at that data point.

Add Lombok

Add Lombok to reduce boilerplate code

Search global grid

Describe the solution you'd like
Add a search box to allow users to search for a specific country to filter by.

Describe alternatives you've considered
A dropdown list (ComboBox).

Add a global stats pie chart

Describe the solution you'd like
Add a pie chart to show how the number of cases and deaths (as two separate pie charts) are spread across the top 5 countries with the most cases or deaths.

Cache the summary data

Cache the summary data to avoid having to send another request later.

This would require the cache value to be of type JSONObject, for instance, instead of Integer.

Wrong tab is marked as current

Describe the bug

The tab highlighted as the current tab is not always the page that you are. In this case, the highlighted tab is the 'global' tab, but the country page is shown.

To Reproduce
Steps to reproduce the behaviour:

  1. Run the program
  2. Go to http://localhost:8080/country
  3. See error

Expected behaviour

A clear and concise description of what you expected to happen.

Screenshots

image

Additional context

This goes away if you switch tabs to the country tab, the global tab and then back to the country. This appears to only happen when the program first runs, which may suggest that is a mapping problem.

Extend TreeMap in a FixedSizeTreeMap

  • Refactor SummaryStats.java to use this new FixedSizeSortedMap
  • Fixed size of 5 elements

Possible implementation ideas:

  • Extend TreeMap
  • Implement the SortedMap interface

Fix route mapping

Problem:

Fix the route mapping and links.

Expected behaviour:

When a user presses the 'global' button in the menu, they should be redirected to the global endpoint.

Similarly, when a user presses the 'global' button in the menu, they should be redirected to the global endpoint.

Actual behaviour:
The endpoint does not change (see image).

image

Swap chart order

Someone provided the following the feedback:
The two pie charts seem to be in the wrong order. At the top, the leftmost live count is the total number of deaths, and the rightmost live count is the total number of confirmed cases. It would make more sense to have the order of the pie charts to also follow this order: the number of deaths on the left and the number of confirmed cases on the right.

image

Add grouping separator for the grid values

Is your feature request related to a problem? Please describe.
It can be confusing to look at a large number without any separators.

Describe the solution you'd like
Commas to delimit thousandths. For instance, 1,000,000 to represent 1 million, instead of 1000000.

Wrong values shown

Describe the bug

image

There are dips in the number of total deaths.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to the 'country' page
  2. Open 'Compare total COVID-19 deaths'
  3. Search for the 'United Kingdom'
  4. See error

Expected behaviour

The number of total deaths should only ever rise (unless there was an issue with the counting).

Show country names as lowercase

This is how the country names are currently displayed:

image

A country name should not be entirely in uppercase. The top result, for example, should be displayed as 'Afghanistan', not 'AFGHANISTAN'.

ComboBox not wide enough

Describe the bug

The country ComboBox (dropdown list) is no longer wide enough to show the full country's name.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to the country tab
  2. Select 'French Southern Territories'
  3. See error

Expected behaviour

The ComboBox's width should be width enough for even the longest country's name in its list.

Screenshots

image

Additional context

The ComboBox was previously wide enough, but since it was added to a HorizontalLayout (along with the new reset button), invoking setMinWidth() on it appears to have no effect.

JSON exception: Global page not working

Describe the bug

Global page no longer works, but the country summary page and the feedback page still works.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to https://covid19.karankumar.com
  2. See error

Expected behaviour

The app no longer works. This is what I get when I head to https://covid19.karankumar.com.

Screenshots

image

Additional context

  • Add a unit test to check whether the app still compiles
  • Have the unit tests run daily so that we can be notified of issues without having to check them manually.

Show deaths and cases on one graph

Describe the solution you'd like
Show the number of cases and number of deaths for one country on one graph. The graph should not allow comparisosn with other countries (i.e., the graph should reset every time a new country is selected).

Sensible column order

image

Column order should be (from left to right):

  • Country name
  • Total confirmed cases
  • Total deaths
  • Total recovered
  • New confirmed cases
  • New deaths
  • New recovered

The current order is not as well structured as the above recommended order

Add a grid for stats for every country

Describe the solution you'd like
Add a grid on the global page showing a breakdown of the stats (deaths, cases, recovered, etc.) for every country.

Describe alternatives you've considered
Only showing the stats for a country on the country page, but different stats could be shown there (e.g. the number of deaths over time, etc.).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.