Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

ephos/PSCOVID-19

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReadMe

Build Status

PSCOVID-19

This was a project born out of wanting to just write some code as more cases of COVID-19 started popping up throughout the United States.

This uses the same CSV data files in the Johns Hopkins CSSE GitHub Repository. This is a side project I just wanted to write to tinker with data, I am in NO WAY affiliated with any health organization or Johns Hopkins!

Install and Usage

Installing the module.

# Install module.
Install-Module -Name PSCOVID-19 -Scope CurrentUser

As of now the module only has limited functionality.

If you want to get all of the data to manipulate it yourself. Use Get-COVID19Data, it will return a list of [Covid] objects that you can manipulate with built-in PowerShell Cmdlets.

# Gather the latest data
$covidData = Get-COVID19Data

# Filter the data to get all US cases and measure the total amount of confirmed cases across all of the data
$covidData | Where-Object {$_.CountryOrRegion -eq 'US'} | Measure-Object -Property Confirmed -Sum

# For you other New Englanders, Get all the New England states, sort by 'confirmed' cases and then format it out as a table
$covidData | Where-Object {$_.CountryOrRegion -eq 'US'} | Where-Object {
    $_.ProvinceOrState -eq 'Massachusetts' -or
    $_.ProvinceOrState -eq 'Rhode Island' -or
    $_.ProvinceOrState -eq 'Connecticut' -or
    $_.ProvinceOrState -eq 'New Hampshire' -or
    $_.ProvinceOrState -eq 'Vermont' -or
    $_.ProvinceOrState -eq 'Maine'
} | Sort-Object -Property Confirmed -Descending | Format-Table -AutoSize

# Get data for Italy
$covidData | Where-Object {$_.CountryOrRegion -eq 'Italy'}  | Format-Table -AutoSize

# Use Measure-Object to get stats for a given area
$covidData | Where-Object {$_.ProvinceOrState -eq 'New York'}  | Measure-Object -Property Confirmed -AllStats

As the data only tends to update once daily this originally was a tracker in pre 2.* versions. Now Format-Covid19Table simply prints the data with a pretty table that has colors!

# Get all United States cases
Format-Covid19Table -CountryOrRegion US

# Get all the cases for a specific state
Format-Covid19Table -CountryOrRegion US -ProvinceOrState 'Massachusetts'

Below is an image of the output using the US and Massachusetts as an example. example1

Links

About

When a pandemic is declared, it's time to write a PowerShell module for it. Enter PSCOVID-19.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published