From 0b154a825128aec60341063eb5d994eb8454fa51 Mon Sep 17 00:00:00 2001 From: Ray Slakinski Date: Sun, 9 May 2021 21:21:54 -0400 Subject: [PATCH] update eligiblePopulation because now 16+ can now be vaccinated --- contrib/ages.csv | 22 ++++++++++++++++++++++ contrib/calc_eligible_population.py | 12 ++++++++++++ main.go | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 contrib/ages.csv create mode 100644 contrib/calc_eligible_population.py diff --git a/contrib/ages.csv b/contrib/ages.csv new file mode 100644 index 0000000..7e2de1b --- /dev/null +++ b/contrib/ages.csv @@ -0,0 +1,22 @@ +"All ages","14,734,014" +"0 to 4 years","723,016" +"5 to 9 years","762,654" +"10 to 14 years","792,947" +"15 to 19 years","852,405" +"20 to 24 years","1,039,661" +"25 to 29 years","1,077,433" +"30 to 34 years","1,041,952" +"35 to 39 years","992,844" +"40 to 44 years","921,378" +"45 to 49 years","932,058" +"50 to 54 years","968,546" +"55 to 59 years","1,073,519" +"60 to 64 years","961,243" +"65 to 69 years","803,962" +"70 to 74 years","673,546" +"75 to 79 years","461,015" +"80 to 84 years","319,548" +"85 to 89 years","204,227" +"90 to 94 years","98,638" +"95 to 99 years","29,527" +"100 years and over","3,895" \ No newline at end of file diff --git a/contrib/calc_eligible_population.py b/contrib/calc_eligible_population.py new file mode 100644 index 0000000..862fec8 --- /dev/null +++ b/contrib/calc_eligible_population.py @@ -0,0 +1,12 @@ +import csv + +ages = [] +with open("ages.csv", newline="") as csvfile: + spamreader = csv.reader(csvfile, delimiter=",", quotechar='"') + for row in spamreader: + ages.append(row) + +total = 0 +for age in ages[4:]: + total += int(age[1].replace(",", "")) +print(total) diff --git a/main.go b/main.go index b924f7a..2b212df 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,7 @@ func init() { func updateMetrics() { data_url := "https://data.ontario.ca/api/3/action/datastore_search?sort=report_date+desc&limit=1&resource_id=8a89caa9-511c-4568-af89-7f2174b4378c" - eligiblePopulation := int64(11971129) + eligiblePopulation := int64(12455397) resp, getErr := http.Get(data_url) if getErr != nil { log.Println(getErr)