In this test, you are required to consume an API that returns a JSON data of COVID cases for countries and visualize part of it. The API endpoint is http://my-json-server.typicode.com/yisehak-awm/finbit-hiring/result The API returns an array of objects each representing data for a single country. Each object has the following structure
{
country: "China",
records: [
{
day: 1,
new: 23,
death: 5,
recovered: 14
},
{
day: 2,
new: 12,
death: 4,
recovered: 7
},
...
]
}
The records
is an array of daily reports of COVID cases for 30 days. Each object contains the daily number of new cases, deaths and recoveries.
- Fork this repository
- Clone your fork on your computer
- Switch to the
starter
branch - Create a new branch named
develop
. - You will see that we have already implemented a
LineChart
andPieChart
components in thecore
directory. You are not expected to make changes to those components. Simply import and use them in your code. Both chart components expect a singledata
property. The line chart takes an array of objects each having country name as ID and an array of points with day as fieldx
and number of new cases asy
.
[
{
"id": "China",
"data": [
{
"x": 1,
"y": 13
},
{
"x": 2,
"y": 9
},
...
]
The pie chart takes an array of 3 objects as following
[
{
"id": "new",
"label": "New Case",
"value": 43,
},
{
"id": "death",
"label": "Deaths",
"value": 26,
},
{
"id": "recovery",
"label": "Recoveries",
"value": 12,
}
You will prepare a form that lets the user filter the data by selecting countries and specifying start and end days. Make sure the form will work if more countries are added to the data.
The pie chart at the bottom shows data for the most affected county. The most affected country is defined as the one with the largest difference between total cases and recoveries within the defined duration.
- When you are done, send a pull request to the develop branch of this repository.
Good luck!