Add basic risk by age dashboard.
This commit is contained in:
		
							
								
								
									
										6
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -9,6 +9,7 @@ declare module 'vue' {
 | 
				
			|||||||
    ChipsCases: typeof import('./src/components/charts/overall/cases/ChipsCases.vue')['default']
 | 
					    ChipsCases: typeof import('./src/components/charts/overall/cases/ChipsCases.vue')['default']
 | 
				
			||||||
    ChipsDeaths: typeof import('./src/components/charts/overall/deaths/ChipsDeaths.vue')['default']
 | 
					    ChipsDeaths: typeof import('./src/components/charts/overall/deaths/ChipsDeaths.vue')['default']
 | 
				
			||||||
    ChipsHospitalizations: typeof import('./src/components/charts/overall/hospitalizations/ChipsHospitalizations.vue')['default']
 | 
					    ChipsHospitalizations: typeof import('./src/components/charts/overall/hospitalizations/ChipsHospitalizations.vue')['default']
 | 
				
			||||||
 | 
					    ChipsRiskAge: typeof import('./src/components/charts/risk/age/ChipsRiskAge.vue')['default']
 | 
				
			||||||
    ChipsTesting: typeof import('./src/components/charts/overall/testing/ChipsTesting.vue')['default']
 | 
					    ChipsTesting: typeof import('./src/components/charts/overall/testing/ChipsTesting.vue')['default']
 | 
				
			||||||
    County_time_series: typeof import('./src/components/charts/state/cases/county_time_series.js')['default']
 | 
					    County_time_series: typeof import('./src/components/charts/state/cases/county_time_series.js')['default']
 | 
				
			||||||
    County_time_series_store: typeof import('./src/components/charts/state/cases/county_time_series_store.js')['default']
 | 
					    County_time_series_store: typeof import('./src/components/charts/state/cases/county_time_series_store.js')['default']
 | 
				
			||||||
@@ -31,7 +32,9 @@ declare module 'vue' {
 | 
				
			|||||||
    ParametersCases: typeof import('./src/components/charts/overall/cases/ParametersCases.vue')['default']
 | 
					    ParametersCases: typeof import('./src/components/charts/overall/cases/ParametersCases.vue')['default']
 | 
				
			||||||
    ParametersDeaths: typeof import('./src/components/charts/overall/deaths/ParametersDeaths.vue')['default']
 | 
					    ParametersDeaths: typeof import('./src/components/charts/overall/deaths/ParametersDeaths.vue')['default']
 | 
				
			||||||
    ParametersHospitalizations: typeof import('./src/components/charts/overall/hospitalizations/ParametersHospitalizations.vue')['default']
 | 
					    ParametersHospitalizations: typeof import('./src/components/charts/overall/hospitalizations/ParametersHospitalizations.vue')['default']
 | 
				
			||||||
 | 
					    ParametersRiskAge: typeof import('./src/components/charts/risk/age/ParametersRiskAge.vue')['default']
 | 
				
			||||||
    ParametersTesting: typeof import('./src/components/charts/overall/testing/ParametersTesting.vue')['default']
 | 
					    ParametersTesting: typeof import('./src/components/charts/overall/testing/ParametersTesting.vue')['default']
 | 
				
			||||||
 | 
					    RiskAgeParameters: typeof import('./src/components/charts/risk/age/RiskAgeParameters.vue')['default']
 | 
				
			||||||
    SliceSelector: typeof import('./src/components/SliceSelector.vue')['default']
 | 
					    SliceSelector: typeof import('./src/components/SliceSelector.vue')['default']
 | 
				
			||||||
    StatCard: typeof import('./src/components/cards/StatCard.vue')['default']
 | 
					    StatCard: typeof import('./src/components/cards/StatCard.vue')['default']
 | 
				
			||||||
    Store: typeof import('./src/components/charts/overall/cases/store.js')['default']
 | 
					    Store: typeof import('./src/components/charts/overall/cases/store.js')['default']
 | 
				
			||||||
@@ -53,6 +56,9 @@ declare module 'vue' {
 | 
				
			|||||||
    TrendDailyHospitalizationsPerCapita: typeof import('./src/components/charts/overall/hospitalizations/TrendDailyHospitalizationsPerCapita.vue')['default']
 | 
					    TrendDailyHospitalizationsPerCapita: typeof import('./src/components/charts/overall/hospitalizations/TrendDailyHospitalizationsPerCapita.vue')['default']
 | 
				
			||||||
    TrendPCRPositive: typeof import('./src/components/charts/overall/testing/TrendPCRPositive.vue')['default']
 | 
					    TrendPCRPositive: typeof import('./src/components/charts/overall/testing/TrendPCRPositive.vue')['default']
 | 
				
			||||||
    TrendPCRTests: typeof import('./src/components/charts/overall/testing/TrendPCRTests.vue')['default']
 | 
					    TrendPCRTests: typeof import('./src/components/charts/overall/testing/TrendPCRTests.vue')['default']
 | 
				
			||||||
 | 
					    TrendRiskAge: typeof import('./src/components/charts/risk/age/TrendRiskAge.vue')['default']
 | 
				
			||||||
 | 
					    TrendRiskCasesAge: typeof import('./src/components/charts/risk/age/TrendRiskCasesAge.vue')['default']
 | 
				
			||||||
 | 
					    'TrendRiskCasesAge copy': typeof import('./src/components/charts/risk/age/TrendRiskCasesAge copy.vue')['default']
 | 
				
			||||||
    TrendTotalCases: typeof import('./src/components/charts/overall/cases/TrendTotalCases.vue')['default']
 | 
					    TrendTotalCases: typeof import('./src/components/charts/overall/cases/TrendTotalCases.vue')['default']
 | 
				
			||||||
    TrendTotalCasesPerCapita: typeof import('./src/components/charts/overall/cases/TrendTotalCasesPerCapita.vue')['default']
 | 
					    TrendTotalCasesPerCapita: typeof import('./src/components/charts/overall/cases/TrendTotalCasesPerCapita.vue')['default']
 | 
				
			||||||
    TrendTotalDeaths: typeof import('./src/components/charts/overall/deaths/TrendTotalDeaths.vue')['default']
 | 
					    TrendTotalDeaths: typeof import('./src/components/charts/overall/deaths/TrendTotalDeaths.vue')['default']
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,8 @@ import OverallCases from './parser/overall/cases.js'
 | 
				
			|||||||
import OverallHospitalizations from './parser/overall/hospitalizations.js'
 | 
					import OverallHospitalizations from './parser/overall/hospitalizations.js'
 | 
				
			||||||
import OverallDeaths from './parser/overall/deaths.js'
 | 
					import OverallDeaths from './parser/overall/deaths.js'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import RiskAge from './parser/risk/age.js'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function main() {
 | 
					async function main() {
 | 
				
			||||||
  const sources = await fg(['./data/raw/*.zip'])
 | 
					  const sources = await fg(['./data/raw/*.zip'])
 | 
				
			||||||
  sources.sort()
 | 
					  sources.sort()
 | 
				
			||||||
@@ -23,6 +25,8 @@ async function main() {
 | 
				
			|||||||
  await OverallCases(zips, counties)
 | 
					  await OverallCases(zips, counties)
 | 
				
			||||||
  await OverallHospitalizations(zips, counties)
 | 
					  await OverallHospitalizations(zips, counties)
 | 
				
			||||||
  await OverallDeaths(zips, counties)
 | 
					  await OverallDeaths(zips, counties)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  await RiskAge(zips)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main()
 | 
					main()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,7 +93,7 @@ async function processCombined({ date, zip }, countyInfo, output) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function processSingleZip (zip, countyInfo) {
 | 
					async function processSingleZip (zip, countyInfo) {
 | 
				
			||||||
  const output = {
 | 
					  const output = {
 | 
				
			||||||
    directory: `./public/data/state/cases/`,
 | 
					    directory: `./public/data/overall/cases/`,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -116,7 +116,7 @@ async function processCombined({ date, zip }, countyInfo, output) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function processSingleZip (zip, countyInfo) {
 | 
					async function processSingleZip (zip, countyInfo) {
 | 
				
			||||||
  const output = {
 | 
					  const output = {
 | 
				
			||||||
    directory: `./public/data/state/deaths/`,
 | 
					    directory: `./public/data/overall/deaths/`,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,7 +112,7 @@ async function processCombined({ date, zip }, countyInfo, output) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function processSingleZip (zip, countyInfo) {
 | 
					async function processSingleZip (zip, countyInfo) {
 | 
				
			||||||
  const output = {
 | 
					  const output = {
 | 
				
			||||||
    directory: `./public/data/state/hospitalizations/`,
 | 
					    directory: `./public/data/overall/hospitalizations/`,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import { getCounty } from '../../util.js'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function processSingleZip ({ date, zip }) {
 | 
					async function processSingleZip ({ date, zip }) {
 | 
				
			||||||
  const output = {
 | 
					  const output = {
 | 
				
			||||||
    directory: `./public/data/state/testing/by-county/`,
 | 
					    directory: `./public/data/overall/testing/by-county/`,
 | 
				
			||||||
    file: county => `${county}.json`
 | 
					    file: county => `${county}.json`
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										49
									
								
								data/parser/risk/age.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								data/parser/risk/age.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					import mkdirp from 'mkdirp'
 | 
				
			||||||
 | 
					import path from 'path'
 | 
				
			||||||
 | 
					import fsp from 'fs/promises'
 | 
				
			||||||
 | 
					import Papa from 'papaparse'
 | 
				
			||||||
 | 
					import { getCounty } from '../../util.js'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function processSingleZip ({ date, zip }) {
 | 
				
			||||||
 | 
					  const output = {
 | 
				
			||||||
 | 
					    directory: `./public/data/risk/age/`,
 | 
				
			||||||
 | 
					    file: `age.json`
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  try {
 | 
				
			||||||
 | 
					    await fsp.rm(output.directory, { recursive: true })
 | 
				
			||||||
 | 
					  } catch (e) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const csv = await zip.entryData('epicurve_age_group_rpt_date.csv').then(res => res.toString())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const rows = Papa.parse(csv, {
 | 
				
			||||||
 | 
					    header: true
 | 
				
			||||||
 | 
					  }).data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const results = rows.map(row => {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					      age_group: row.age_group,
 | 
				
			||||||
 | 
					      report_date: row.report_date,
 | 
				
			||||||
 | 
					      cases: +row.cases,
 | 
				
			||||||
 | 
					      hospitalizations: +row.confirmed_case_hospitalization,
 | 
				
			||||||
 | 
					      deaths: +row.deaths,
 | 
				
			||||||
 | 
					      total_cases: +row.cases_cum,
 | 
				
			||||||
 | 
					      total_deaths: +row.total_deaths
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }).filter(row => !!row.report_date)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const data = {
 | 
				
			||||||
 | 
					    segment: { },
 | 
				
			||||||
 | 
					    headers: Object.keys(results[0]),
 | 
				
			||||||
 | 
					    rows: results.map(row => Object.values(row))
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  await mkdirp(output.directory)
 | 
				
			||||||
 | 
					  await fsp.writeFile(path.join(output.directory, output.file), JSON.stringify(data))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function process (zips) {
 | 
				
			||||||
 | 
					  return processSingleZip(zips.at(-1))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default process
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user