Skip to content

Commit

Permalink
Data sync, table structures for header data
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaiau committed Apr 11, 2020
1 parent 5d54479 commit 232c1f3
Show file tree
Hide file tree
Showing 8 changed files with 14,820 additions and 7,395 deletions.
4,693 changes: 3,850 additions & 843 deletions client/data/advanced.json

Large diffs are not rendered by default.

1,892 changes: 1,485 additions & 407 deletions client/data/countries.json

Large diffs are not rendered by default.

3,511 changes: 3,191 additions & 320 deletions client/data/cumulative.json

Large diffs are not rendered by default.

11,976 changes: 6,193 additions & 5,783 deletions client/data/nz-advanced.json

Large diffs are not rendered by default.

53 changes: 38 additions & 15 deletions client/src/components/advanced-country-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,43 @@ export default class AdvancedCountryPage extends React.Component{
<h2 className="is-size-3 title">{this.props.country_name}</h2>
<table className="subtitle">
<tbody>
<tr>
<td className="is-size-6" style={{paddingRight: '10px', textAlign: 'right'}}>Daily Change</td>
<td className="is-size-6" style={{paddingRight: '5px', textAlign: 'right'}}>Total</td>

</tr>
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(country.highest_confirmed)}</th>
<td className="is-size-4">Cases</td>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_confirmed - country.time_series[country.time_series.length - 2].confirmed)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_confirmed)}
</th>

<td className="is-size-6"style={{verticalAlign: 'middle'}}>Cases</td>
</tr>
{country.highest_deaths ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(country.highest_deaths)}</th>
<td className="is-size-4">Deaths</td>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths - country.time_series[country.time_series.length - 2].deaths)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths)}
</th>

<td className="is-size-6"style={{verticalAlign: 'middle'}}>Deaths</td>
</tr>
:<></> }
{country.highest_recovered ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(country.highest_recovered)}</th>
<td className="is-size-4">Recovered</td>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths - country.time_series[country.time_series.length - 2].deaths)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_recovered)}
</th>

<td className="is-size-6" style={{verticalAlign: 'middle'}}>Recovered</td>
</tr>
:<></> }
</tbody>
Expand All @@ -90,27 +113,27 @@ export default class AdvancedCountryPage extends React.Component{
<table>
<tbody>
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(latest.confirmed_per_mil.toFixed(0))}</th>
<td className="is-size-4">Cases per million</td>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>{this.tidyFormat(latest.confirmed_per_mil.toFixed(0))}</th>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Cases per million</td>
</tr>
{active_country.highest_deaths && active_country.highest_deaths > 1 ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(latest.deaths_per_mil.toFixed(0))}</th>
<td className="is-size-4">Deaths per million</td>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>{this.tidyFormat(latest.deaths_per_mil.toFixed(0))}</th>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Deaths per million</td>
</tr>
:<></> }
<tr >
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(((latest.recovered / latest.confirmed) * 100).toFixed(0))}%
</th>
<td className="is-size-4">Recovered</td>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Recovered</td>
</tr>
{active_country.highest_deaths && active_country.highest_deaths > 1 ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(((latest.deaths / latest.confirmed) * 100).toFixed(0))}%
</th>
<td className="is-size-4">Died</td>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Died</td>
</tr>
:<></> }
</tbody>
Expand All @@ -121,7 +144,7 @@ export default class AdvancedCountryPage extends React.Component{
</div>
<div className="columns">
<div className="column is-half">
<p className="is-size-7" style={{marginBottom: '10px'}}>
<p className="is-size-7">
Global data updated at <strong>{update_times.global}</strong>
</p>
{this.props.country_name == 'United States' ?
Expand Down
65 changes: 46 additions & 19 deletions client/src/components/country-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class CountryPage extends React.Component{
const active_country = SetupCountry({
country: countries.filter( (c) => c.name === this.state.selected_country )[0]
})

const country = active_country
const latest = active_country.time_series[active_country.time_series.length - 1]

return (<>
Expand All @@ -48,43 +48,70 @@ export default class CountryPage extends React.Component{
<table style={{marginBottom: '10px'}}>
<tbody>
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(active_country.highest_confirmed)}</th>
<td className="is-size-4">Cases</td>
<td className="is-size-6" style={{paddingRight: '10px', textAlign: 'right'}}>Daily Change</td>
<td className="is-size-6" style={{paddingRight: '5px', textAlign: 'right'}}>Total</td>
</tr>
{active_country.highest_deaths ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(active_country.highest_deaths)}</th>
<td className="is-size-4">Death{active_country.highest_deaths == 1 ? '' : 's'}</td>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_confirmed - country.time_series[country.time_series.length - 2].confirmed)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_confirmed)}
</th>

<td className="is-size-6"style={{verticalAlign: 'middle'}}>Cases</td>
</tr>
{country.highest_deaths ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths - country.time_series[country.time_series.length - 2].deaths)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths)}
</th>

