Skip to content

front: drop graou open data import#14729

Merged
Khoyo merged 15 commits intodevfrom
ali/drop-graou
Jan 23, 2026
Merged

front: drop graou open data import#14729
Khoyo merged 15 commits intodevfrom
ali/drop-graou

Conversation

@Synar
Copy link
Copy Markdown
Contributor

@Synar Synar commented Jan 14, 2026

Drop graou open data import, as the api will soon no longer be public, see discussion in #14517

Supercedes #14517 , a squashed version is included for 2 reasons:

  • the cleanup done in that pr makes graou removal much easier, as it made graou import much more atomic and self contained, and already dropped multiple files, functions and states (such as TrainList)
  • if we want to add graou import or another similar import back, we can revert to a cleaner version

(I could also fully include that pr history if prefered)

I dropped the interface used by graou, but we could also simply disable it.

Finally, I also added minimal styling to the remaining import button, so that the page remains coherent. The new page is a bit empty and not very pretty, if we're going to remain without an another open data import for a long time, it would be nice to overhaul it.

Edit : #14772 merged into this pr, which fully drops the import item page in favor of directly opening the file import modal, and generally simplifies the import flow

Edit : also fix railway manager interface xml import to only fallback on 415

@Synar Synar self-assigned this Jan 14, 2026
@Synar Synar requested a review from a team as a code owner January 14, 2026 00:55
@Synar Synar added area:front Work on Standard OSRD Interface modules module:operational-studies Multi-train simulation with structured studies management component:train-imports Related to timetable imports labels Jan 14, 2026
@SharglutDev SharglutDev moved this to Awaiting merge in Board PI 18 Jan 14, 2026
@SharglutDev SharglutDev self-requested a review January 14, 2026 12:20
@flomonster
Copy link
Copy Markdown
Member

Finally, I also added minimal styling to the remaining import button, so that the page remains coherent. The new page is a bit empty and not very pretty, if we're going to remain without an another open data import for a long time, it would be nice to overhaul it.

I think we won't have an open data import for a bit of time and we will probably have a new user interface. So IMO you can drop all of it. Ideally the workflow should be.

  1. I click on the small import icon in my train list
  2. I have the popup that asks me to select a file
  3. When I click on "download" (maybe should be renamed) "import" it import everything

No need to have a preview of the imported trains. @maelysLeratRosso Do you agree with this?

@maelysLeratRosso
Copy link
Copy Markdown

maelysLeratRosso commented Jan 15, 2026

I agree (and @thibautsailly too)

@Synar
Copy link
Copy Markdown
Contributor Author

Synar commented Jan 15, 2026

Hmm, we had a feature planned to choose on import whether we wanted to import the trains, the nodes and/or the notes. This would require keeping either the preview, or at least some form of interface. Do you know if there's a plan to start work on this feature soon, or is it far off in the backlog?

@maelysLeratRosso

@flomonster
Copy link
Copy Markdown
Member

@Synar Yes, good point. In my opinion, we can ignore this feature because it is not currently included in the development cycle. It will just require a redesign to adapt the form.

In the first design phase, we put the buttons there more out of opportunism than UI/UX design. So this will be an occasion to start thinking about it.

@emersion
Copy link
Copy Markdown
Member

I have the popup that asks me to select a file

By that, do you mean the browser's file selection dialog, or an OSRD popup?

I would argue the browser file selection dialog should be immediately displayed, to reduce the number of unnecessary steps required to import a file.

@flomonster
Copy link
Copy Markdown
Member

I have the popup that asks me to select a file

By that, do you mean the browser's file selection dialog, or an OSRD popup?

I would argue the browser file selection dialog should be immediately displayed, to reduce the number of unnecessary steps required to import a file.

I mean the browser's file selection, I think we're on the same page here 😄

@Synar
Copy link
Copy Markdown
Contributor Author

Synar commented Jan 15, 2026

Since this goes quite a bit beyond graou removal, I propose to do this in a follow up pr, as soon as this one is merged

@flomonster
Copy link
Copy Markdown
Member

Since this goes quite a bit beyond graou removal, I propose to do this in a follow up pr, as soon as this one is merged

What we mean is that we should see the browser file selection when clicking on import. No further modifications, it feels like it's part of the Graou removal.

@Synar
Copy link
Copy Markdown
Contributor Author

Synar commented Jan 16, 2026

Since this goes quite a bit beyond graou removal, I propose to do this in a follow up pr, as soon as this one is merged

What we mean is that we should see the browser file selection when clicking on import. No further modifications, it feels like it's part of the Graou removal.

Yes but this means we should also drop the train preview, which is not strictly linked to graou, as well as unifying/dropping importItemList and importItemConfig, which makes the refacto quite a bit bigger.

Although if the reviewers don't mind, I can do it in this one too

@SharglutDev since you're reviewing, what would you prefer?

@SharglutDev
Copy link
Copy Markdown
Contributor

SharglutDev commented Jan 16, 2026

