Skip to content

Commit

Permalink
update gates lookup to export is current data; update compiled gates …
Browse files Browse the repository at this point in the history
…data; improved docs
  • Loading branch information
thisisaaronland committed Sep 28, 2021
1 parent 8ed85f6 commit ccbe8e3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compile-gates:
go run -mod vendor cmd/compile-gates-data/main.go
2 changes: 1 addition & 1 deletion cmd/lookup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func main() {

lookup_uri := flag.String("lookup-uri", "", "...")
lookup_uri := flag.String("lookup-uri", "", "Valid options are: gates://, galleries://")

flag.Parse()

Expand Down
2 changes: 1 addition & 1 deletion data/gates.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions galleries/galleries.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type Gallery struct {
Inception string `json:"edtf:inception"`
// The (EDTF) cessation date for the gallery
Cessation string `json:"edtf:cessation"`
// A Who's On First "existential" (`KnownUnknownFlag`) flag signaling the gate's status
// IsCurrent string `json:"mz:is_current"`
}

// String() will return the name of the gallery.
Expand Down
7 changes: 7 additions & 0 deletions gates/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ func CompileGatesData(ctx context.Context, iterator_uri string, iterator_sources
wof_id := whosonfirst.Id(f)
name := whosonfirst.Name(f)

fl, err := whosonfirst.IsCurrent(f)

if err != nil {
return fmt.Errorf("Failed to derive is current status for %s, %v", path, err)
}

g := &Gate{
WhosOnFirstId: wof_id,
Name: name,
IsCurrent: fl.StringFlag(),
}

mu.Lock()
Expand Down
8 changes: 7 additions & 1 deletion gates/gates.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// package gates provides methods for working with boarding gates at SFO.
package gates

import (
"fmt"
)

// type Gate is a struct representing a passenger gate at SFO.
type Gate struct {
// The Who's On First ID associated with this gate.
WhosOnFirstId int64 `json:"wof:id"`
// The name of this gate.
Name string `json:"wof:name"`
// A Who's On First "existential" (`KnownUnknownFlag`) flag signaling the gate's status
IsCurrent string `json:"mz:is_current"`
}

// String() will return the name of the gate.
func (g *Gate) String() string {
return g.Name
return fmt.Sprintf("%d %s (%s)", g.WhosOnFirstId, g.Name, g.IsCurrent)
}

0 comments on commit ccbe8e3

Please sign in to comment.