Skip to content

Commit

Permalink
Registre d'arrêts : premiers modèles
Browse files Browse the repository at this point in the history
See #4354.
  • Loading branch information
ptitfred committed Dec 19, 2024
1 parent d1730e6 commit a1d3189
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apps/transport/lib/registry/model/data_source.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule Transport.Registry.Model.DataSource do
@moduledoc """
Common attributes describing a data source.
"""

defstruct [
:id,
:checksum,
:last_updated_at,
:validity_period
]

@type t :: %__MODULE__{
id: data_source_id(),
checksum: binary(),
last_updated_at: DateTime.t(),
validity_period: date_time_range()
}

@type data_source_id :: binary()

@type date_time_range :: binary()
end
57 changes: 57 additions & 0 deletions apps/transport/lib/registry/model/stop.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
defmodule Transport.Registry.Model.StopIdentifier do
@moduledoc """
Representation of a Stop ID.
"""

defstruct [
:id,
:type
]

@type t :: %__MODULE__{
id: binary(),
type: identifier_type()
}

@type identifier_type :: :main | :private_code | :stop_code | :other
end

defmodule Transport.Registry.Model.Stop do
@moduledoc """
Common attributes describing a stop.
"""
alias Transport.Registry.Model.DataSource
alias Transport.Registry.Model.StopIdentifier

defstruct [
:main_id,
:display_name,
:data_source_id,
:data_source_format,
:parent_id,
:latitude,
:longitude,
projection: :utm_wgs84,
stop_type: :stop,
secondary_ids: []
]

@type t :: %__MODULE__{
main_id: StopIdentifier.t(),
display_name: binary(),
data_source_id: DataSource.data_source_id(),
data_source_format: data_source_format_type(),
parent_id: StopIdentifier.t() | nil,
latitude: float(),
longitude: float(),
projection: projection(),
stop_type: stop_type(),
secondary_ids: [StopIdentifier.t()]
}

@type data_source_format_type :: :gtfs | :netex

@type stop_type :: :stop | :quay | :other

@type projection :: :utm_wgs84 | :lambert93_rgf93
end

0 comments on commit a1d3189

Please sign in to comment.