grocery

package
v0.0.0-...-83beb85 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stores = aspect.Table("grocery_stores",
	aspect.Column("id", postgres.Serial{PrimaryKey: true}),
	aspect.Column("name", aspect.String{}),
	aspect.Column("type", aspect.String{}),
	aspect.Column("phone", aspect.String{}),
	aspect.Column("hours", aspect.String{}),
	aspect.Column("accepts_snap", aspect.Boolean{}),
	aspect.Column("sic", aspect.Integer{}),
	aspect.Column("naics", aspect.Integer{}),
	aspect.Column("sales_volume", aspect.Integer{}),
	aspect.Column("branch_status", aspect.String{}),
	aspect.Column("employees", aspect.Integer{}),
	aspect.Column("franchise", aspect.String{}),
	aspect.Column("square_footage", aspect.String{}),
	aspect.Column("latitude", aspect.Real{}),
	aspect.Column("longitude", aspect.Real{}),
	aspect.Column("address", aspect.String{}),
	aspect.Column("address_line1", aspect.String{}),
	aspect.Column("address_line2", aspect.String{}),
	aspect.Column("city", aspect.String{}),
	aspect.Column("state", aspect.String{}),
	aspect.Column("zip", aspect.String{}),
	aspect.Column("location", postgis.Geometry{postgis.Point{}, 4326}),
)

Functions

func ParseFoodStoresCSV

func ParseFoodStoresCSV(path string) (stores []rawStore, err error)

ParseFoodStoresCSV parses the CSV downloaded from data.denvergov.org: http://data.denvergov.org/dataset/city-and-county-of-denver-food-stores The rawStore is just strings because there are too many empty fields throughout the food stores CSV to enforce schema.

Types

type Store

type Store struct {
	Name          string
	Type          string
	Phone         string
	Hours         string
	AcceptsSnap   bool
	SIC           int64
	NAICS         int64
	SalesVolume   int64
	BranchStatus  string
	Employees     int64
	Franchise     string
	SquareFootage string
	Latitude      float64
	Longitude     float64
	Address       string
	AddressLine1  string
	AddressLine2  string
	City          string
	State         string
	ZIP           string
}

func ConvertRawStore

func ConvertRawStore(raw rawStore) (store Store, err error)

ConvertRawStore enforces types on a rawStore and returns a Store. It will error if any of the following fields are missing (which they may be in a regular CSV download): * Latitude or longitude * Name * Address

func ConvertRawStores

func ConvertRawStores(raws []rawStore) ([]Store, error)

ConvertRawStores will convert all the given rawStores to Stores. It will return on any error.

func ConvertRawStoresDropErrors

func ConvertRawStoresDropErrors(raws []rawStore) []Store

ConvertRawStores will convert the given rawStores to Stores, dropping any that error.

func ParseConvertedStoresCSV

func ParseConvertedStoresCSV(path string) (stores []Store, err error)

ParseFoodStoresCSV parses the CSV generated by converting the raw download.

type StoreWithId

type StoreWithId struct {
	Id            int64   `json:"id"`
	Name          string  `json:"name"`
	Type          string  `json:"type"`
	Phone         string  `json:"phone"`
	Hours         string  `json:"hours"`
	AcceptsSnap   bool    `json:"accepts_snap"`
	SIC           int64   `json:"SIC"`
	NAICS         int64   `json:"NAICS"`
	SalesVolume   int64   `json:"sales_volume"`
	BranchStatus  string  `json:"branch_status"`
	Employees     int64   `json:"employees"`
	Franchise     string  `json:"franchise"`
	SquareFootage string  `json:"square_footage"`
	Latitude      float64 `json:"latitude"`
	Longitude     float64 `json:"longitude"`
	Address       string  `json:"address"`
	AddressLine1  string  `json:"address_line_1"`
	AddressLine2  string  `json:"address_line_2"`
	City          string  `json:"city"`
	State         string  `json:"state"`
	ZIP           string  `json:"zip"`
}

type StoresAPI

type StoresAPI struct {
	// contains filtered or unexported fields
}

func NewStoresAPI

func NewStoresAPI(db *aspect.DB) *StoresAPI

func (*StoresAPI) Get

func (api *StoresAPI) Get(parameters url.Values) argo.Response

Jump to

Keyboard shortcuts

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