Documentation
¶
Index ¶
- Constants
- func DownloadFile(url string, filepath string) error
- func ExtractKMLFile(src string, dst string) error
- func GetMunicipalityPolygons() map[string][][][]float64
- func MakeWFSGetRequest(baseUrl string, request string, params map[string]string) ([]byte, error)
- func MakeWFSPostRequest(baseUrl string, body string, params map[string]string) ([]byte, error)
- func ParseSeverity(severity string) event.DangerLevel
- func ParseUrgency(urgency string) event.UrgencyType
- func ToGetParams(params map[string]string) string
- func UpdateAll(db *clover.DB) error
- func UpdateFromSource(db *clover.DB, source EventSource) ([]event.Event, error)
- type DQCSecurityEventSource
- type DQCWeatherEventSource
- type EventSource
- type Geometry
- type HQCOutageEventSource
- func (source HQCOutageEventSource) DownloadKmlFile(bisVersion string) error
- func (source HQCOutageEventSource) GetAllEvents() ([]event.Event, error)
- func (source HQCOutageEventSource) GetLatestBis() (string, error)
- func (source HQCOutageEventSource) GetName() string
- func (source HQCOutageEventSource) GetNewEventsFromDate(date time.Time) ([]event.Event, error)
- func (source HQCOutageEventSource) GetOutageAreas(bisVersion string) error
- func (source HQCOutageEventSource) GetOutageEvents(bisVersion string) ([]event.Event, error)
- type KML
- type KMLDocument
- type KMLPlacemark
- type ListePannes
- type Panne
- type SecurityFeature
- type SecurityFeatureCollection
- type SecurityProperties
- type WFSSearch
- type WeatherFeature
- type WeatherFeatureCollection
- type WeatherProperties
Constants ¶
View Source
const ( DQC_SECURITY_NAME = "DonnéesQC Security" DQC_SECURITY_URL = "http://geoegl.msp.gouv.qc.ca/apis/wss/historiquesc.fcgi" DQC_START_YEAR = 2024 )
View Source
const ( DQC_WEATHER_NAME = "DonnéesQC Weather" DQC_WEATHER_URL = "https://geoegl.msp.gouv.qc.ca/ws/igo_gouvouvert.fcgi" )
View Source
const ( HQC_URL = "http://pannes.hydroquebec.com/pannes/donnees/v3_0" HQC_TIME_FMT = "2006-01-02 15:04:05" HQC_OUTAGE_NAME = "Hydro-Québec Outage" )
View Source
const ( DQC_VERSION = "2.0.0" DQC_TIME_FMT = "2006/01/02 15:04" DQC_DATE_FMT = "2006-01-02" )
View Source
const MUN_POLYGONS_FILE = "munic_polygons/switchedCoordinatesMunPolygons.json"
View Source
const SYSTEM_USER_GUID = "dcf54266-549e-4546-9431-872f2d2fe8b3"
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
func ExtractKMLFile ¶
func GetMunicipalityPolygons ¶
func MakeWFSGetRequest ¶
func MakeWFSPostRequest ¶
func ParseSeverity ¶
func ParseSeverity(severity string) event.DangerLevel
func ParseUrgency ¶
func ParseUrgency(urgency string) event.UrgencyType
func ToGetParams ¶
func UpdateFromSource ¶
func UpdateFromSource(db *clover.DB, source EventSource) ([]event.Event, error)
Types ¶
type DQCSecurityEventSource ¶
type DQCSecurityEventSource struct{}
func (DQCSecurityEventSource) GetAllEvents ¶
func (source DQCSecurityEventSource) GetAllEvents() ([]event.Event, error)
func (DQCSecurityEventSource) GetName ¶
func (source DQCSecurityEventSource) GetName() string
func (DQCSecurityEventSource) GetNewEventsFromDate ¶
type DQCWeatherEventSource ¶
type DQCWeatherEventSource struct{}
func (DQCWeatherEventSource) GetAllEvents ¶
func (source DQCWeatherEventSource) GetAllEvents() ([]event.Event, error)
func (DQCWeatherEventSource) GetName ¶
func (source DQCWeatherEventSource) GetName() string
func (DQCWeatherEventSource) GetNewEventsFromDate ¶
type EventSource ¶
type EventSource interface { GetName() string GetAllEvents() ([]event.Event, error) //TODO: Incremental load with cron GetNewEventsFromDate(date time.Time) ([]event.Event, error) }
func GetEventSourceByName ¶
func GetEventSourceByName(name string) EventSource
func GetEventSources ¶
func GetEventSources() []EventSource
type HQCOutageEventSource ¶
type HQCOutageEventSource struct{}
func (HQCOutageEventSource) DownloadKmlFile ¶
func (source HQCOutageEventSource) DownloadKmlFile(bisVersion string) error
TODO: Need to cleanup old KML files
func (HQCOutageEventSource) GetAllEvents ¶
func (source HQCOutageEventSource) GetAllEvents() ([]event.Event, error)
func (HQCOutageEventSource) GetLatestBis ¶
func (source HQCOutageEventSource) GetLatestBis() (string, error)
func (HQCOutageEventSource) GetName ¶
func (source HQCOutageEventSource) GetName() string
func (HQCOutageEventSource) GetNewEventsFromDate ¶
https://www.hydroquebec.com/documents-donnees/donnees-ouvertes/pannes-interruptions.html
func (HQCOutageEventSource) GetOutageAreas ¶
func (source HQCOutageEventSource) GetOutageAreas(bisVersion string) error
func (HQCOutageEventSource) GetOutageEvents ¶
func (source HQCOutageEventSource) GetOutageEvents(bisVersion string) ([]event.Event, error)
type KML ¶
type KML struct { XMLName xml.Name `xml:"kml"` XMLNS string `xml:"xmlns,attr"` GX string `xml:"gx,attr"` Document KMLDocument `xml:"Document"` }
func LoadKmlFile ¶
type KMLDocument ¶
type KMLDocument struct { XMLName xml.Name `xml:"Document"` Placemark []KMLPlacemark `xml:"Placemark"` }
type KMLPlacemark ¶
type ListePannes ¶
type ListePannes struct {
Pannes []Panne `json:"pannes"`
}
type Panne ¶
type Panne struct { NbAffectes int DateDebut time.Time DateFinPrevue time.Time CoordX float64 CoordY float64 Statut string Cause string }
func (*Panne) UnmarshalJSON ¶
type SecurityFeature ¶
type SecurityFeature struct { Id int32 `json:"id"` Type string `json:"type"` Properties SecurityProperties `json:"properties"` Geometry mapobject.Geometry `json:"geometry"` }
func (SecurityFeature) GetDanger ¶
func (f SecurityFeature) GetDanger() event.DangerLevel
func (SecurityFeature) GetSeverity ¶
func (f SecurityFeature) GetSeverity() event.UrgencyType
calculate based on date?
type SecurityFeatureCollection ¶
type SecurityFeatureCollection struct { Name string `json:"name"` Type string `json:"type"` Features []SecurityFeature `json:"features"` }
type SecurityProperties ¶
type SecurityProperties struct { Code_alea int32 `json:"code_alea"` Alea string `json:"alea"` Code_municipalite string `json:"code_municipalite"` Municipalite string `json:"municipalite"` Precision_localisation string `json:"precision_localisation"` Info_compl_localisation string `json:"info_compl_localisation"` Severite string `json:"severite"` Date_signalement string `json:"date_signalement"` Date_debut string `json:"date_debut"` Date_debut_imprecise string `json:"date_debut_imprecise"` Commentaire_date_debut string `json:"commentaire_date_debut"` Date_fin string `json:"date_fin"` Coord_x float32 `json:"coord_x"` Coord_y float32 `json:"coord_y"` }
type WFSSearch ¶
type WFSSearch struct { LogicalOperator string PropertyName string PropertyValue string TypeName string }
func (WFSSearch) ToSecuritySearchPayload ¶
type WeatherFeature ¶
type WeatherFeature struct { FeatureType string `json:"type"` Properties WeatherProperties `json:"properties"` Geometry mapobject.Geometry `json:"geometry"` }
type WeatherFeatureCollection ¶
type WeatherFeatureCollection struct { Name string `json:"name"` CollectionType string `json:"type"` Features []WeatherFeature `json:"features"` }
type WeatherProperties ¶
type WeatherProperties struct { Nom string `json:"nom"` Source string `json:"source"` Territoire string `json:"territoire"` Certitude string `json:"certitude"` Severite string `json:"severite"` Date_mise_a_jour string `json:"date_mise_a_jour"` Id_alerte string `json:"id_alerte"` Urgence string `json:"urgence"` Description string `json:"description"` Type string `json:"type"` }
Click to show internal directories.
Click to hide internal directories.