sciensano

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoseTypeNames map[string]DoseType
View Source
var SummaryColumnNames map[string]SummaryColumn

Functions

func CasesValidSummaryModes

func CasesValidSummaryModes() set.Set[SummaryColumn]

func GetURL

func GetURL(base string, endpoint Endpoint) (string, error)

func HospitalisationsValidSummaryModes

func HospitalisationsValidSummaryModes() set.Set[SummaryColumn]

func MortalitiesValidSummaryModes

func MortalitiesValidSummaryModes() set.Set[SummaryColumn]

func MustGetURL

func MustGetURL(base string, endpoint Endpoint) string

func TestResultsValidSummaryModes

func TestResultsValidSummaryModes() set.Set[SummaryColumn]

func VaccinationsValidSummaryModes

func VaccinationsValidSummaryModes() set.Set[SummaryColumn]

Types

type Case

type Case struct {
	TimeStamp TimeStamp `json:"DATE"`
	Province  string    `json:"PROVINCE"`
	Region    string    `json:"REGION"`
	AgeGroup  string    `json:"AGEGROUP"`
	Cases     int       `json:"CASES"`
}

func (Case) MarshalEasyJSON

func (v Case) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Case) MarshalJSON

func (v Case) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Case) UnmarshalEasyJSON

func (v *Case) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Case) UnmarshalJSON

func (v *Case) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Cases

type Cases []Case

func (Cases) MarshalEasyJSON

func (v Cases) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Cases) MarshalJSON

func (v Cases) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Cases) Summarize

func (cs Cases) Summarize(summaryColumn SummaryColumn) (*tabulator.Tabulator, error)

func (*Cases) UnmarshalEasyJSON

func (v *Cases) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Cases) UnmarshalJSON

func (v *Cases) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DoseType

type DoseType int

DoseType is the type of vaccination: partial, full, single dose, booster, etc.

const (
	Partial DoseType = iota
	Full
	SingleDose
	Booster
	Booster2
	Booster3
	Booster4
)

func (DoseType) MarshalJSON

func (d DoseType) MarshalJSON() (body []byte, err error)

func (DoseType) String

func (d DoseType) String() string

func (*DoseType) UnmarshalJSON

func (d *DoseType) UnmarshalJSON(body []byte) (err error)

type Endpoint

type Endpoint int
const (
	CasesEndpoint Endpoint = iota
	HospitalisationsEndpoint
	MortalitiesEndpoint
	TestResultsEndpoint
	VaccinationsEndpoint
)

type Fetcher

type Fetcher[T any] struct {
	Target string
	Client *http.Client
}

func (*Fetcher[T]) Fetch

func (f *Fetcher[T]) Fetch(ctx context.Context) (T, error)

func (*Fetcher[T]) GetLastModified

func (f *Fetcher[T]) GetLastModified(ctx context.Context) (time.Time, error)

type Hospitalisation

type Hospitalisation struct {
	TimeStamp   TimeStamp `json:"DATE"`
	Province    string    `json:"PROVINCE"`
	Region      string    `json:"REGION"`
	TotalIn     int       `json:"TOTAL_IN"`
	TotalInICU  int       `json:"TOTAL_IN_ICU"`
	TotalInResp int       `json:"TOTAL_IN_RESP"`
	TotalInECMO int       `json:"TOTAL_IN_ECMO"`
}

type Hospitalisations

type Hospitalisations []Hospitalisation

func (Hospitalisations) Categorize

func (h Hospitalisations) Categorize() *tabulator.Tabulator

func (Hospitalisations) Summarize

func (h Hospitalisations) Summarize(summaryColumn SummaryColumn) (*tabulator.Tabulator, error)

type Mortalities

type Mortalities []Mortality

func (Mortalities) Summarize

func (m Mortalities) Summarize(summaryColumn SummaryColumn) (*tabulator.Tabulator, error)

type Mortality

type Mortality struct {
	TimeStamp TimeStamp `json:"DATE"`
	Region    string    `json:"REGION"`
	AgeGroup  string    `json:"AGEGROUP"`
	Deaths    int       `json:"DEATHS"`
}

type SummaryColumn

type SummaryColumn int
const (
	Total SummaryColumn = iota
	ByRegion
	ByProvince
	ByAgeGroup
	ByManufacturer
	ByVaccinationType
	ByCategory
)

func (SummaryColumn) String

func (s SummaryColumn) String() string

type TestResult

type TestResult struct {
	TimeStamp TimeStamp `json:"DATE"`
	Province  string    `json:"PROVINCE"`
	Region    string    `json:"REGION"`
	Total     int       `json:"TESTS_ALL"`
	Positive  int       `json:"TESTS_ALL_POS"`
}

type TestResults

type TestResults []TestResult

func (TestResults) Categorize

func (r TestResults) Categorize() *tabulator.Tabulator

func (TestResults) Summarize

func (r TestResults) Summarize(summaryColumn SummaryColumn) (*tabulator.Tabulator, error)

type TimeStamp

type TimeStamp struct {
	time.Time
}

TimeStamp represents a timestamp in the API response. Needed for parsing purposes

func (*TimeStamp) MarshalJSON

func (ts *TimeStamp) MarshalJSON() ([]byte, error)

MarshalJSON marshals a TimeStamp to JSON

func (*TimeStamp) UnmarshalJSON

func (ts *TimeStamp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a TimeStamp from the API responder.

type Vaccination

type Vaccination struct {
	TimeStamp    TimeStamp `json:"DATE"`
	Manufacturer string    `json:"BRAND"`
	Region       string    `json:"REGION"`
	AgeGroup     string    `json:"AGEGROUP"`
	Gender       string    `json:"SEX"`
	Dose         DoseType  `json:"DOSE"`
	Count        int       `json:"COUNT"`
}

func (Vaccination) GetSummaryColumnName

func (v Vaccination) GetSummaryColumnName(column SummaryColumn) (string, error)

func (Vaccination) MarshalEasyJSON

func (v Vaccination) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Vaccination) MarshalJSON

func (v Vaccination) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Vaccination) UnmarshalEasyJSON

func (v *Vaccination) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Vaccination) UnmarshalJSON

func (v *Vaccination) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Vaccinations

type Vaccinations []Vaccination

func (Vaccinations) MarshalEasyJSON

func (v Vaccinations) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Vaccinations) MarshalJSON

func (v Vaccinations) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Vaccinations) Summarize

func (v Vaccinations) Summarize(summaryColumn SummaryColumn) (*tabulator.Tabulator, error)

func (*Vaccinations) UnmarshalEasyJSON

func (v *Vaccinations) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Vaccinations) UnmarshalJSON

func (v *Vaccinations) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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