Documentation
¶
Index ¶
- Constants
- Variables
- func PopulationOfDepartment(dep string) (int, error)
- type AdminLevels
- type Case
- type CaseDAL
- type CaseID
- type CaseService
- type Emergency
- type EmergencyDAL
- type EmergencyID
- type EmergencyService
- type Error
- type Geo
- type GeoCoding
- type Geometry
- type HospDAL
- type HospID
- type HospService
- type Hospitalization
- type Hotel
- type HotelDAL
- type HotelID
- type HotelJob
- type IndicDAL
- type IndicID
- type IndicService
- type Indicator
- type Logfer
- type ParameterScope
- type Place
- type Properties
- type Protection
- type ProtectionID
- type ProtectionType
- type RefreshJob
- type Refresher
- type Report
- type Risk
- type RiskDAL
- type RiskID
- type RiskJob
- type RiskParameter
- type RiskParameters
- type RiskParametersDAL
- type RiskSegID
- type RiskSegment
- type Screening
- type ScreeningDAL
- type ScreeningID
- type ScreeningService
- type SegID
- type Segment
- type Statement
- type Transportation
- type TransportationDuration
Constants ¶
View Source
const ( ErrInvalidTimeJSON = Error("invalid time format (only RFC3339 format `2006-01-02T15:04:05Z07:00` is accepted)") ErrInvalidJSON = Error("invalid json") ErrInternal = Error("internal error") ErrInvalidQueryParamsType = Error("invalid query parameters type") ErrNoAuthenticationToken = Error("no authentication token provided") ErrInvalidAuthenticationToken = Error("invalid authentication token provided") ErrMissingAPISecret = Error("api-secret is missing") ErrInvalidAPISecret = Error("api-secret is wrong") ErrNoParametersDefined = Error("no default parameters are defined") )
HTTP errors
View Source
const (
)
General errors.
Variables ¶
View Source
var ( ErrDocRequired = func(doc string) error { return Errorf("document %q is required", doc) } ErrMissingParams = func(doc string) error { return Errorf("%q is missing", doc) } )
DB Errors
Functions ¶
func PopulationOfDepartment ¶
Types ¶
type AdminLevels ¶
type Case ¶
type Case struct {
ID CaseID `bson:"_id" json:"id"`
Department string `bson:"dep" json:"dep"`
NoticeDate time.Time `bson:"noticeDate" json:"noticeDate"`
//HospServiceCountRelated is the number of hospital services reporting at least one case
HospServiceCountRelated int `bson:"hospServiceCountRelated" json:"hospServiceCountRelated"`
}
type CaseService ¶
type Emergency ¶
type Emergency struct {
ID EmergencyID `bson:"_id" json:"id"`
Department string `bson:"dep" json:"dep"`
PassageDate time.Time `bson:"passageDate" json:"passageDate"`
//Count is the number of visits
Count int `bson:"count" json:"count"`
//Cov19SuspCount is the number of suspicious covid19 patient amoung the visits
Cov19SuspCount int `bson:"cov19SuspCount" json:"cov19SuspCount"`
//Cov19SuspicionHosp is the amount of hospitalized for covid-19 suspicion amoung the visits
Cov19SuspHosp int `bson:"cov19SuspHospitalized" json:"cov19SuspHospitalized"`
//TotalSOSMedAct is the amount of medical act reported by SOS Medecin
TotalSOSMedAct int `bson:"totalSosMedAct" json:"totalSosMedAct"`
//TotalSOSMedAct is the amount of medical act reported by SOS Medecin concerning the COVID-19
SOSMedCov19SuspAct int `bson:"cov19SosMedAct" json:"sosMedMaleAct"`
}
Emergency regroups the stats about visit at emergency room
type EmergencyDAL ¶
type EmergencyID ¶
type EmergencyID string
type EmergencyService ¶
type Geo ¶
type Geo struct {
Properties Properties `json:"properties"`
Type string `json:"type"`
Geometry Geometry `json:"geometry"`
}
type GeoCoding ¶
type GeoCoding struct {
Type string `json:"type"`
Accuracy int `json:"accuracy"`
Label string `json:"label"`
Name string `json:"name"`
HouseNumber string `json:"housenumber"`
Street string `json:"street"`
Locality string `json:"locality"`
PostCode string `json:"postcode"`
City string `json:"city"`
District *string `json:"district,omitempty"`
County *string `json:"county,omitempty"`
State *string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
Admin AdminLevels `json:"admin"`
Geohash string `json:"geohash"`
}
type HospDAL ¶
type HospDAL interface {
Get(dep string, date time.Time) (*Hospitalization, error)
GetRange(dep string, begin, end time.Time) ([]*Hospitalization, error)
Upsert(...*Hospitalization) error
}
type HospService ¶
type HospService interface {
RefreshHospitalization() ([]*Hospitalization, error)
}
type Hospitalization ¶
type Hospitalization struct {
ID HospID `bson:"_id" json:"id"`
Department string `bson:"dep" json:"dep"`
Date time.Time `bson:"date" json:"date"`
//Count is the number of patient hospitalized
Count int `bson:"count" json:"count"`
//CriticalCount is the number of patient in resuscitation or critical care
CriticalCount int `bson:"critical" json:"critical"`
//ReturnHomeCount is the number of patient that returned home
ReturnHomeCount int `bson:"returnHome" json:"returnHome"`
//DeathCount is the number of deaths
DeathCount int `bson:"deaths" json:"deaths"`
}
Hospitalization defines the usefull data about hospitalization
type Hotel ¶
type Hotel struct {
ID HotelID `bson:"_id" json:"id"`
Name string `bson:"name" json:"name"`
Address string `bson:"address" json:"address"`
City string `bson:"city" json:"city"`
ZipCode string `bson:"zipCode" json:"zipCode"`
Country string `bson:"country" json:"country"`
ImageURL string `bson:"imageUrl" json:"imageUrl"`
SanitaryInfos []string `bson:"sanitaryInfos" json:"sanitaryInfos"`
SanitaryNote float64 `bson:"sanitaryNote" json:"sanitaryNote"`
SanitaryNorm string `bson:"sanitaryNorm" json:"sanitaryNorm"`
}
type IndicService ¶
type Logfer ¶
type Logfer interface {
HasErr(ctx context.Context, err error) bool
HasErrWithFields(ctx context.Context, fields map[string]interface{}, err error) bool
Debug(ctx context.Context, str string, vars ...interface{})
DebugWithFields(ctx context.Context, fields map[string]interface{}, str string, vars ...interface{})
Info(ctx context.Context, str string, vars ...interface{})
InfoWithFields(ctx context.Context, fields map[string]interface{}, str string, vars ...interface{})
Warn(ctx context.Context, str string, vars ...interface{})
WarnWithFields(ctx context.Context, fields map[string]interface{}, str string, vars ...interface{})
Error(ctx context.Context, str string, vars ...interface{})
ErrorWithFields(ctx context.Context, fields map[string]interface{}, str string, vars ...interface{})
Panic(ctx context.Context, str string, vars ...interface{})
PanicWithFields(ctx context.Context, fields map[string]interface{}, str string, vars ...interface{})
}
type ParameterScope ¶
type ParameterScope struct {
// Transportation optionally represents the transportation of this scope (if not a place)
Transportation Transportation `bson:"transportation" json:"transportation"`
// Place optionally represents the place of this scope (if not a transportation)
Place Place `bson:"place" json:"place"`
Duration TransportationDuration `bson:"duration" json:"duration"`
}
func (*ParameterScope) String ¶
func (s *ParameterScope) String() string
type Properties ¶
type Properties struct {
GeoCoding *GeoCoding `json:"geocoding,omitempty"`
//props fr
Name *string `json:"nom,omitempty"`
PostalCode *string `json:"code,omitempty"`
DepCode *string `json:"codeDepartement,omitempty"`
RegionCode *string `json:"codeRegion,omitempty"`
Population *int `json:"population,omitempty"`
PostalCodes []string `json:"codesPostaux,omitempty"`
}
type Protection ¶
type Protection struct {
ID ProtectionID
Type ProtectionType
Name string
Quantity int
}
type ProtectionID ¶
type ProtectionID string
type ProtectionType ¶
type ProtectionType string
const ( Mask ProtectionType = "mask" MaskSewn ProtectionType = "mask-sewn" MaskSurgical ProtectionType = "mask-surgical" MaskFFPX ProtectionType = "mask-ffpx" Gel ProtectionType = "gel" )
type RefreshJob ¶
type RefreshJob interface {
Refresh(CaseDAL, EmergencyDAL, HospDAL, IndicDAL, ScreeningDAL) error
}
type Refresher ¶
type Refresher interface {
CaseService
EmergencyService
HospService
IndicService
ScreeningService
}
type Risk ¶
type Risk struct {
ID RiskID `bson:"_id" json:"id"`
NoticeDate time.Time `bson:"noticeDate" json:"noticeDate"`
ConfidenceLevel float64 `bson:"confidenceLevel" json:"confidenceLevel"`
RiskLevel float64 `bson:"riskLevel" json:"riskLevel"`
DisplayedRisk float64 `bson:"displayedRisk" json:"displayedRisk"`
BySegments []RiskSegment `bson:"bySegments" json:"bySegments"`
Report Report `bson:"report" json:"report"`
}
Risk is the definition of risk and confidence level of a trip
type RiskJob ¶
type RiskJob interface {
ComputeRisk(segs []Segment, protects []Protection) (*Risk, error)
}
RiskJob defines the job to implements risk data logic
type RiskParameter ¶
type RiskParameter struct {
// The scope of this risk parameter
Scope ParameterScope `bson:"scope" json:"scope"`
// The number of persons with direct projection possible
NbDirect int `bson:"nbDirect" json:"nbDirect"`
// The probability of contagion via direct projection with an infectious person
ProbaContagionDirect float64 `bson:"probaContagionDirect" json:"probaContagionDirect"`
// The protection factor of mask against direct contagion
MaskProtectDirect float64 `bson:"maskProtectDirect" json:"maskProtectDirect"`
// The number of persons with direct contact with the person
NbContact int `bson:"nbContact" json:"nbContact"`
// The probability of contagion via direct contact with an infectious person
ProbaContagionContact float64 `bson:"probaContagionContact" json:"probaContagionContact"`
// The protection factor of mask against contact contagion
MaskProtectContact float64 `bson:"maskProtectContact" json:"maskProtectContact"`
// The protection factor of gel against contact contagion
GelProtectContact float64 `bson:"gelProtectContact" json:"gelProtectContact"`
// The number of persons with indirect contact
NbIndirect int `bson:"nbIndirect" json:"nbIndirect"`
// The probability of contagion via indirect contact with an infectious person
ProbaContagionIndirect float64 `bson:"probaContagionIndirect" json:"probaContagionIndirect"`
// The protection factor of mask against indirect contact contagion
MaskProtectIndirect float64 `bson:"maskProtectIndirect" json:"maskProtectIndirect"`
// The protection factor of gel against indirect contact contagion
GelProtectIndirect float64 `bson:"gelProtectIndirect" json:"gelProtectIndirect"`
// The Pluses of this kind of segment
Pluses []string `bson:"pluses" json:"pluses"`
// The Minuses of this kind of segment
Minuses []string `bson:"minuses" json:"minuses"`
// The Advices of this kind of segment
Advices []string `bson:"advices" json:"advices"`
}
type RiskParameters ¶
type RiskParameters struct {
// Use to splecify that these are the default parameters
IsDefault bool `bson:"default" json:"default"`
// The protection factor of sewn mask
SewnMaskProtect float64 `bson:"sewnMaskProtect" json:"sewnMaskProtect"`
// The protection factor of surgical mask
SurgicalMaskProtect float64 `bson:"surgicalMaskProtect" json:"surgicalMaskProtect"`
// The protection factor of ffpx mask
FFPXMaskProtect float64 `bson:"ffpxMaskProtect" json:"ffpxMaskProtect"`
// The protection factor of hydro alcoholic gel
HydroAlcoholicGelProtect float64 `bson:"hydroAlcoholicGelProtect" json:"hydroAlcoholicGelProtect"`
// The parameters associated with a scope
Parameters []*RiskParameter `bson:"parameters" json:"parameters"`
}
func (*RiskParameters) ByScope ¶
func (r *RiskParameters) ByScope() map[ParameterScope]*RiskParameter
type RiskParametersDAL ¶
type RiskParametersDAL interface {
GetDefault() (*RiskParameters, error)
Insert(p *RiskParameters) error
}
RiskParametersDAL defines the data access layer of risk parameters
type RiskSegment ¶
type RiskSegment struct {
ID RiskSegID `bson:"_id" json:"id"`
*Segment `bson:"segment" json:"segment"`
RiskLevel float64 `bson:"riskLevel" json:"riskLevel"`
ConfidenceLevel float64 `bson:"confidenceLevel" json:"confidenceLevel"`
Report Report `bson:"report" json:"report"`
}
RiskSegment is the risk and the confidence level for a given segment
type Screening ¶
type Screening struct {
ID ScreeningID `bson:"_id" json:"id"`
Department string `bson:"dep" json:"dep"`
NoticeDate time.Time `bson:"noticeDate" json:"noticeDate"`
Count int `bson:"count" json:"count"`
PositiveCount int `bson:"positiveCount" json:"positiveCount"`
PositiveRate int `bson:"positiveRate" json:"positiveRate"`
}
type ScreeningDAL ¶
type ScreeningID ¶
type ScreeningID string
type ScreeningService ¶
type Segment ¶
type Segment struct {
ID SegID `bson:"_id" json:"-"`
Origin *Geo `bson:"origin" json:"origin"`
Destination *Geo `bson:"destination" json:"destination"`
Departure time.Time `bson:"departure" json:"departure"`
Arrival time.Time `bson:"arrival" json:"arrival"`
Transportation Transportation `bson:"transportation" json:"transportation"`
HotelID *string `bson:"hotelID" json:"-"`
}
type Transportation ¶
type Transportation string
const ( TGV Transportation = "tgv" TER Transportation = "ter" Aircraft Transportation = "aircraft" Car Transportation = "car" CarSolo Transportation = "car-solo" CarDuo Transportation = "car-duo" CarGroup Transportation = "car-group" TaxiSolo Transportation = "taxi-solo" TaxiGroup Transportation = "taxi-group" PublicTransports Transportation = "public-transports" Scooter Transportation = "scooter" Bike Transportation = "bike" )
func (*Transportation) Duration ¶
func (t *Transportation) Duration(departure, arrival time.Time) TransportationDuration
type TransportationDuration ¶
type TransportationDuration string
const ( Short TransportationDuration = "short" Normal TransportationDuration = "normal" Long TransportationDuration = "long" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.