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

chore: Change data source to API repo #878

Merged
merged 2 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public

# Data API build directory
_data
_api

# Storybook build
storybook-static
Expand Down
4 changes: 2 additions & 2 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ const gatsbyConfig = {
{
resolve: 'gatsby-source-covid-tracking-api',
options: {
file: './src/data/race/race-ethnicity-combined.json',
file: './_api/v1/race/states-combined.json',
type: 'CovidRaceDataCombined',
},
},
{
resolve: 'gatsby-source-covid-tracking-api',
options: {
file: './src/data/race/race-ethnicity-separate.json',
file: './_api/v1/race/states-separate.json',
type: 'CovidRaceDataSeparate',
},
},
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
"set-tz": "^0.2.0"
},
"scripts": {
"build": "run-s build:fetch build:gatsby build:data build:data-archive build:test",
"build-preview": "run-s setup:api-data build:gatsby build:data build:data-archive build:test",
"build": "run-s build:fetch setup:api-repo build:gatsby build:data build:data-archive build:test",
"build-preview": "run-s setup:api-data setup:api-repo build:gatsby build:data build:data-archive build:test",
"build:fetch": "node build/index.js",
"build:gatsby": "gatsby build",
"build:data": "cp -R _data/* public/api/",
Expand All @@ -151,6 +151,7 @@
"test:api-post-build": "jest --config=\"{}\" --testPathPattern=./build/__tests__/post-build/",
"setup": "run-s setup:api-data setup:env-vars",
kevee marked this conversation as resolved.
Show resolved Hide resolved
"setup:api-data": "curl https://covidtracking.com/api/archive.tar.gz | tar -xz",
"setup:env-vars": "curl -L https://covidtracking.com/__developer/env-vars > .env"
"setup:env-vars": "curl -L https://covidtracking.com/__developer/env-vars > .env",
"setup:api-repo": "git clone --depth 1 https://github.com/COVID19Tracking/covid-public-api.git _api"
}
}
209 changes: 77 additions & 132 deletions src/components/pages/race/dashboard/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,34 @@ import statesStyle from './states.module.scss'
export default () => {
const data = useStaticQuery(graphql`
query {
allCovidRaceDataCombined(sort: { fields: name }) {
allCovidRaceDataCombined(sort: { fields: stateName }) {
nodes {
id
aianANHPINotes
aianDeaths
aianDeathNotes
aianDeathDispFlag
aianDeathCaution
asianDeathNotes
asianDeathDispFlag
asianDeathCaution
asianANHPINotes
aianPositives
aianPosNotes
aianPosDispFlag
aianPosCaution
aianPctPos
aianPctPop
aianPctDeath
blackPositives
blackPosNotes
blackPosDispFlag
blackPosCaution
blackPctPos
blackPctPop
blackPctDeath
blackDeaths
blackDeathNotes
blackDeathDispFlag
blackDeathCaution
blackANHPINotes
asianPositives
asianPosNotes
asianPosDispFlag
asianPosCaution
asianPctPos
asianPctPop
asianPctDeath
asianDeaths
knownRaceEthDeath
knownRaceEthPos
latinXANHPINotes
latinXDeathCaution
latinXDeathDispFlag
latinXDeathNotes
latinXPositives
latinXPosNotes
latinXPosDispFlag
latinXPosCaution
latinXPctPos
latinXPctPop
latinXPctDeath
latinXDeaths
name: stateName
state
whitePositives
whitePosDispFlag
whitePosCaution
whitePctPos
whitePctPop
whitePctDeath
whiteDeaths
whiteDeathDispFlag
whiteDeathCaution
unknownRaceEthPos
unknownRaceEthDeath
twoPositives
twoPosNotes
twoPosDispFlag
twoPosCaution
twoPctPos
twoPctPop
twoPctDeath
twoDeaths
twoDeathNotes
twoDeathDispFlag
twoDeathCaution
stateName
state
otherPositives
otherPosNotes
Expand All @@ -73,7 +48,6 @@ export default () => {
otherDeathNotes
otherDeathDispFlag
otherDeathCaution
otherANHPINotes
nhpiPositives
nhpiPosNotes
nhpiPosDispFlag
Expand All @@ -86,61 +60,72 @@ export default () => {
nhpiDeathDispFlag
nhpiDeathCaution
nhpiANHPINotes
whitePositives
whitePosNotes
whitePosDispFlag
whitePosCaution
whitePctPos
whitePctPop
whitePctDeath
whiteDeaths
whiteDeathNotes
whiteDeathDispFlag
whiteDeathCaution
whiteANHPINotes
unknownRaceEthPos
unknownRaceEthDeath
twoPositives
twoPosNotes
twoPosDispFlag
twoPosCaution
twoPctPos
twoPctPop
twoPctDeath
twoDeaths
twoDeathNotes
twoDeathDispFlag
twoDeathCaution
twoANHPINotes
name
latinXPositives
latinXPosDispFlag
latinXPosCaution
latinXPctPos
latinXPctPop
latinXPctDeath
latinXDeaths
latinXDeathDispFlag
latinXDeathCaution
knownRaceEthPos
knownRaceEthDeath
blackPositives
blackPosDispFlag
blackPosCaution
blackPctPos
blackPctPop
blackPctDeath
blackDeaths
blackDeathDispFlag
blackDeathCaution
asianPositives
asianPosNotes
asianPosDispFlag
asianPosCaution
asianPctPos
asianPctPop
asianPctDeath
asianDeaths
asianDeathNotes
asianDeathDispFlag
asianDeathCaution
asianANHPINotes
aianPositives
aianPosNotes
aianPosDispFlag
aianPosCaution
aianPctPos
aianPctPop
aianPctDeath
aianDeaths
aianDeathNotes
aianDeathDispFlag
aianDeathCaution
}
}
allCovidRaceDataSeparate(sort: { fields: name }) {
allCovidRaceDataSeparate(sort: { fields: stateName }) {
nodes {
name
whitePosNotes
id
state
name: stateName
whitePositives
whiteSpecialCaseNotes
whitePosDispFlag
whitePosCaution
whitePctPos
whitePctPop
whitePctDeath
whiteDeaths
whiteDeathNotes
whiteDeathDispFlag
whiteDeathCaution
whiteANHPIPosNotes
whiteANHPIDeathNotes
unknownRacePos
unknownRaceEthDeath
unknownRaceDeath
unknownEthPos
unknownEthDeath
twoSpecialCaseNotes
twoPositives
twoPosDispFlag
twoPosNotes
twoPosDispFlag
twoPosCaution
twoPctPos
twoPctPop
Expand All @@ -149,10 +134,6 @@ export default () => {
twoDeathNotes
twoDeathDispFlag
twoDeathCaution
twoANHPIPosNotes
twoANHPIDeathNotes
state
otherSpecialCaseNotes
otherPositives
otherPosNotes
otherPosDispFlag
Expand All @@ -164,83 +145,50 @@ export default () => {
otherDeathNotes
otherDeathDispFlag
otherDeathCaution
otherANHPIPosNotes
otherANHPIDeathNotes
nonhispanicSpecialCaseNotes
nonhispanicPositives
nonhispanicPosNotes
nonhispanicPosDispFlag
nonhispanicPosCaution
nonhispanicPctPos
nonhispanicPctPop
nonhispanicPctDeath
nonhispanicDeaths
nonhispanicDeathNotes
nonhispanicDeathDispFlag
nonhispanicDeathCaution
nonhispanicANHPIPosNotes
nonhispanicANHPIDeathNotes
nhpiSpecialCaseNotes
nhpiPositives
nhpiPosNotes
nhpiPosDispFlag
nhpiPosCaution
nhpiPctPop
nhpiPctPos
nhpiPctPop
nhpiPctDeath
nhpiDeaths
nhpiDeathNotes
nhpiDeathDispFlag
nhpiDeathCaution
nhpiANHPIDeathNotes
nhpiANHPIPosNotes
latinXSpecialCaseNotes
nhpiANHPIDeathNotes
latinXPositives
latinXPosNotes
latinXPosDispFlag
latinXPosCaution
latinXPctPos
latinXPctPop
latinXPctDeath
latinXDeaths
latinXDeathNotes
latinXDeathDispFlag
latinXDeathCaution
latinXANHPIPosNotes
latinXANHPIDeathNotes
knownRacePos
knownRaceDeath
knownEthPos
knownEthDeath
blackSpecialCaseNotes__1
id
blackSpecialCaseNotes
blackPositives__1
blackPositives
blackPosNotes__1
blackPosNotes
blackPosDispFlag__1
blackPosDispFlag
blackPosCaution__1
blackPosCaution
blackPctPos__1
blackPctPos
blackPctPop__1
blackPctPop
blackPctDeath__1
blackPctDeath
blackDeaths__1
blackDeaths
blackDeathNotes__1
blackDeathNotes
blackDeathDispFlag__1
blackDeathDispFlag
blackDeathCaution__1
blackDeathCaution
blackANHPIPosNotes__1
blackANHPIPosNotes
blackANHPIDeathNotes__1
blackANHPIDeathNotes
asianSpecialCaseNotes
asianPositives
asianPosNotes
asianPosDispFlag
Expand All @@ -254,7 +202,6 @@ export default () => {
asianDeathCaution
asianANHPIPosNotes
asianANHPIDeathNotes
aianSpecialCaseNotes
aianPositives
aianPosNotes
aianPosDispFlag
Expand All @@ -266,8 +213,6 @@ export default () => {
aianDeathNotes
aianDeathDispFlag
aianDeathCaution
aianANHPIPosNotes
aianANHPIDeathNotes
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/race/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export const query = graphql`
}
allCovidRaceDataSeparate {
nodes {
name
name: stateName
state
}
}
allCovidRaceDataCombined {
nodes {
name
name: stateName
state
}
}
Expand Down