I don't mind, you can do it in another commit if you have the time :)
(didn't review yet sorry as we have quite a few high priority PRs waiting for reviews)

@Synar
Copy link
Copy Markdown
Contributor Author

Synar commented Jan 17, 2026

Hmm, I guess I'll stack prs ^^

(It will take way more than one commit though haha. Indeed we need to extract all the logic from the import components out into helpers in order to drop them.)

Copy link
Copy Markdown
Contributor

@SharglutDev SharglutDev left a comment

Choose a reason for hiding this comment

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

Lgtm and tested, thank for the PR ! (and sorry for the delay 🙇‍♂️ )

Synar and others added 5 commits January 23, 2026 00:48
- Centralize all the dispersed files and code relative to graou to unified helpers
- Merge the graou import process with the regular json import
- Make the graou import process cleaner, simpler and more consistent

See the list of squashed commits below for details :

front: move updateTrainSchedules to parseGraou helper file

This is a step in centralizing all graou parsing logic,
in order to improve code maintainability and enable us to streamline the import process.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: move step filtering logic to parseGraou helper file

This is a step in centralizing all graou parsing logic,
in order to improve code maintainability and enable us to streamline the import process.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: move format list logic to parseGraou helper file

This is a step in centralizing all graou parsing logic,
in order to improve code maintainability and enable us to streamline the import process.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: move generateTrainSchedulePayloads to parseGraou helper file

This is a step in centralizing all graou parsing logic,
in order to improve code maintainability and enable us to streamline the import process.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: move populateUicChecksum to parseGraou helper file

This is a step in centralizing all graou parsing logic,
in order to improve code maintainability and enable us to streamline the import process.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: fuse trainList and trainJson import

The only difference between trainList (used for Graou) and trainJson (used for all other sources) import
was that trainList contained train schedules that were only partially parsed,
as we performed some processing of Graou trains before filling the list and some after.

There is however no good reason not to fully parse Graou trains before filling the list, and fuse trainList into trainJson.

This lets us both:
- simplify the properties and logic of ImportTimetableItemTrainsList
- streamline the process of parsing Graou trains and avoid exposing intermediate results

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: graou import: fills uic checksum in main format loop

Transforming the uic by filling the checksum is a parsing/formatting operation,
which naturally belongs with other parsing/formatting operations rather than in the api call.
Furthermore, it makes sense to do it right before converting the GraouTrainSchedule string uic to a TrainSchedule number uic.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: graou import: match rolling stock in main format loop

This reduce the number of functions exposed by parseGraouTrains,
making the parsing more streamlined and self contained.
The final goal would be to only expose generateTrainSchedulesPayloads as far as parsing/formatting is concerned.

Additionally drops an unnecessary loop.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: graou import: compute stopFor in main format loop

Conmputing stopFor duration at the same time as arrival and departure times makes sense,
and enables us to remove a large loop and function call while streamlining the import process.

Also use Duration.subtractDate and .toISOString instead of manual computations for standardization.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: graou import: move all rs match logic to parseGraouTrain

Contribute to centralizing all graou parsing logic.

Also simplify the rs matching logic, drop a custom type and avoid type casting.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: improve parseGraouTrains readability

Finish adding doc strings to functions that were lacking them.

Also move populateUicChecksum next to other internal parsing functions.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: move uic validation to graou api

While previous commits attempted to centralize parsing logic,
this commit goal is to centralize validation logic, which is mostly done in the api call.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: streamline getTrainsFromOpenData

Wrapping everything in a single try/catch/finally makes the function more robust (parsing failures can occur) and streamlined.

The "if (filteredTrains && !isEmpty(filteredTrains))" condition was unnecessary and was dropped.

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: fix chs missing in trains imported from graou

Signed-off-by: Alice K. <alice.khoudli@gmail.com>

front: overhaul graou import validation

- move all the validation logic inside graouApi
- be more resilient to errors by filtering invalid schedules and steps instead of throwing, as graou api erros are frequent
- add toast warning for filtered schedules
- fix the translation strings for the filtered steps toast warning

Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Remove ability to import trains from graou open data as the api will no longer be publicly accessible

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
@Synar Synar requested a review from a team as a code owner January 23, 2026 00:20
Synar added 8 commits January 23, 2026 01:27
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Copy link
Copy Markdown
Member

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

LGTM, I could not import a file because of a format but I think it's due to another bug

@Synar Synar requested a review from Maymanaf January 23, 2026 09:30
@Synar
Copy link
Copy Markdown
Contributor Author

Synar commented Jan 23, 2026

If nothing else nge import should already be in the right format (especially if you don't put train schedules in your dto)

@Synar Synar requested a review from SharglutDev January 23, 2026 09:47
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Copy link
Copy Markdown
Contributor

@Maymanaf Maymanaf left a comment

Choose a reason for hiding this comment

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

LGTM for e2e ✅

Copy link
Copy Markdown
Contributor

@SharglutDev SharglutDev left a comment

Choose a reason for hiding this comment

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

Lgtm and tested ✅

@Khoyo Khoyo added this pull request to the merge queue Jan 23, 2026
Merged via the queue into dev with commit 9cdc66f Jan 23, 2026
29 checks passed
@Khoyo Khoyo deleted the ali/drop-graou branch January 23, 2026 16:32
@github-project-automation github-project-automation Bot moved this from Awaiting merge to Awaiting Validation in Board PI 18 Jan 23, 2026
@louisgreiner louisgreiner moved this from Awaiting Validation to Done in Board PI 18 Jan 30, 2026
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 component:train-imports Related to timetable imports module:operational-studies Multi-train simulation with structured studies management

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants