covid

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GovernmentDiseaseData

type GovernmentDiseaseData struct {
	// Updated contains the UNIX timestamp of the last update to the data.
	Updated uint64 `json:"updated"`
	// Province contains the name of the province or state from which this data is originated.
	// May also be "Total" to represent the data from the whole country.
	Province string `json:"province"`
	// Cases contains the number of all confirmed COVID-19 cases.
	Cases uint `json:"cases"`
	// CasePreviousDayChange is the number of new cases within the previous day.
	CasePreviousDayChange uint `json:"casePreviousDayChange"`
	// CasesPerHundredThousand is the number of cases per 100.000 citizens.
	CasesPerHundredThousand uint `json:"casesPerHundredThousand"`
	// SevenDayCasesPerHundredThousand is the number of new cases per 100.000 citizens during the last week.
	SevenDayCasesPerHundredThousand uint `json:"sevenDayCasesPerHundredThousand"`
	// The absolute number of casualties related to COVID-19.
	Deaths uint `json:"deaths"`
}

GovernmentDiseaseData is a struct that is JSON-compatible with the result of the disease.sh API.

func GetGovernmentData

func GetGovernmentData(country string, allowNull bool) ([]GovernmentDiseaseData, error)

GetGovernmentData fetches the latest government-published data for a given country. The parameter country controls the geographic region for which data is fetched, while allowNull controls if missing data should be returned as '0' or as 'nil'.

type StateVaccinationData

type StateVaccinationData struct {
	// VaccinationCountData is embedded to represent the vaccination counts for the province.
	VaccinationCountData
	// Total is the number of citizens that live in the province.
	Total uint `json:"total"`
	// Quote is the relative vaccination progression in the province.
	Quote float64 `json:"quote"`
	// VaccinationsPer1000Inhabitants is the number of vaccinated citizens per 1000 citizens.
	VaccinationsPer1000Inhabitants float64 `json:"vaccinations_per_1000_inhabitants"`
	// SecondVaccination is the vaccinations count for the second vaccination wave.
	SecondVaccination VaccinationCountData `json:"2nd_vaccination"`
}

StateVaccinationData is a struct that is JSON-compatible with the RKI vaccination data API. It contains the current vaccination data for a single province.

type VaccinationCountData

type VaccinationCountData struct {
	// Vaccinated is the number of citizens that already received a vaccination.
	Vaccinated uint `json:"vaccinated"`
	// DifferenceToThePreviousDay is the number of citizens that received a vaccination in the last 24h period.
	DifferenceToThePreviousDay uint `json:"difference_to_the_previous_day"`
}

VaccinationCountData is a struct that is JSON-compatible with the RKI vaccination data API. It contains the actual vaccination counts and difference to the last day.

type VaccinationData

type VaccinationData struct {
	// StateVaccinationData is embedded to represent the vaccination data for Germany as a whole.
	StateVaccinationData
	// LastUpdate is the ISO-instant formatted time of the last data update.
	LastUpdate string `json:"lastUpdate"`
	// States contains a map with an entry for each province and the corresponding data for that province.
	States map[string]StateVaccinationData `json:"states"`
}

VaccinationData is a struct that is JSON-compatible with the RKI vaccination data API. It contains the current vaccination data grouped by province.

func GetVaccinationData

func GetVaccinationData() (*VaccinationData, error)

GetVaccinationData returns the vaccination stats for Germany from the RKI API endpoint. The data is usually updated once per week-day.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL