Documentation
¶
Index ¶
- Variables
- func ById(ls []License) (byId map[string]License)
- func NormalizedHeader() []string
- func ParseHearingsHTML(content []byte) (hearings []rawHearing, err error)
- func ParseTimestamp(input string) (time.Time, error)
- type ByUniqueId
- type Change
- type Hearing
- type HearingsAPI
- type License
- type LicensesAPI
- type OrderedLicenses
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UnexpectedLength = errors.New("liquor: unexpected csv row length") UnparsableTimestamp = errors.New("liquor: unparsable timestamp") UnparsableCoordinate = errors.New("liquor: unparsable coordinate") )
View Source
var Hearings = aspect.Table("hearings", aspect.Column("id", aspect.Integer{PrimaryKey: true}), aspect.Column("notice_link", aspect.String{}), aspect.Column("name", aspect.String{}), aspect.Column("address", aspect.String{}), aspect.Column("latitude", aspect.Real{}), aspect.Column("longitude", aspect.Real{}), aspect.Column("time", aspect.Timestamp{}), aspect.Column("outcome", aspect.String{}), aspect.Column("location", postgis.Geometry{postgis.Point{}, 4326}), )
View Source
var Licenses = aspect.Table("licenses", aspect.Column("id", aspect.String{PrimaryKey: true}), aspect.Column("bfn", aspect.String{}), aspect.Column("license", aspect.String{}), aspect.Column("name", aspect.String{}), aspect.Column("address", aspect.String{}), aspect.Column("code", aspect.String{}), aspect.Column("category", aspect.String{}), aspect.Column("license_name", aspect.String{}), aspect.Column("description", aspect.String{}), aspect.Column("issued", aspect.Timestamp{WithTimezone: true}), aspect.Column("expires", aspect.Timestamp{WithTimezone: true}), aspect.Column("status", aspect.String{}), aspect.Column("add_id", aspect.String{}), aspect.Column("external_address_id", aspect.String{}), aspect.Column("police_district", aspect.String{}), aspect.Column("council_district", aspect.String{}), aspect.Column("census_tract", aspect.String{}), aspect.Column("override", aspect.String{}), aspect.Column("longitude", aspect.Real{}), aspect.Column("latitude", aspect.Real{}), aspect.Column("location", postgis.Geometry{postgis.Point{}, 4326}), )
Functions ¶
func NormalizedHeader ¶
func NormalizedHeader() []string
func ParseHearingsHTML ¶
Types ¶
type ByUniqueId ¶
type ByUniqueId struct {
OrderedLicenses
}
type Hearing ¶
type Hearing struct { Id int64 `json:"id"` NoticeLink string `json:"notice_link"` Name string `json:"name"` Address string `json:"address"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Time time.Time `json:"time"` Outcome string `json:"outcome"` }
Hearing is a public hearing with a time and location
func ParseHearingsJSON ¶
type HearingsAPI ¶
type HearingsAPI struct {
// contains filtered or unexported fields
}
func NewHearingsAPI ¶
func NewHearingsAPI(db *aspect.DB) *HearingsAPI
type License ¶
type License struct { UniqueId string `db:"id" json:"id"` BFN string `db:"bfn" json:"-"` LicenseId string `db:"license" json:"-"` Name string `db:"name" json:"name"` Address string `db:"address" json:"address"` Code string `db:"code" json:"-"` Category string `db:"category" json:"type"` LicenseName string `db:"license_name" json:"-"` Description string `db:"description" json:"-"` Issued time.Time `db:"issued" json:"issued" csv:"2006-01-02"` Expires time.Time `db:"expires" json:"expires" csv:"2006-01-02"` Status string `db:"status" json:"status"` AddId string `db:"add_id" json:"-"` ExtAddId string `db:"external_address_id" json:"-"` Police string `db:"police_district" json:"-"` Council string `db:"council_district" json:"-"` Census string `db:"census_tract" json:"-"` Override string `db:"override" json:"-"` Xcoord float64 `db:"longitude" json:"longitude"` Ycoord float64 `db:"latitude" json:"latitude"` }
func Normalize ¶
Normalize will: * Remove duplicate unique ids * Convert the Colorado state plane coordinates to latitude and longitude * Sort the licenses by unique id
func ParseLicense ¶
func ParseLicensesCSV ¶
func StatePlaneToLatLong ¶
Convert an array of licenses to latitude and longitude
func (License) Equals ¶
Are the two licenses equal? TODO There's not a better way to do this - use reflect deep equals
func (License) NormalizedCSV ¶
The normalized CSV output increases the number of significant digits for the x and y coords, since they are now latitude and longitudes
type LicensesAPI ¶
type LicensesAPI struct {
// contains filtered or unexported fields
}
func NewLicensesAPI ¶
func NewLicensesAPI(db *aspect.DB) *LicensesAPI
type OrderedLicenses ¶
type OrderedLicenses []License
func (OrderedLicenses) Len ¶
func (a OrderedLicenses) Len() int
Implement the sort.Interface for sorting
func (OrderedLicenses) Sort ¶
func (a OrderedLicenses) Sort()
func (OrderedLicenses) Swap ¶
func (a OrderedLicenses) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.