Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ID and URL paths to use full city name and state two letter code #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/data/auburn_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ func (c *Client) AuburnOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: date.Format("2006-01-02"),
Name: "Auburn PD",
ID: "apd",
ID: "auburn-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/auburn/officer",
Path: "/auburn-wa/officer",
QueryParams: []string{"badge", "first_name", "last_name"},
},
"fuzzy": {
Path: "/auburn/officer/search",
Path: "/auburn-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/bellevue_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ func (c *Client) BellevueOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: "2021-05-01",
Name: "Bellevue PD",
ID: "bpd",
ID: "bellevue-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/bellevue/officer",
Path: "/bellevue-wa/officer",
QueryParams: []string{"badge", "first_name", "last_name"},
},
"fuzzy": {
Path: "/bellevue/officer/search",
Path: "/bellevue-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/lakewood_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func (c *Client) LakewoodOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: date.Format("2006-01-02"),
Name: "Lakewood PD",
ID: "lpd",
ID: "lakewood-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/lakewood/officer",
Path: "/lakewood-wa/officer",
QueryParams: []string{"first_name", "last_name"},
},
"fuzzy": {
Path: "/lakewood/officer/search",
Path: "/lakewood-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/olympia_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func (c *Client) OlympiaOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: date.Format("2006-01-02"),
Name: "Olympia PD",
ID: "opd",
ID: "olympia-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/olympia/officer",
Path: "/olympia-wa/officer",
QueryParams: []string{"badge", "first_name", "last_name"},
},
"fuzzy": {
Path: "/olympia/officer/search",
Path: "/olympia-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/port_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ func (c *Client) PortOfSeattleOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: "2021-05-01",
Name: "Port Of Seattle PD",
ID: "pospd",
ID: "port_of_seattle-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/port_of_seattle/officer",
Path: "/port_of_seattle-wa/officer",
QueryParams: []string{"badge", "name"},
},
"fuzzy": {
Path: "/port_of_seattle/officer/search",
Path: "/port_of_seattle-wa/officer/search",
QueryParams: []string{"name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/portland_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ func (c *Client) PortlandOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: max_date.Format("2006-01-02"),
Name: "Portland PB",
ID: "ppb",
ID: "portland-or",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/portland/officer",
Path: "/portland-or/officer",
QueryParams: []string{"badge", "first_name", "last_name", "employee_id", "helmet_id", "helmet_id_three_digit"},
},
"fuzzy": {
Path: "/portland/officer/search",
Path: "/portland-or/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/renton_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ func (c *Client) RentonOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: "2021-05-01",
Name: "Renton PD",
ID: "rpd",
ID: "renton-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/renton/officer",
Path: "/renton-wa/officer",
QueryParams: []string{"first_name", "last_name"},
},
"fuzzy": {
Path: "/renton/officer/search",
Path: "/renton-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
8 changes: 4 additions & 4 deletions api/data/seattle_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ func (c *Client) SeattleOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: date.Format("2006-01-02"),
Name: "Seattle PD",
ID: "spd",
ID: "seattle-wa",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we'll also need to update 1-312 with this new ID here: https://github.com/OrcaCollective/1-312-hows-my-driving/blob/main/src/app.py#L106

SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/seattle/officer",
Path: "/seattle-wa/officer",
QueryParams: []string{"badge", "first_name", "last_name"},
},
"fuzzy": {
Path: "/seattle/officer/search",
Path: "/seattle-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
"historical-exact": {
Path: "/seattle/officer/historical",
Path: "/seattle-wa/officer/historical",
QueryParams: []string{"badge"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/tacoma_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ func (c *Client) TacomaOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: "2019",
Name: "Tacoma PD",
ID: "tpd",
ID: "tacoma-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/tacoma/officer",
Path: "/tacoma-wa/officer",
QueryParams: []string{"first_name", "last_name"},
},
"fuzzy": {
Path: "/tacoma/officer/search",
Path: "/tacoma-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
6 changes: 3 additions & 3 deletions api/data/thurston_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ func (c *Client) ThurstonCountyOfficerMetadata() *DepartmentMetadata {
},
LastAvailableRosterDate: "2021-05-01",
Name: "Thurston County Sheriff's Department",
ID: "tcsd",
ID: "thurston_county-wa",
SearchRoutes: map[string]*SearchRouteMetadata{
"exact": {
Path: "/thurston_county/officer",
Path: "/thurston_county-wa/officer",
QueryParams: []string{"first_name", "last_name"},
},
"fuzzy": {
Path: "/thurston_county/officer/search",
Path: "/thurston_county-wa/officer/search",
QueryParams: []string{"first_name", "last_name"},
},
},
Expand Down
42 changes: 42 additions & 0 deletions api/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,48 @@ func NewRouter(h handler.Interface) http.Handler {
router.HandleFunc("/ping", h.Ping).Methods("GET")
router.HandleFunc("/departments", h.DescribeDepartments).Methods("GET")

router.HandleFunc("/seattle-wa/metadata", h.SeattleOfficerMetadata).Methods("GET")
router.HandleFunc("/seattle-wa/officer", h.SeattleStrictMatch).Methods("GET")
router.HandleFunc("/seattle-wa/officer/search", h.SeattleFuzzySearch).Methods("GET")
router.HandleFunc("/seattle-wa/officer/historical", h.SeattleStrictMatchHistorical).Methods("GET")

router.HandleFunc("/tacoma-wa/metadata", h.TacomaOfficerMetadata).Methods("GET")
router.HandleFunc("/tacoma-wa/officer", h.TacomaStrictMatch).Methods("GET")
router.HandleFunc("/tacoma-wa/officer/search", h.TacomaFuzzySearch).Methods("GET")

router.HandleFunc("/portland-or/metadata", h.PortlandOfficerMetadata).Methods("GET")
router.HandleFunc("/portland-or/officer", h.PortlandStrictMatch).Methods("GET")
router.HandleFunc("/portland-or/officer/search", h.PortlandFuzzySearch).Methods("GET")

router.HandleFunc("/auburn-wa/metadata", h.AuburnOfficerMetadata).Methods("GET")
router.HandleFunc("/auburn-wa/officer", h.AuburnStrictMatch).Methods("GET")
router.HandleFunc("/auburn-wa/officer/search", h.AuburnFuzzySearch).Methods("GET")

router.HandleFunc("/lakewood-wa/metadata", h.LakewoodOfficerMetadata).Methods("GET")
router.HandleFunc("/lakewood-wa/officer", h.LakewoodStrictMatch).Methods("GET")
router.HandleFunc("/lakewood-wa/officer/search", h.LakewoodFuzzySearch).Methods("GET")

router.HandleFunc("/bellevue-wa/metadata", h.BellevueOfficerMetadata).Methods("GET")
router.HandleFunc("/bellevue-wa/officer", h.BellevueStrictMatch).Methods("GET")
router.HandleFunc("/bellevue-wa/officer/search", h.BellevueFuzzySearch).Methods("GET")

router.HandleFunc("/port_of_seattle-wa/metadata", h.PortOfSeattleOfficerMetadata).Methods("GET")
router.HandleFunc("/port_of_seattle-wa/officer", h.PortOfSeattleStrictMatch).Methods("GET")
router.HandleFunc("/port_of_seattle-wa/officer/search", h.PortOfSeattleFuzzySearch).Methods("GET")

router.HandleFunc("/thurston_county-wa/metadata", h.ThurstonCountyOfficerMetadata).Methods("GET")
router.HandleFunc("/thurston_county-wa/officer", h.ThurstonCountyStrictMatch).Methods("GET")
router.HandleFunc("/thurston_county-wa/officer/search", h.ThurstonCountyFuzzySearch).Methods("GET")

router.HandleFunc("/renton-wa/metadata", h.RentonOfficerMetadata).Methods("GET")
router.HandleFunc("/renton-wa/officer", h.RentonStrictMatch).Methods("GET")
router.HandleFunc("/renton-wa/officer/search", h.RentonFuzzySearch).Methods("GET")

router.HandleFunc("/olympia-wa/metadata", h.OlympiaOfficerMetadata).Methods("GET")
router.HandleFunc("/olympia-wa/officer", h.OlympiaStrictMatch).Methods("GET")
router.HandleFunc("/olympia-wa/officer/search", h.OlympiaFuzzySearch).Methods("GET")

// Backwards compatability routes, don't change
router.HandleFunc("/seattle/metadata", h.SeattleOfficerMetadata).Methods("GET")
router.HandleFunc("/seattle/officer", h.SeattleStrictMatch).Methods("GET")
router.HandleFunc("/seattle/officer/search", h.SeattleFuzzySearch).Methods("GET")
Expand Down