r/PowerShell • • Mar 27 '20

COV-ID-19 PowerShell Prompt

https://www.powershell.co.at/cov-id-19-powershell-prompt/
123 Upvotes

25 comments sorted by

3

u/Sansred Mar 27 '20

This is cool. How would one set up one for a state in USA?

4

u/Roman1410S Mar 27 '20 edited Mar 27 '20

There is a discussion on the rapidapi site. They say, use the coronavirus monitor 2 for us states. If you try, let me know if it worked. R.

PS: Coronavirus Monitor V2 is a Freemium service. Depends on you if you want this.

6

u/Sunsparc Mar 27 '20

I made this yesterday that pulls all states, you can where filter down by state from there. It's an object, so you can make it display however you want.

6

u/cncamusic Mar 27 '20

Wow this is awesome, I’ve been planning to write a script to calculate projected stats and I think this will help with that.

3

u/sophware Mar 27 '20

Do tell. I was thinking that what I want to know on a daily basis is deaths (not cases) over the last three days, compared to the growth rate they had in the previous 5 days (maybe 10).

Have you already come up with code or method to calculate what a given day or set of days would be, if they were continuing a previous trend? I don't mean using 2 or 2.5 or 3 days for doubling--i mean the math behind coming up with those exact numbers.

3

u/cncamusic Mar 27 '20

I have nothing yet, but I had told myself when I’m off work today I would sit down and try to come up with something. Coincidentally this appears on my front page shortly after. My initial thought was just to calculate percentage growth between daily numbers, as more data is collected calculate averages and use those numbers to generate projected numbers for maybe tomorrow, next week etc. I’m not great with math, and I’m a powershell newbie but I figure if the data is available we can experiment with it.

5

u/Snak3d0c Mar 27 '20

Not a fan of this implementation, i've seen enough Corona news :)

BUT, thank you for sharing and letting me discover rapidapi. i'll use this for some weather stuff.

Cheers

2

u/SolitaryRomanticist Mar 27 '20

This is so cool. I just created one for Sri Lanka inspired by this. Thanks!

2

u/tylermiranda1 Mar 28 '20

I created a dashboard in powershell using Universal Dashboard to track testing data and case counts.

https://covidtracking.azurewebsites.net

2

u/MysticRyuujin Mar 28 '20

Here's one for the United States, just replace YourAPIKey

# COVID-19
$Response = (
    Invoke-RestMethod -Uri https://coronavirus-monitor.p.rapidapi.com/coronavirus/latest_stat_by_country.php?country=USA `
    -Headers @{ 'x-rapidapi-host' = 'coronavirus-monitor.p.rapidapi.com'; 'x-rapidapi-key'  = 'YourAPIKey' }
)
$RecordDate = [System.TimeZoneInfo]::ConvertTimeFromUtc($Response.latest_stat_by_country.record_date,(Get-TimeZone))
Write-Host "COVID-19 Stats for United States from $RecordDate" -ForegroundColor Cyan
Write-Host "Active: $($Response.latest_stat_by_country.active_cases) " -ForegroundColor Yellow -NoNewline
Write-Host "(New: $($Response.latest_stat_by_country.new_cases)) " -ForegroundColor Yellow -NoNewline
Write-Host "Fatal: $($Response.latest_stat_by_country.total_deaths) " -ForegroundColor Red -NoNewline
Write-Host "(New: $($Response.latest_stat_by_country.new_deaths)) " -ForegroundColor Red -NoNewline
Write-Host "Recovered:$($Response.latest_stat_by_country.total_recovered) " -ForegroundColor Green -NoNewline
$Total = [int]$Response.latest_stat_by_country.active_cases + [int]$Response.latest_stat_by_country.total_deaths + [int]$Response.latest_stat_by_country.total_recovered
Write-Host " Total: $('{0:N0}' -f $Total)" -ForegroundColor Magenta

2

u/motsanciens Mar 28 '20

So what's the deal with rapid api? Is it sort of like an auth pass through, not hosting anything, just managing api keys?

2

u/mdj_ Mar 28 '20 edited Mar 28 '20

That's depressing..... I did a similar thing for Australia last week :)

1

u/slashd Mar 27 '20

This is awesome! Thank you!

1

u/joerod Mar 28 '20

because i have to be reminded..

1

u/Alienbluesucks Apr 01 '20

Ruh-Roh

Error 503 All backends failed or unhealthy

All backends failed or unhealthy

Guru Mediation:

Details: cache-atl6238-ATL 1585754482 314177956

Varnish cache server

1

u/m-arx Mar 27 '20

Vielen Dank, guter Artikel.

Im zweiten Screenshot ist der Karl Meier noch sichtbar.

Schönes Wochenende und gesund bleiben!

1

u/Jacmac_ Mar 27 '20

Is there any way you could add the estimated %GDP evaporated per life saved?

1

u/ka-splam Mar 28 '20

Is there any way you could add the estimated tears shed per life lost?

2

u/Jacmac_ Mar 28 '20

Like we do for the flu?

