diff --git a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java index 7e09f71b770..7eaf80e1675 100644 --- a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java +++ b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java @@ -22,7 +22,7 @@ public class RJSInfra { .build() .adapter(RJSInfra.class); - public static final transient String CURRENT_VERSION = "3.4.1"; + public static final transient String CURRENT_VERSION = "3.4.2"; /** The version of the infra format used */ public String version; diff --git a/editoast/map_layers.yml b/editoast/map_layers.yml index f7aa9d170f6..c15ec274bda 100644 --- a/editoast/map_layers.yml +++ b/editoast/map_layers.yml @@ -46,7 +46,7 @@ layers: joins: - inner join infra_object_speed_section speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id where: - - not (speed_section.data @? '$.extensions.lpv_sncf.z') + - not (speed_section.data @? '$.extensions.psl_sncf.z') sch: on_field: schematic cache_duration: 3600 @@ -54,9 +54,9 @@ layers: joins: - inner join infra_object_speed_section speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id where: - - not (speed_section.data @? '$.extensions.lpv_sncf.z') + - not (speed_section.data @? '$.extensions.psl_sncf.z') - lpv: + psl: table_name: infra_layer_speed_section id_field: id views: @@ -67,7 +67,7 @@ layers: joins: - inner join infra_object_speed_section speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id where: - - speed_section.data @? '$.extensions.lpv_sncf.z' + - speed_section.data @? '$.extensions.psl_sncf.z' sch: on_field: schematic cache_duration: 3600 @@ -75,7 +75,7 @@ layers: joins: - inner join infra_object_speed_section speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id where: - - speed_section.data @? '$.extensions.lpv_sncf.z' + - speed_section.data @? '$.extensions.psl_sncf.z' track_section_links: table_name: infra_layer_track_section_link @@ -179,8 +179,8 @@ layers: joins: - inner join infra_object_catenary catenary on catenary.obj_id = layer.obj_id and catenary.infra_id = layer.infra_id - lpv_panels: - table_name: infra_layer_lpv_panel + psl_signs: + table_name: infra_layer_psl_sign id_field: id views: geo: diff --git a/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/down.sql b/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/down.sql new file mode 100644 index 00000000000..5fa77bdb66e --- /dev/null +++ b/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/down.sql @@ -0,0 +1,9 @@ +alter table infra alter column railjson_version set default '3.4.1'; + +update infra set railjson_version = '3.4.1'; + +alter table infra_layer_psl_sign rename to infra_layer_lpv_panel; + +update infra_object_speed_section set data['extensions']['lpv_sncf'] = data['extensions']['psl_sncf']; + +update infra_object_speed_section set data['extensions'] = data['extensions'] - 'psl_sncf'; diff --git a/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/up.sql b/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/up.sql new file mode 100644 index 00000000000..19c6ec7cfbe --- /dev/null +++ b/editoast/migrations/2023-09-15-135824_lpv_to_psl_and_panel_to_sign/up.sql @@ -0,0 +1,9 @@ +alter table infra alter column railjson_version set default '3.4.2'; + +update infra set railjson_version = '3.4.2'; + +alter table infra_layer_lpv_panel rename to infra_layer_psl_sign; + +update infra_object_speed_section set data['extensions']['psl_sncf'] = data['extensions']['lpv_sncf']; + +update infra_object_speed_section set data['extensions'] = data['extensions'] - 'lpv_sncf'; diff --git a/editoast/src/generated_data/error/speed_sections.rs b/editoast/src/generated_data/error/speed_sections.rs index fbf790b68a5..df529fd9868 100644 --- a/editoast/src/generated_data/error/speed_sections.rs +++ b/editoast/src/generated_data/error/speed_sections.rs @@ -88,8 +88,8 @@ pub fn check_overlapping(infra_cache: &InfraCache, _: &Graph) -> Vec // Iterate over all the speed sections insure we don't report duplicated errors for speed_section in infra_cache.speed_sections().values() { let speed_section = speed_section.unwrap_speed_section(); - // Ignore LPV (they can overlap) - if speed_section.extensions.lpv_sncf.is_some() { + // Ignore PSL (they can overlap) + if speed_section.extensions.psl_sncf.is_some() { continue; } for track_range in speed_section.track_ranges.iter() { diff --git a/editoast/src/generated_data/mod.rs b/editoast/src/generated_data/mod.rs index 7271236b184..51aaefe34b8 100644 --- a/editoast/src/generated_data/mod.rs +++ b/editoast/src/generated_data/mod.rs @@ -4,9 +4,9 @@ mod buffer_stop; mod catenary; mod detector; mod error; -mod lpv_panel; mod neutral_section; mod operational_point; +mod psl_sign; mod signal; mod speed_section; mod switch; @@ -18,9 +18,9 @@ use buffer_stop::BufferStopLayer; use catenary::CatenaryLayer; use detector::DetectorLayer; use error::ErrorLayer; -use lpv_panel::LPVPanelLayer; use neutral_section::NeutralSectionLayer; use operational_point::OperationalPointLayer; +use psl_sign::PSLSignLayer; use signal::SignalLayer; use speed_section::SpeedSectionLayer; use switch::SwitchLayer; @@ -100,7 +100,7 @@ pub async fn refresh_all( DetectorLayer::refresh_pool(db_pool.clone(), infra, infra_cache), OperationalPointLayer::refresh_pool(db_pool.clone(), infra, infra_cache), TrackSectionLinkLayer::refresh_pool(db_pool.clone(), infra, infra_cache), - LPVPanelLayer::refresh_pool(db_pool.clone(), infra, infra_cache), + PSLSignLayer::refresh_pool(db_pool.clone(), infra, infra_cache), NeutralSectionLayer::refresh_pool(db_pool.clone(), infra, infra_cache), )?; log::debug!("⚙️ Infra {infra}: object layers is generated"); @@ -121,7 +121,7 @@ pub async fn clear_all(conn: &mut PgConnection, infra: i64) -> Result<()> { DetectorLayer::clear(conn, infra).await?; OperationalPointLayer::clear(conn, infra).await?; TrackSectionLinkLayer::clear(conn, infra).await?; - LPVPanelLayer::clear(conn, infra).await?; + PSLSignLayer::clear(conn, infra).await?; ErrorLayer::clear(conn, infra).await?; NeutralSectionLayer::clear(conn, infra).await?; Ok(()) @@ -143,7 +143,7 @@ pub async fn update_all( DetectorLayer::update(conn, infra, operations, infra_cache).await?; OperationalPointLayer::update(conn, infra, operations, infra_cache).await?; TrackSectionLinkLayer::update(conn, infra, operations, infra_cache).await?; - LPVPanelLayer::update(conn, infra, operations, infra_cache).await?; + PSLSignLayer::update(conn, infra, operations, infra_cache).await?; ErrorLayer::update(conn, infra, operations, infra_cache).await?; NeutralSectionLayer::update(conn, infra, operations, infra_cache).await?; Ok(()) diff --git a/editoast/src/generated_data/lpv_panel.rs b/editoast/src/generated_data/psl_sign.rs similarity index 85% rename from editoast/src/generated_data/lpv_panel.rs rename to editoast/src/generated_data/psl_sign.rs index 0344a44dc68..e4d7bb0091d 100644 --- a/editoast/src/generated_data/lpv_panel.rs +++ b/editoast/src/generated_data/psl_sign.rs @@ -12,18 +12,18 @@ use crate::diesel::ExpressionMethods; use crate::error::Result; use crate::infra_cache::InfraCache; use crate::schema::ObjectType; -use crate::tables::infra_layer_lpv_panel::dsl; +use crate::tables::infra_layer_psl_sign::dsl; -pub struct LPVPanelLayer; +pub struct PSLSignLayer; #[async_trait] -impl GeneratedData for LPVPanelLayer { +impl GeneratedData for PSLSignLayer { fn table_name() -> &'static str { - "infra_layer_lpv_panel" + "infra_layer_psl_sign" } async fn generate(conn: &mut PgConnection, infra: i64, _cache: &InfraCache) -> Result<()> { - sql_query(include_str!("sql/generate_lpv_panel_layer.sql")) + sql_query(include_str!("sql/generate_psl_sign_layer.sql")) .bind::(infra) .execute(conn) .await?; @@ -47,7 +47,7 @@ impl GeneratedData for LPVPanelLayer { .iter() .chain(involved_objects.updated.iter()); delete( - dsl::infra_layer_lpv_panel + dsl::infra_layer_psl_sign .filter(dsl::infra_id.eq(infra)) .filter(dsl::obj_id.eq_any(objs)), ) @@ -57,7 +57,7 @@ impl GeneratedData for LPVPanelLayer { // Insert involved elements if !involved_objects.updated.is_empty() { - sql_query(include_str!("sql/insert_lpv_panel_layer.sql")) + sql_query(include_str!("sql/insert_psl_sign_layer.sql")) .bind::(infra) .bind::, _>(involved_objects.updated.into_iter().collect::>()) .execute(conn) diff --git a/editoast/src/generated_data/sql/generate_lpv_panel_layer.sql b/editoast/src/generated_data/sql/generate_psl_sign_layer.sql similarity index 54% rename from editoast/src/generated_data/sql/generate_lpv_panel_layer.sql rename to editoast/src/generated_data/sql/generate_psl_sign_layer.sql index 4aad7a57c54..3e31915fd80 100644 --- a/editoast/src/generated_data/sql/generate_lpv_panel_layer.sql +++ b/editoast/src/generated_data/sql/generate_psl_sign_layer.sql @@ -1,40 +1,40 @@ -WITH panels AS ( +WITH signs AS ( SELECT obj_id AS sc_id, ( - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement')->'position' + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement')->'position' )::float AS position, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement')->>'track' AS track_id, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement') AS data + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement')->>'track' AS track_id, + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement') AS data FROM infra_object_speed_section WHERE infra_id = $1 - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' UNION SELECT obj_id AS sc_id, ( - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r')->'position' + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r')->'position' )::float AS position, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r')->>'track' AS track_id, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r') AS data + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r')->>'track' AS track_id, + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r') AS data FROM infra_object_speed_section WHERE infra_id = $1 - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' UNION SELECT obj_id AS sc_id, - (data->'extensions'->'lpv_sncf'->'z'->'position')::float AS position, - data->'extensions'->'lpv_sncf'->'z'->>'track' AS track_id, - data->'extensions'->'lpv_sncf'->'z' AS data + (data->'extensions'->'psl_sncf'->'z'->'position')::float AS position, + data->'extensions'->'psl_sncf'->'z'->>'track' AS track_id, + data->'extensions'->'psl_sncf'->'z' AS data FROM infra_object_speed_section WHERE infra_id = $1 - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' ), collect AS ( - SELECT panels.sc_id, - panels.data, + SELECT signs.sc_id, + signs.data, ST_LineInterpolatePoint( tracks_layer.geographic, LEAST( GREATEST( - panels.position / (tracks.data->'length')::float, + signs.position / (tracks.data->'length')::float, 0. ), 1. @@ -44,19 +44,19 @@ collect AS ( tracks_layer.schematic, LEAST( GREATEST( - panels.position / (tracks.data->'length')::float, + signs.position / (tracks.data->'length')::float, 0. ), 1. ) ) AS sch - FROM panels - INNER JOIN infra_object_track_section AS tracks ON tracks.obj_id = panels.track_id + FROM signs + INNER JOIN infra_object_track_section AS tracks ON tracks.obj_id = signs.track_id AND tracks.infra_id = $1 INNER JOIN infra_layer_track_section AS tracks_layer ON tracks.obj_id = tracks_layer.obj_id AND tracks.infra_id = tracks_layer.infra_id ) -INSERT INTO infra_layer_lpv_panel (obj_id, infra_id, geographic, schematic, data) +INSERT INTO infra_layer_psl_sign (obj_id, infra_id, geographic, schematic, data) SELECT sc_id, $1, geo, diff --git a/editoast/src/generated_data/sql/insert_lpv_panel_layer.sql b/editoast/src/generated_data/sql/insert_psl_sign_layer.sql similarity index 55% rename from editoast/src/generated_data/sql/insert_lpv_panel_layer.sql rename to editoast/src/generated_data/sql/insert_psl_sign_layer.sql index df789a229fb..c0e0653b6e0 100644 --- a/editoast/src/generated_data/sql/insert_lpv_panel_layer.sql +++ b/editoast/src/generated_data/sql/insert_psl_sign_layer.sql @@ -1,43 +1,43 @@ -WITH panels AS ( +WITH signs AS ( SELECT obj_id AS sc_id, ( - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement')->'position' + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement')->'position' )::float AS position, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement')->>'track' AS track_id, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'announcement') AS data + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement')->>'track' AS track_id, + jsonb_array_elements(data->'extensions'->'psl_sncf'->'announcement') AS data FROM infra_object_speed_section WHERE infra_id = $1 AND obj_id = ANY($2) - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' UNION SELECT obj_id AS sc_id, ( - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r')->'position' + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r')->'position' )::float AS position, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r')->>'track' AS track_id, - jsonb_array_elements(data->'extensions'->'lpv_sncf'->'r') AS data + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r')->>'track' AS track_id, + jsonb_array_elements(data->'extensions'->'psl_sncf'->'r') AS data FROM infra_object_speed_section WHERE infra_id = $1 AND obj_id = ANY($2) - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' UNION SELECT obj_id AS sc_id, - (data->'extensions'->'lpv_sncf'->'z'->'position')::float AS position, - data->'extensions'->'lpv_sncf'->'z'->>'track' AS track_id, - data->'extensions'->'lpv_sncf'->'z' AS data + (data->'extensions'->'psl_sncf'->'z'->'position')::float AS position, + data->'extensions'->'psl_sncf'->'z'->>'track' AS track_id, + data->'extensions'->'psl_sncf'->'z' AS data FROM infra_object_speed_section WHERE infra_id = $1 AND obj_id = ANY($2) - AND infra_object_speed_section.data @? '$.extensions.lpv_sncf.z' + AND infra_object_speed_section.data @? '$.extensions.psl_sncf.z' ), collect AS ( - SELECT panels.sc_id, - panels.data, + SELECT signs.sc_id, + signs.data, ST_LineInterpolatePoint( tracks_layer.geographic, LEAST( GREATEST( - panels.position / (tracks.data->'length')::float, + signs.position / (tracks.data->'length')::float, 0. ), 1. @@ -47,19 +47,19 @@ collect AS ( tracks_layer.schematic, LEAST( GREATEST( - panels.position / (tracks.data->'length')::float, + signs.position / (tracks.data->'length')::float, 0. ), 1. ) ) AS sch - FROM panels - INNER JOIN infra_object_track_section AS tracks ON tracks.obj_id = panels.track_id + FROM signs + INNER JOIN infra_object_track_section AS tracks ON tracks.obj_id = signs.track_id AND tracks.infra_id = $1 INNER JOIN infra_layer_track_section AS tracks_layer ON tracks.obj_id = tracks_layer.obj_id AND tracks.infra_id = tracks_layer.infra_id ) -INSERT INTO infra_layer_lpv_panel (obj_id, infra_id, geographic, schematic, data) +INSERT INTO infra_layer_psl_sign (obj_id, infra_id, geographic, schematic, data) SELECT sc_id, $1, geo, diff --git a/editoast/src/models/infra.rs b/editoast/src/models/infra.rs index 7ff42cb7782..b9676e77603 100644 --- a/editoast/src/models/infra.rs +++ b/editoast/src/models/infra.rs @@ -23,7 +23,7 @@ use log::{debug, error}; use serde::{Deserialize, Serialize}; use uuid::Uuid; -pub const RAILJSON_VERSION: &str = "3.4.1"; +pub const RAILJSON_VERSION: &str = "3.4.2"; pub const INFRA_VERSION: &str = "0"; #[derive( diff --git a/editoast/src/schema/mod.rs b/editoast/src/schema/mod.rs index 131124dda6b..c8a43656913 100644 --- a/editoast/src/schema/mod.rs +++ b/editoast/src/schema/mod.rs @@ -331,7 +331,7 @@ pub enum Side { #[derive(Debug, Derivative, Clone, Deserialize, Serialize, PartialEq)] #[derivative(Default)] #[serde(deny_unknown_fields)] -pub struct Panel { +pub struct Sign { #[derivative(Default(value = r#""InvalidRef".into()"#))] pub track: Identifier, pub position: f64, @@ -339,7 +339,7 @@ pub struct Panel { pub angle_sch: f64, pub side: Side, #[serde(rename = "type")] - pub panel_type: NonBlankString, + pub sign_type: NonBlankString, pub value: Option, } diff --git a/editoast/src/schema/speed_section.rs b/editoast/src/schema/speed_section.rs index bf80360207b..4c7092038da 100644 --- a/editoast/src/schema/speed_section.rs +++ b/editoast/src/schema/speed_section.rs @@ -5,7 +5,7 @@ use super::utils::Identifier; use super::utils::NonBlankString; use super::OSRDTyped; use super::ObjectType; -use super::Panel; +use super::Sign; use crate::infra_cache::Cache; use crate::infra_cache::ObjectCache; @@ -33,15 +33,15 @@ pub struct SpeedSection { #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq)] #[serde(deny_unknown_fields)] pub struct SpeedSectionExtensions { - pub lpv_sncf: Option, + pub psl_sncf: Option, } #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq)] #[serde(deny_unknown_fields)] -pub struct SpeedSectionLpvSncfExtension { - announcement: Vec, - z: Panel, - r: Vec, +pub struct SpeedSectionPslSncfExtension { + announcement: Vec, + z: Sign, + r: Vec, } impl OSRDTyped for SpeedSection { @@ -59,10 +59,10 @@ impl OSRDIdentified for SpeedSection { impl Cache for SpeedSection { fn get_track_referenced_id(&self) -> Vec<&String> { let mut res: Vec<_> = self.track_ranges.iter().map(|tr| &*tr.track).collect(); - if let Some(lpv) = &self.extensions.lpv_sncf { - res.extend(lpv.announcement.iter().map(|panel| &*panel.track)); - res.extend(lpv.r.iter().map(|panel| &*panel.track)); - res.push(&*lpv.z.track); + if let Some(psl) = &self.extensions.psl_sncf { + res.extend(psl.announcement.iter().map(|sign| &*sign.track)); + res.extend(psl.r.iter().map(|sign| &*sign.track)); + res.push(&*psl.z.track); } res } diff --git a/editoast/src/tables.rs b/editoast/src/tables.rs index e35487e5cca..4bc71500464 100644 --- a/editoast/src/tables.rs +++ b/editoast/src/tables.rs @@ -104,13 +104,12 @@ diesel::table! { use diesel::sql_types::*; use postgis_diesel::sql_types::*; - infra_layer_lpv_panel (id) { + infra_layer_neutral_section (id) { id -> Int8, #[max_length = 255] obj_id -> Varchar, geographic -> Geometry, schematic -> Geometry, - data -> Jsonb, infra_id -> Int8, } } @@ -119,7 +118,7 @@ diesel::table! { use diesel::sql_types::*; use postgis_diesel::sql_types::*; - infra_layer_neutral_section (id) { + infra_layer_operational_point (id) { id -> Int8, #[max_length = 255] obj_id -> Varchar, @@ -133,12 +132,13 @@ diesel::table! { use diesel::sql_types::*; use postgis_diesel::sql_types::*; - infra_layer_operational_point (id) { + infra_layer_psl_sign (id) { id -> Int8, #[max_length = 255] obj_id -> Varchar, geographic -> Geometry, schematic -> Geometry, + data -> Jsonb, infra_id -> Int8, } } @@ -663,9 +663,9 @@ diesel::joinable!(infra_layer_buffer_stop -> infra (infra_id)); diesel::joinable!(infra_layer_catenary -> infra (infra_id)); diesel::joinable!(infra_layer_detector -> infra (infra_id)); diesel::joinable!(infra_layer_error -> infra (infra_id)); -diesel::joinable!(infra_layer_lpv_panel -> infra (infra_id)); diesel::joinable!(infra_layer_neutral_section -> infra (infra_id)); diesel::joinable!(infra_layer_operational_point -> infra (infra_id)); +diesel::joinable!(infra_layer_psl_sign -> infra (infra_id)); diesel::joinable!(infra_layer_signal -> infra (infra_id)); diesel::joinable!(infra_layer_speed_section -> infra (infra_id)); diesel::joinable!(infra_layer_switch -> infra (infra_id)); @@ -712,9 +712,9 @@ diesel::allow_tables_to_appear_in_same_query!( infra_layer_catenary, infra_layer_detector, infra_layer_error, - infra_layer_lpv_panel, infra_layer_neutral_section, infra_layer_operational_point, + infra_layer_psl_sign, infra_layer_signal, infra_layer_speed_section, infra_layer_switch, diff --git a/editoast/src/tests/small_infra/small_infra.json b/editoast/src/tests/small_infra/small_infra.json index d5fb2d493e8..417bcaaba46 100644 --- a/editoast/src/tests/small_infra/small_infra.json +++ b/editoast/src/tests/small_infra/small_infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.1", + "version": "3.4.2", "operational_points": [ { "id": "South_West_station", diff --git a/editoast/src/views/layers/mvt_utils.rs b/editoast/src/views/layers/mvt_utils.rs index 79499bb3e1b..a806f1b829f 100644 --- a/editoast/src/views/layers/mvt_utils.rs +++ b/editoast/src/views/layers/mvt_utils.rs @@ -216,7 +216,7 @@ mod tests { FROM matches INNER JOIN infra_layer_speed_section layer on matches.id = layer.id inner join infra_object_speed_section speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id - WHERE geo_json is not NULL AND (not (speed_section.data @? '$.extensions.lpv_sncf.z')) + WHERE geo_json is not NULL AND (not (speed_section.data @? '$.extensions.psl_sncf.z')) " ]; for (i, layer_name) in ["track_sections", "speed_sections"].iter().enumerate() { @@ -236,7 +236,7 @@ mod tests { data: json!({ "id": "a", "extensions": { - "lpv_sncf": null + "psl_sncf": null }, "speed_limit": null, "track_ranges": [ @@ -254,7 +254,7 @@ mod tests { data: json!({ "id": "b", "extensions": { - "lpv_sncf": null + "psl_sncf": null }, "speed_limit": null, "track_ranges": [ diff --git a/front/src/reducers/osrdconf/infra_schema.json b/front/src/reducers/osrdconf/infra_schema.json index c6dc6b6e9bf..982cd985380 100644 --- a/front/src/reducers/osrdconf/infra_schema.json +++ b/front/src/reducers/osrdconf/infra_schema.json @@ -1182,7 +1182,7 @@ "lpv_sncf": { "allOf": [ { - "$ref": "#/$defs/SpeedSectionLpvSncfExtension" + "$ref": "#/$defs/SpeedSectionPslSncfExtension" } ], "default": null @@ -1191,7 +1191,7 @@ "title": "SpeedSectionExtensions", "type": "object" }, - "SpeedSectionLpvSncfExtension": { + "SpeedSectionPslSncfExtension": { "properties": { "announcement": { "description": "Precise the value(s) of the speed", @@ -1223,7 +1223,7 @@ "z", "r" ], - "title": "SpeedSectionLpvSncfExtension", + "title": "SpeedSectionPslSncfExtension", "type": "object" }, "Switch": { @@ -1746,8 +1746,8 @@ "type": "array" }, "version": { - "const": "3.4.1", - "default": "3.4.1", + "const": "3.4.2", + "default": "3.4.2", "description": "Version of the schema", "title": "Version" } diff --git a/python/osrd_schemas/osrd_schemas/infra.py b/python/osrd_schemas/osrd_schemas/infra.py index 026d3242358..d25c610cc95 100644 --- a/python/osrd_schemas/osrd_schemas/infra.py +++ b/python/osrd_schemas/osrd_schemas/infra.py @@ -8,7 +8,7 @@ ALL_OBJECT_TYPES = [] -RAILJSON_INFRA_VERSION_TYPE = Literal["3.4.1"] +RAILJSON_INFRA_VERSION_TYPE = Literal["3.4.2"] RAILJSON_INFRA_VERSION = get_args(RAILJSON_INFRA_VERSION_TYPE)[0] # Traits @@ -423,17 +423,17 @@ def ref(self): return DetectorReference(type="Detector", id=self.id) -class Panel(TrackLocationTrait): - """This class is used to define panels. +class Sign(TrackLocationTrait): + """This class is used to define signs. This is a physical, punctual, cosmetic object. """ angle_geo: float = Field(0, description="Geographic angle in degrees") angle_sch: float = Field(0, description="Schematic angle in degrees") - side: Side = Field(Side.CENTER, description="Side of the panel on the track") - type: NonBlankStr = Field(description="Precise the type of the panel") + side: Side = Field(Side.CENTER, description="Side of the sign on the track") + type: NonBlankStr = Field(description="Precise the type of the sign") value: Optional[NonBlankStr] = Field( - description="If the panel is an announcement, precise the value(s)", default=None + description="If the sign is an announcement, precise the value(s)", default=None ) @@ -574,11 +574,11 @@ class SignalSncfExtension(BaseModel): value: str -@register_extension(object=SpeedSection, name="lpv_sncf") -class SpeedSectionLpvSncfExtension(BaseModel): - announcement: List[Panel] = Field(description="Precise the value(s) of the speed") - z: Panel = Field(description="Beginning of the lpv speed section") - r: List[Panel] = Field(description="End of the lpv speed section") +@register_extension(object=SpeedSection, name="psl_sncf") +class SpeedSectionPslSncfExtension(BaseModel): + announcement: List[Sign] = Field(description="Precise the value(s) of the speed") + z: Sign = Field(description="Beginning of the psl speed section") + r: List[Sign] = Field(description="End of the psl speed section") # Rebuild all classes to integrate extensions in schema diff --git a/python/osrd_schemas/pyproject.toml b/python/osrd_schemas/pyproject.toml index 5150a5408b0..ea42e469376 100644 --- a/python/osrd_schemas/pyproject.toml +++ b/python/osrd_schemas/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "osrd_schemas" -version = "0.6.2" +version = "0.7.0" description = "" authors = ["OSRD "] diff --git a/python/railjson_generator/poetry.lock b/python/railjson_generator/poetry.lock index 874f4ec2088..eff43410102 100644 --- a/python/railjson_generator/poetry.lock +++ b/python/railjson_generator/poetry.lock @@ -147,7 +147,7 @@ files = [ [[package]] name = "osrd-schemas" -version = "0.6.2" +version = "0.7.0" description = "" optional = false python-versions = ">=3.9,<3.12" diff --git a/python/railjson_generator/pyproject.toml b/python/railjson_generator/pyproject.toml index 928814dd942..29bb670f279 100644 --- a/python/railjson_generator/pyproject.toml +++ b/python/railjson_generator/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "railjson_generator" -version = "0.2.2" +version = "0.2.3" description = "" authors = ["OSRD "] diff --git a/python/railjson_generator/railjson_generator/schema/infra/infra.py b/python/railjson_generator/railjson_generator/schema/infra/infra.py index c6aa95a8f06..22ea4503355 100644 --- a/python/railjson_generator/railjson_generator/schema/infra/infra.py +++ b/python/railjson_generator/railjson_generator/schema/infra/infra.py @@ -27,7 +27,7 @@ class Infra: catenaries: List[Catenary] = field(default_factory=list) neutral_sections: List[NeutralSection] = field(default_factory=list) - VERSION = "3.4.1" + VERSION = "3.4.2" def add_route(self, *args, **kwargs): self.routes.append(Route(*args, **kwargs)) diff --git a/tests/poetry.lock b/tests/poetry.lock index bce00be3365..674854c7d17 100644 --- a/tests/poetry.lock +++ b/tests/poetry.lock @@ -278,7 +278,7 @@ files = [ [[package]] name = "osrd-schemas" -version = "0.6.1" +version = "0.7.0" description = "" optional = false python-versions = ">=3.9,<3.12" @@ -538,7 +538,7 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no [[package]] name = "railjson-generator" -version = "0.2.2" +version = "0.2.3" description = "" optional = false python-versions = ">=3.9,<3.12"