<td className="is-size-6" style={{verticalAlign: 'middle'}}>Deaths</td>
</tr>
:<></> }
{active_country.highest_recovered ?
{country.highest_recovered ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(active_country.highest_recovered)}</th>
<td className="is-size-4">Recovered</td>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_deaths - country.time_series[country.time_series.length - 2].deaths)}
</th>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(country.highest_recovered)}
</th>

<td className="is-size-6" style={{verticalAlign: 'middle'}}>Recovered</td>
</tr>
:<></> }
</tbody>
</table>
<table>

<tbody>
<tr >
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right', paddingTop: '15px'}}>{this.tidyFormat(latest.confirmed_per_mil.toFixed(0))}</th>
<td className="is-size-4" style={{paddingTop: '15px'}}>Cases per million</td>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right', paddingTop: '15px'}}>{this.tidyFormat(latest.confirmed_per_mil.toFixed(0))}</th>
<td className="is-size-6" style={{paddingTop: '15px', verticalAlign: 'middle'}}>Cases per million</td>
</tr>
{active_country.highest_deaths && active_country.highest_deaths > 1 ?
{active_country.highest_deaths && active_country.highest_deaths > 10 ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>{this.tidyFormat(latest.deaths_per_mil.toFixed(1))}</th>
<td className="is-size-4">Deaths per million</td>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>{this.tidyFormat(latest.deaths_per_mil.toFixed(1))}</th>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Deaths per million</td>
</tr>
:<></> }
<tr >
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right', paddingTop: active_country.highest_deaths > 1 ? '15px': 0}}>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(((latest.recovered / latest.confirmed) * 100).toFixed(0))}%
</th>
<td className="is-size-4" style={{paddingTop: active_country.highest_deaths > 1 ? '15px': 0}}>Recovered</td>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Recovered</td>
</tr>
{active_country.highest_deaths && active_country.highest_deaths > 1 ?
{active_country.highest_deaths && active_country.highest_deaths > 10 ?
<tr>
<th className="is-size-4" style={{paddingRight: '10px', textAlign: 'right'}}>
<th className="is-size-4" style={{paddingRight: '5px', textAlign: 'right'}}>
{this.tidyFormat(((latest.deaths / latest.confirmed) * 100).toFixed(1))}%
</th>
<td className="is-size-4">Died</td>
<td className="is-size-6" style={{verticalAlign: 'middle'}}>Died</td>
</tr>
:<></> }
</tbody>
Expand Down
8 changes: 4 additions & 4 deletions client/src/context/GlobalContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ const GlobalContextProvider = ({ children }) => {
500: deaths.map((node) => mapFn( node, 'deaths', 4)),
},
update_times:{
global: "1:20am 10 April UTC",
us: "4:00pm 9 April ET",
nz: "1:20pm 10 April NZT",
nz_regional: "3:00pm 10 April NZT",
global: "12:00am 11 April UTC",
us: "4:00pm 10 April ET",
nz: "1:00pm 11 April NZT",
nz_regional: "2:10pm 11 April NZT",
}
});

Expand Down
17 changes: 13 additions & 4 deletions processing/data/new-zealand.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,21 @@
"deaths_per_mil": 0.40937468,
"tests": 55685,
"recovered": 373
},
{
"date": "2020-04-10T00:00:00.000Z",
"confirmed": 1312,
"confirmed_per_mil": 53.628083103,
"deaths": 4,
"deaths_per_mil": 0.81874936,
"tests": 58746,
"recovered": 422
}

],
"highest_confirmed": 1283,
"highest_deaths": 2,
"highest_tests": 55685,
"highest_recovered": 373,
"highest_confirmed": 1312,
"highest_deaths": 4,
"highest_tests": 58746,
"highest_recovered": 422,
"population": 4885500
}

0 comments on commit 232c1f3

Please sign in to comment.