Skip to content

Conversation

@aschantraine
Copy link
Contributor

@aschantraine aschantraine commented Dec 24, 2025

Implements full logic for /level_crossing_occupancy/ endpoint assuming all trains are PacedTrain:

  • Move interpolate_arrival_time() from track_occupancy.rs to projection.rs to be reused for level_crossing_occupancy
  • Add track_offset() method to LevelCrossing schema
  • Implement complete occupancy calculation workflow:
    • Load infra, level crossings and trains
    • Run train pathfinding and simulation
    • Compute occupancy time windows
    • Group results by level crossing ID
    • Skip trains with missing rolling stock, failed simulations, no pedal intersection, or that do not fully traverse the short zone
  • Add i18n messages for level_crossing errors in en and fr
  • Add tests

This only works for PacedTrain as long as the TrainSchedule migration has not been completed.

@github-actions github-actions bot added the area:editoast Work on Editoast Service label Dec 24, 2025
@aschantraine aschantraine linked an issue Dec 24, 2025 that may be closed by this pull request
1 task
@aschantraine aschantraine changed the title editoast: implement level_crossing_occupancy endpoint logic editoast: implement /level_crossing_occupancy endpoint logic Dec 24, 2025
@aschantraine aschantraine changed the title editoast: implement /level_crossing_occupancy endpoint logic editoast: implement /level_crossing_occupancy endpoint logic Dec 24, 2025
@github-actions github-actions bot added area:front Work on Standard OSRD Interface modules kind:api-change labels Dec 24, 2025
@github-actions
Copy link
Contributor

⚠️ API changes

This Pull Request introduces some changes in the API:

  • please own it: notify or even prepare dedicated PR(s) to consumer projects

Changes in Schemas

Dear @aschantraine, please ensure the following:

@aschantraine aschantraine force-pushed the ace/level_crossing_occupancy branch 2 times, most recently from ed563d5 to 79833c2 Compare December 24, 2025 16:40
@aschantraine aschantraine marked this pull request as ready for review December 24, 2025 16:58
@aschantraine aschantraine requested review from a team as code owners December 24, 2025 16:58
)
.await?;

// Load rolling stocks lengths
Copy link
Member

Choose a reason for hiding this comment

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

Nit: do we really need this kind of comment? The function called below has the exact same name, except for the word separators.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

- Load infra, level crossings and trains
- Run train pathfinding and simulation
- Compute occupancy time windows
- Group results by level crossing ID
- Skip trains with missing rolling stock, failed simulations, no pedal intersection, or that do not fully traverse the short zone
- Add i18n messages for level_crossing errors in en and fr

Signed-off-by: aschantraine <[email protected]>
@aschantraine aschantraine force-pushed the ace/level_crossing_occupancy branch from 79833c2 to 60b81f8 Compare December 26, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:editoast Work on Editoast Service area:front Work on Standard OSRD Interface modules kind:api-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a new endpoint to get level_crossings occupation

3 participants