Skip to content

Conversation

@Synar
Copy link
Contributor

@Synar Synar commented Dec 19, 2025

Graou train schedules parsing logic was spread amongst 5 different files, with functions called at various points of the importing process, without any unifying convention.

In particular, this meant we had to carry a TrainLists parameter on top of the TrainFromJson one in ImportTimetableItemList just for the purpose of storing half-formatted graou train schedules.

Instead :

  • move all Graou validation logic that can cause the request to fail to graouApi
  • move all Graou parsing/formatting logic in a single new helper file
  • fully format Graou train schedules in a single place of ImportTimetableItemConfig, as is done for json, xml and nge files
  • drop trainLists
  • simplify and document the code as much as possible

I'm not 100% sure about where the validation logic should live, and how strict we want to be with it. For example, should we really reject all train schedules because one uic was missing?

Also close #10159 by querying all chs for each step, as is done in many other places in the front. The fixup commit at the end is an alternative version of the code (which I favor, but does require a new type). Both commits can be extracted to another pr if you wish.

For reviewing, I suggest taking a look at the overall new code flow in ImportTimetableItemConfig as well as parseGraouTrains, and then go commit by commit. I tried to be as atomic as possible (perhaps too much?). Each commit compiles and runs.

Next step could be to write a couple unit tests, at least for the overall Graou import.

@Synar Synar requested a review from a team as a code owner December 19, 2025 10:11
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Dec 19, 2025
@Synar Synar self-assigned this Dec 19, 2025
@Synar Synar moved this to Awaiting merge in Board PI 18 Dec 19, 2025
@Synar Synar removed this from Board PI 18 Dec 19, 2025
@Synar Synar requested review from clarani and emersion December 19, 2025 10:13
Synar added 15 commits December 19, 2025 11:15
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
@Synar Synar force-pushed the ali/fix-refactor-graou-import branch from b3ac4b4 to de39021 Compare December 19, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:front Work on Standard OSRD Interface modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open data import picks random CH codes instead of BV/00

2 participants