2

u/ka-splam Mar 28 '20 edited Mar 28 '20

I'm assuming your position is "human life is only worth its economic output" and "I value GDP more than human lives" (and implicitly "I wouldn't die from it, so who cares"). If that is not your position, what is? Why else would you pick GDP - a proxy value estimating a level of luxury - the primary thing to compare against human death?

We also don't estimate %GDP evaporated for flu death avoiders, do we? Quipping "Like we do for the flu?" doesn't support what you appear to be suggesting, anyway.

(And what about all the people who made the GDP cost worse, through selfishness or inaction? Are we apportioning blame to governments who didn't act early in January for political points, causing the virus to spread farther and faster? Hospitals which didn't stock up on protective gear to save costs, causing worse effects now? Companies run focusing on short-term profit with no buffers and no disaster plans which could carry them through lower income times without layoffs, worsening the economic damage now? Companies run without sick time for people to self-isolate, for profit, causing the virus to spread faster? Companies ignoring wfh recommendations and demanding their employees come in anyway until forced not to, for short term profit, hastening the spread more? The people who ignored requests to isolate and went out partying, spreading it more? Or is it the healthy who spread the virus get to blame the sickly-death-avoiders for the extreme almost-last-minute-action costs, which could have been a lot lot lower if we'd all acted in our longer term interest instead of short-term interests?)

1

u/Jacmac_ Mar 29 '20

My position is that we are destroying the world economy to save lives.

1

u/ka-splam Mar 29 '20

The world economy can be rebuilt, the dead can't be revived.

1

u/Jacmac_ Mar 31 '20

https://www.cdc.gov/flu/about/burden/preliminary-in-season-estimates.htm

Enough said. In the US alone there have been up to 62,000 flu deaths since the season started last November. Up to 52,000,000 have been infected. We don't stop the world economy because of it. I'm not saying we should do nothing at all, but stopping the world in an attempt to save a fraction of the population that is truly at risk is the most emotional and least pragmatic way to address the problem. What happens if some new virus pops up next year. Do we stop the economy all over again to hopefully save a few thousand lives? There is a risk to existence, nobody including me is immune to the possibility that something can come along and kill me. We can't run the world like this, millions will end up homeless or starving because we are desperate to save a few thousand lives.

2

u/ka-splam Mar 31 '20

Enough said. In the US alone there have been up to 62,000 flu deaths since the season started last November.

Five months is ~150 days. At current rates you'll have 62k deaths from COVID-19 in the next, what, 20 days?

When was the last time Spain took over an ice rink to act as a temporary morgue for flu deaths? Or London called in the military to turn an exhibition centre into an emergency 4000 bed hospital for flu? Or the US Navy sent a hospital ship to New York, or 80,000 former New York healthcare workers volunteer to help out and the Governer of New York says they need 1 million healthcare workers to cope with the crisis, and describes the situation as "we've gone beyond staggering already" for flu deaths? Or the last time Russia sent a convoy of military trucks, 100 military virologists, and 9 transport planes to Italy, Cuba sent 37 doctors to Italy, and 750,000 Britons sign up to volunteer help driving NHS medical supplies around, for flu? Or convention centres in Baltimore, Santa Clara, Orange County, Chicago, Oregon, New Orleans, Detroit, Atlantic City, and more were tranformed into makeshift hospitals for flu?

Are they all just having a laugh?

https://www.reddit.com/r/dataisbeautiful/comments/fsbe0b/deaths_caused_by_covid19_vs_typical_flu_season_in/

There is a risk to existence, nobody including me is immune to the possibility that something can come along and kill me

You'd make the trade the other way around - if it was you going to die from COVID-19 and the lockdown saved you, you'd choose instead to sacrifice your life and die to prop up the world economy numbers? You'd suicide to avoid a temporary slowdown in CocaCola production, Nike shoe sales or a Disney film being delayed by 6 months? Excuse me assuming what you'd do without knowing you, but I doubt it, because - put like that - who on Earth would?

millions will end up homeless or starving because we are desperate to save a few thousand lives.

Society could give them food. Banks could loan them food. Food will still exist. People won't be able to afford it, so we will throw it in the trash instead (in so-called "Christian" countries, no less). Those are things which don't need to happen that way. If we agree the economy is based on real value, then we agree it can be rebuilt after, which means a slowdown is a temporary thing. The suffering from not-dying is not as inevitable as the suffering from dying.

What happens if some new virus pops up next year. Do we stop the economy all over again to hopefully save a few thousand lives?

Hopefully we'll collectively have learned some lessons by then about running everything with no preparation, minimal staff, no buffers, no savings, no disaster plans, minimal sick-day time, maximising short term growth and lean supply chains without redundancy, disbanding the pandemic response teams, and we'll respond quicker instead of waiting weeks ignoring what's happening, and it won't be an either/or situation.

0

u/Disorderly_Chaos Mar 28 '20

If ($You -eq ‘Human’) { $Stay = ‘At Home’ } Else { Goto Pub #or Bar }