Skip to content

Commit

Permalink
Mise à jour opérateurs GBFS (#4418)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineAugusti authored Jan 20, 2025
1 parent 4897113 commit 4f80099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/transport/priv/gbfs_operators.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ url;operator
example.com;Example
api.cyclocity.fr;JC Decaux
api.saint-etienne-metropole.fr;Fifteen
backend.citiz.fr;Citiz
bdx.mecatran.com;Cykleo
bird.co;Bird
clermontferrand.publicbikesystem.net;Citybike
Expand All @@ -16,12 +17,11 @@ fifteen.site;Fifteen
getapony.com;Pony
lime.bike;Lime
media.ilevia.fr/opendata;Cykleo
mobi-iti-nam.okina.fr/api-proxy/api/gbfs/1.0/gbfs/velibeo_ecovelo/gbfs;Ecovélo
mobi-iti-nam.okina.fr/api-proxy/api/gbfs/1.0/gbfs/perivelo_ecovelo/gbfs;Ecovélo
nextbike.net;nextbike
smovengo.cloud;Fifteen
urbansharing.com/lovelolibreservice.fr;Citybike
voiapp.io;Voi
zoov.eu;Fifteen
zoov.io;Fifteen
zoov.site;Fifteen
_ecovelo/gbfs;Ecovélo
10 changes: 9 additions & 1 deletion apps/transport/test/transport/csv_documents_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ defmodule Transport.CSVDocumentsTest do
# Check `operator` values. Prevent typos and ensure unique values.
# Detect things like `Cykleo` VS `Cykléo`.
for x <- operators, y <- operators, x != y do
assert String.jaro_distance(x, y) <= 0.75, "#{x} and #{y} look too similar. Is it the same operator?"
error_message = "#{x} and #{y} look too similar. Is it the same operator?"
assert String.jaro_distance(x, y) <= 0.75 || distinct_operators?(x, y), error_message
end

# Check `url` values. Make sure there is at most a single match per GBFS feed.
Expand All @@ -43,4 +44,11 @@ defmodule Transport.CSVDocumentsTest do
refute String.contains?(x, y), "#{x} is contained #{y}. A GBFS feed can only match for a single URL."
end
end

def distinct_operators?(x, y) do
[
["Citiz", "Citybike"]
]
|> Enum.member?(Enum.sort([x, y]))
end
end

0 comments on commit 4f80099

Please sign in to comment.