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

DEV: added csv export to states #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shivathanu
Copy link

@Shivathanu Shivathanu commented May 15, 2020

Description:

Added CSV export option along with the chart display for additional visualization option.

Instructions:

The csv file generation is configured with the states feature. The output is a csv file with the data stored in output folder.

Run command:

corona --s states

Fixes #98

@milespossing
Copy link

this works, but the command you've provided doesn't seem to. If corona states were to be run it works perfectly and yields a csv.

Comment on lines +53 to +67

const csvWriter = createCsvWriter({
path: 'output/chart.csv',
header: [
{id: 'state', title: 'State'},
{id: 'cases', title: 'Cases'},
{id: 'todayCases', title: 'Cases (today)'},
{id: 'deaths', title: 'Deaths'},
{id: 'todayDeaths', title: 'Deaths (today)'},
{id: 'active', title: 'Active'},
]
});

csvWriter.writeRecords(allStates);

Copy link

@pokimochi pokimochi Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corona states throws an error when the output folder does not exist. I suggest creating the directory if it doesn't exist before writing the records.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I want to add code to remove this bug. How do I do this? Should I clone, make amends and then do a PR ? or something else ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest you can clone and add a new commit to this pr with the fix, thanks

@yuntaeJ
Copy link

yuntaeJ commented Nov 19, 2020

I solved that problem using directory checking process

 var fs=require('fs');

		if (!fs.existsSync('./output')){
			fs.mkdirSync('./output');
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to creat a csv file
5 participants