fixes for second dose and coverstion on that value
This commit is contained in:
parent
2adf91be36
commit
6b60e2d2e8
9
main.go
9
main.go
@ -7,6 +7,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/cabify/gotoprom"
|
"github.com/cabify/gotoprom"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
@ -76,8 +77,8 @@ type OntCovidDataByAge struct {
|
|||||||
AtLeastOneDoseCumulative json.Number `json:"At least one dose_cumulative"`
|
AtLeastOneDoseCumulative json.Number `json:"At least one dose_cumulative"`
|
||||||
SecondDoseCumulative json.Number `json:"Second_dose_cumulative"`
|
SecondDoseCumulative json.Number `json:"Second_dose_cumulative"`
|
||||||
TotalPopulation json.Number `json:"Total population"`
|
TotalPopulation json.Number `json:"Total population"`
|
||||||
PercentAtLeastOneDose json.Number `json:"Percent_at_least_one_dose"`
|
PercentAtLeastOneDose string `json:"Percent_at_least_one_dose"`
|
||||||
PercentFullyVaccinated json.Number `json:"Percent_fully_vaccinated"`
|
PercentFullyVaccinated string `json:"Percent_fully_vaccinated"`
|
||||||
} `json:"records"`
|
} `json:"records"`
|
||||||
Limit int `json:"limit"`
|
Limit int `json:"limit"`
|
||||||
Links struct {
|
Links struct {
|
||||||
@ -199,11 +200,11 @@ func updateMetrics() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
percentAtLeastOneDose, err := record.PercentAtLeastOneDose.Float64()
|
percentAtLeastOneDose, err := strconv.ParseFloat(record.PercentAtLeastOneDose, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
percentFullyVaccinated, err := record.PercentAtLeastOneDose.Float64()
|
percentFullyVaccinated, err := strconv.ParseFloat(record.PercentFullyVaccinated, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user