Skip to content

Commit

Permalink
Merge branch 'gates-redux' of github.com:sfomuseum/go-sfomuseum-archi…
Browse files Browse the repository at this point in the history
…tecture
  • Loading branch information
sfomuseumbot committed Jul 26, 2024
2 parents 234b22c + 4eed75e commit add3512
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/compile-galleries-data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {

default_target := fmt.Sprintf("data/%s", galleries.DATA_JSON)

iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=gallery", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=gallery&exclude=properties.edtf:deprecated=.*", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_source := flag.String("iterator-source", "/usr/local/data/sfomuseum-data-architecture", "The URI containing documents to iterate.")

target := flag.String("target", default_target, "The path to write SFO Museum galleries data.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/compile-gates-data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {

default_target := fmt.Sprintf("data/%s", gates.DATA_JSON)

iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=gate", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=gate&exclude=properties.edtf:deprecated=.*", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_source := flag.String("iterator-source", "/usr/local/data/sfomuseum-data-architecture", "The URI containing documents to iterate.")

target := flag.String("target", default_target, "The path to write SFO Museum gates data.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/compile-terminals-data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {

default_target := fmt.Sprintf("data/%s", terminals.DATA_JSON)

iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=terminal", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_uri := flag.String("iterator-uri", "repo://?include=properties.sfomuseum:placetype=terminal&exclude=properties.edtf:deprecated=.*", "A valid whosonfirst/go-whosonfirst-iterate URI")
iterator_source := flag.String("iterator-source", "/usr/local/data/sfomuseum-data-architecture", "The URI containing documents to iterate.")

target := flag.String("target", default_target, "The path to write SFO Museum terminals data.")
Expand Down
7 changes: 6 additions & 1 deletion data/galleries.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion data/gates.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion data/terminals.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions galleries/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"strings"
"sync"

"github.com/tidwall/gjson"
Expand All @@ -29,6 +30,10 @@ func CompileGalleriesData(ctx context.Context, iterator_uri string, iterator_sou
// pass
}

if strings.HasSuffix(path, "~") {
return nil
}

_, uri_args, err := uri.ParseURI(path)

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions galleries/galleries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package galleries

import (
"context"
"log/slog"
"testing"
// "log/slog"
)

type galleryTest struct {
Expand Down Expand Up @@ -37,7 +37,7 @@ func TestFindCurrentGallery(t *testing.T) {

func TestFindGalleryForDate(t *testing.T) {

// slog.SetLogLoggerLevel(slog.LevelDebug)
slog.SetLogLoggerLevel(slog.LevelDebug)

tests := []*galleryTest{
&galleryTest{Id: 1763594985, Code: "2E", Date: "2022"},
Expand Down
5 changes: 5 additions & 0 deletions gates/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"strings"
"sync"

"github.com/whosonfirst/go-whosonfirst-feature/properties"
Expand All @@ -28,6 +29,10 @@ func CompileGatesData(ctx context.Context, iterator_uri string, iterator_sources
// pass
}

if strings.HasSuffix(path, "~") {
return nil
}

_, uri_args, err := uri.ParseURI(path)

if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions gates/gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ func FindAllGatesForDateWithLookup(ctx context.Context, lookup architecture.Look
}

if !is_between {
slog.Debug("Gate does not match date conditions", "code", code, "date", date, "gate", g.Name, "inception", inception, "cessation", cessation)
slog.Debug("Gate does not match date conditions", "id", g.WhosOnFirstId, "code", code, "date", date, "gate", g.Name, "inception", inception, "cessation", cessation)
continue
}

slog.Debug("Gate DOES match date conditions", "code", code, "date", date, "gate", g.Name, "inception", inception, "cessation", cessation)
slog.Debug("Gate DOES match date conditions", "id", g.WhosOnFirstId, "code", code, "date", date, "gate", g.Name, "inception", inception, "cessation", cessation)

gates = append(gates, g)
break
}
Expand Down
9 changes: 6 additions & 3 deletions gates/gates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gates

import (
"context"
_ "log/slog"
"log/slog"
"testing"
)

Expand Down Expand Up @@ -40,11 +40,14 @@ func TestFindCurrentGate(t *testing.T) {

func TestFindGateForDate(t *testing.T) {

// slog.SetLogLoggerLevel(slog.LevelDebug)
slog.SetLogLoggerLevel(slog.LevelDebug)

tests := []*gateTest{
&gateTest{Id: 1763588201, Code: "B25", Date: "2021-11-09"},
&gateTest{Id: 1745882165, Code: "B25", Date: "2021-11-09"},
&gateTest{Id: 1914600935, Code: "E13", Date: "2024-07-23"},
&gateTest{Id: 1914601021, Code: "A11", Date: "2024-07-25"},
&gateTest{Id: 1763588293, Code: "F5", Date: "2022"},
&gateTest{Id: 1930457221, Code: "F5", Date: "2024-07-25"},
}

ctx := context.Background()
Expand Down
4 changes: 4 additions & 0 deletions terminals/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func CompileTerminalsData(ctx context.Context, iterator_uri string, iterator_sou
// pass
}

if strings.HasSuffix(path, "~") {
return nil
}

_, uri_args, err := uri.ParseURI(path)

if err != nil {
Expand Down
1 change: 0 additions & 1 deletion terminals/terminals.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package terminals
import (
"context"
"fmt"

"log/slog"

"github.com/sfomuseum/go-edtf/cmp"
Expand Down
5 changes: 2 additions & 3 deletions terminals/terminals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package terminals

import (
"context"
"log/slog"
"testing"
// "log/slog"
)

type terminalTest struct {
Expand All @@ -15,7 +15,6 @@ type terminalTest struct {
func TestFindCurrentTerminal(t *testing.T) {

tests := map[string]int64{
// "T2": 1763588123,
"T2": 1914601345,
}

Expand All @@ -37,7 +36,7 @@ func TestFindCurrentTerminal(t *testing.T) {

func TestFindTerminalForDate(t *testing.T) {

// slog.SetLogLoggerLevel(slog.LevelDebug)
slog.SetLogLoggerLevel(slog.LevelDebug)

tests := []*terminalTest{
&terminalTest{Id: 1763588123, Code: "T2", Date: "2023"},
Expand Down

0 comments on commit add3512

Please sign in to comment.