### Build and Start Storybook Source: https://github.com/openrailassociation/osrd/blob/dev/front/ui/README.md Commands to install dependencies, build the UI, and start the Storybook server. ```bash cd front/ui npm install npm run build-ui cd storybook npm start ``` -------------------------------- ### Install Rustfmt and Clippy Components Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Installs the rustfmt and clippy components for Rust development using rustup. ```sh rustup component add rustfmt clippy ``` -------------------------------- ### Import Small Example Infrastructure Source: https://github.com/openrailassociation/osrd/blob/dev/README.md This script loads a small example infrastructure configuration into OSRD. It requires the path to the infrastructure JSON file. ```bash ./scripts/load-railjson-infra.sh small_infra tests/data/infras/small_infra/infra.json ``` -------------------------------- ### Install E2E Test Dependencies Source: https://github.com/openrailassociation/osrd/blob/dev/front/tests/README.md Navigate to the front directory and install Node.js dependencies, then install Playwright with its system dependencies. Nix users may not need to run 'npm playwright install'. ```bash cd front/ npm install npx playwright install --with-deps ``` -------------------------------- ### Expensive Setup with beforeAll Source: https://github.com/openrailassociation/osrd/blob/dev/front/tests/README.md Use 'beforeAll' for expensive setup operations that only need to be executed once for the entire test suite. ```typescript test.beforeAll(async () => { infra = await getInfra(); project = await getProject(); }); ``` -------------------------------- ### Install ui-charts Package Source: https://github.com/openrailassociation/osrd/blob/dev/front/ui/ui-charts/README.md Install the ui-charts package using npm. This command should be run in your project directory. ```sh npm install @osrd-project/ui-charts ``` -------------------------------- ### Install Python Test Dependencies Source: https://context7.com/openrailassociation/osrd/llms.txt Installs Python dependencies for testing using uv. Ensure you are in the 'tests' directory. ```bash cd tests uv sync --all-extras ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/openrailassociation/osrd/blob/dev/python/railjson_generator/README.md Use uv to synchronize all project dependencies, including extras. ```sh uv sync --all-extras ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Starts essential services like openfga, postgres, rabbitmq, and valkey in detached mode. ```sh ../osrd-compose up --detach openfga postgres rabbitmq valkey ``` -------------------------------- ### Import Example Infrastructure and Rolling Stocks Source: https://context7.com/openrailassociation/osrd/llms.txt Loads the 'small_infra' example infrastructure and realistic rolling stock data into the OSRD system. The `--force` flag may be needed for rolling stock imports if files already exist. ```sh ./scripts/load-railjson-infra.sh small_infra tests/data/infras/small_infra/infra.json ``` ```sh ./scripts/load-railjson-rolling-stock.sh tests/data/rolling_stocks/realistic/*.json --force ``` ```sh ./scripts/load-railjson-rolling-stock.sh tests/data/rolling_stocks/*.json ``` -------------------------------- ### Get Help for FGA Migrations CLI Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/fga_migrations/README.md Display help information for the `fga_migrations` CLI, including available commands and options. ```bash cargo run -- --help ``` -------------------------------- ### Install Taplo CLI Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Installs the taplo-cli tool for formatting TOML files, ensuring the locked version is used. ```sh cargo install --locked taplo-cli ``` -------------------------------- ### Start Playwright Container Source: https://github.com/openrailassociation/osrd/blob/dev/front/tests/README.md Start only the Playwright container for testing, or the full stack including the front-end if working on both. This is recommended for Linux distributions not officially supported by Playwright. ```bash ./osrd-compose playwright up playwright ``` -------------------------------- ### Deploy OSRD Stack with Helm Source: https://context7.com/openrailassociation/osrd/llms.txt These shell commands demonstrate how to deploy the OSRD stack on Kubernetes using the official Helm chart. It covers installation from an OCI registry, installing a development build, and installing with custom values overrides defined in a YAML file. It also shows how to regenerate the values schema. ```sh # Install from the OCI registry (released version) helm install osrd oci://ghcr.io/openrailassociation/osrd-charts/osrd --version 0.1.0 # Install the latest dev build (replace branch/hash as appropriate) helm install osrd oci://ghcr.io/openrailassociation/osrd-charts/osrd-dev \ --version 0.0.1-dev-abc1234 # Install with a custom values override cat > my-values.yaml < ``` -------------------------------- ### Get a rolling stock by ID Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves the details of a specific rolling stock using its ID. ```APIDOC ## GET /api/rolling_stock/{id} ### Description Get a rolling stock by ID. ### Method GET ### Endpoint /api/rolling_stock/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the rolling stock. ### Response #### Success Response (200) - (object) - Details of the specified rolling stock. ``` -------------------------------- ### Run Infrastructure Generation Script Source: https://github.com/openrailassociation/osrd/blob/dev/python/railjson_generator/README.md Execute an infrastructure generation script by providing the output directory as an argument. ```sh mkdir small_infra_out uv run ../../tests/infra-scripts/small_infra.py small_infra_out ``` -------------------------------- ### Get the computed path for a train schedule Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves the computed path for a given train schedule. ```APIDOC ## GET /api/train_schedule/{train_schedule_id}/path ### Description Get the computed path for a train schedule. ### Method GET ### Endpoint /api/train_schedule/{train_schedule_id}/path?infra_id={infra_id} ### Parameters #### Query Parameters - **infra_id** (string) - Required - The infrastructure ID. ### Response #### Success Response (200) - (object) - The computed path for the train schedule. ``` -------------------------------- ### Get Rolling Stock by ID Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves the characteristics of a specific rolling stock using its unique ID. ```bash curl -s http://localhost:4000/api/rolling_stock/10 | jq . ``` -------------------------------- ### Create Project for Operational Studies Source: https://context7.com/openrailassociation/osrd/llms.txt Creates a new project to organize operational studies. Requires a JSON payload with the project name, description, and tags. ```bash curl -s -X POST http://localhost:4000/api/project \ -H "Content-Type: application/json" \ -d '{"name": "Paris–Lyon Capacity Study", "description": "...", "tags": ["capacity"]}' | jq . ``` -------------------------------- ### Get Defined Switch Types (Editoast API) Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves all switch types that are defined within a specific infrastructure. ```sh curl -s http://localhost:4000/api/infra/42/switch_types | jq . ``` -------------------------------- ### Get Configured Speed-Limit Tags (Editoast API) Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves all speed-limit tags that are configured within a specific infrastructure. ```sh curl -s http://localhost:4000/api/infra/42/speed_limit_tags | jq . ``` -------------------------------- ### Build and Run OSRD Server Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Builds the OSRD project using cargo and then runs the server. ```sh cargo build cargo run -- runserver ``` -------------------------------- ### Get Supported Electrification Voltages (Editoast API) Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves a list of all supported electrification voltages for a given infrastructure ID. ```sh curl -s http://localhost:4000/api/infra/42/voltages | jq . ``` -------------------------------- ### Build Core Service Fat JAR Source: https://context7.com/openrailassociation/osrd/llms.txt Compiles the Core service into a single executable JAR file. Use the appropriate command for your operating system. ```bash ./gradlew shadowJar ``` ```bat gradlew.bat shadowJar ``` -------------------------------- ### OSRD Docker Compose Stack Up Source: https://github.com/openrailassociation/osrd/blob/dev/core/README.md Starts the OSRD stack using Docker Compose. The '-d' flag runs containers in detached mode. ```sh ./osrd-compose host sw up -d ``` -------------------------------- ### POST /api/project Source: https://context7.com/openrailassociation/osrd/llms.txt Create a new project to organize studies and scenarios. ```APIDOC ## POST /api/project ### Description Create a new project to organize studies and scenarios. ### Method POST ### Endpoint /api/project ### Parameters #### Request Body - **name** (string) - Required - The name of the project. - **description** (string) - Optional - A description of the project. - **tags** (array) - Optional - Tags associated with the project. ### Request Example ```json { "name": "Paris–Lyon Capacity Study", "description": "...", "tags": ["capacity"] } ``` ### Response #### Success Response (200) - (object) - Details of the created project. ``` -------------------------------- ### Retrieve a Specific Infrastructure by ID (Editoast API) Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves details of a specific infrastructure by its ID using a GET request to the Editoast API. ```sh curl -s http://localhost:4000/api/infra/42 | jq . ``` -------------------------------- ### Apply OpenFGA Migrations Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Applies migrations for OpenFGA by navigating to the fga_migrations directory and running the cargo application. ```sh (cd fga_migrations && cargo run -- apply) ``` -------------------------------- ### Get Computed Path for Train Schedule Source: https://context7.com/openrailassociation/osrd/llms.txt Fetches the computed path for a given train schedule. Requires a train schedule ID and infrastructure ID. ```bash curl -s "http://localhost:4000/api/train_schedule/1/path?infra_id=42" | jq . ``` -------------------------------- ### POST /api/pathfinding/blocks Source: https://context7.com/openrailassociation/osrd/llms.txt Compute a path through the infrastructure for a given consist configuration and list of waypoints. ```APIDOC ## POST /api/pathfinding/blocks ### Description Compute a path through the infrastructure for a given consist configuration and list of waypoints. ### Method POST ### Endpoint /api/pathfinding/blocks?infra_id={infra_id} ### Parameters #### Query Parameters - **infra_id** (string) - Required - The infrastructure ID. #### Request Body - **rolling_stock_loading_gauge** (string) - Required - The loading gauge of the rolling stock. - **rolling_stock_is_thermal** (boolean) - Required - Indicates if the rolling stock is thermal. - **rolling_stock_supported_electrifications** (array) - Optional - List of supported electrifications. - **rolling_stock_supported_signaling_systems** (array) - Required - List of supported signaling systems. - **rolling_stock_maximum_speed** (number) - Required - Maximum speed of the rolling stock. - **rolling_stock_length** (number) - Required - Length of the rolling stock in millimeters. - **speed_limit_tag** (string) - Optional - Speed limit tag. - **stops_at_end_of_block** (boolean) - Required - Whether the train stops at the end of a block. - **path_items** (array) - Required - List of path items with their UIC. - **uic** (number) - Required - UIC identifier for the path item. ### Request Example ```json { "rolling_stock_loading_gauge": "G1", "rolling_stock_is_thermal": true, "rolling_stock_supported_electrifications": [], "rolling_stock_supported_signaling_systems": ["BAL"], "rolling_stock_maximum_speed": 83.33, "rolling_stock_length": 400000, "speed_limit_tag": null, "stops_at_end_of_block": false, "path_items": [ {"uic": 1000}, {"uic": 2000} ] } ``` ### Response #### Success Response (200) - **status** (string) - "success". - **blocks** (array) - List of computed blocks. - **routes** (array) - List of computed routes. - **path_item_positions** (array) - List of path item positions. #### Pathfinding Not Found Response - **status** (string) - "pathfinding_not_found". #### Invalid Path Items Response - **status** (string) - "invalid_path_items". - **items** (array) - List of invalid items. ``` -------------------------------- ### List Scenarios in a Study Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves a list of all scenarios within a specific study. Requires the project ID and study ID. ```bash curl -s http://localhost:4000/api/project/1/study/1/scenario | jq . ``` -------------------------------- ### Get full simulation output for a train Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves the complete simulation data for a specific train schedule, including speed profiles, positions, and ETAs at each stop. ```APIDOC ## GET /api/train_schedule/{train_schedule_id}/simulation ### Description Get full simulation output (speed profile, positions, ETA at each stop) for one train. ### Method GET ### Endpoint /api/train_schedule/{train_schedule_id}/simulation?infra_id={infra_id} ### Parameters #### Query Parameters - **infra_id** (string) - Required - The infrastructure ID. ### Response #### Success Response (200) - **base** (object) - Base simulation data. - **provisional** (object) - Provisional simulation data. - **final_output** (object) - Final simulation output. - **mrsp** (object) - Minimum Running Speed Profile data. ``` -------------------------------- ### Launch OSRD Front in Docker Source: https://github.com/openrailassociation/osrd/blob/dev/front/README.md Use these commands to build and run the front-end in watch mode within the OSRD Docker stack. A restart of the front container may be needed after the initial build. ```sh ./osrd-compose dev-front build ./osrd-compose up -d ``` -------------------------------- ### Run Docker Stack with No-Cache Mode Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Starts the entire OSRD stack using docker-compose with the no-cache mode enabled for editoast by setting the EDITOAST_NO_CACHE environment variable. ```sh EDITOAST_NO_CACHE=true ./osrd-compose up -d ``` -------------------------------- ### Apply OpenFGA Migration Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/fga_migrations/README.md Execute a new OpenFGA authorization model migration. You can apply a specific migration by its name or apply the latest one. ```bash cargo run -- apply ``` ```bash cargo run -- apply [MIGRATION_NAME] ``` -------------------------------- ### Create a New Empty Infrastructure (Editoast API) Source: https://context7.com/openrailassociation/osrd/llms.txt Creates a new, empty infrastructure with a specified name using a POST request to the Editoast API. The response includes the new infrastructure's ID. ```sh curl -s -X POST http://localhost:4000/api/infra \ -H "Content-Type: application/json" \ -d '{"name": "My Test Infra"}' | jq . ``` -------------------------------- ### Preferred Page Object Model Usage with Fixtures Source: https://github.com/openrailassociation/osrd/blob/dev/front/tests/README.md Instantiate Page Objects using Playwright fixtures for proper dependency injection and test setup. Avoid manual instantiation. ```typescript test('test example', async ({ homePage }) => { await homePage.goToOperationalStudiesPage(); await expect(homePage.page).toHaveURL(/.*\/operational-studies/); }); ``` -------------------------------- ### Create a New Timetable Source: https://context7.com/openrailassociation/osrd/llms.txt Creates a new timetable. The response includes the timetable ID and an empty list of train IDs. ```bash # Create a new timetable curl -s -X POST http://localhost:4000/api/timetable \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### List Infrastructure Errors and Warnings Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves a list of all current errors and warnings for a given infrastructure. Supports pagination. ```bash # List all current errors/warnings on an infrastructure curl -s "http://localhost:4000/api/infra/42/errors?page=1&page_size=50" ``` -------------------------------- ### Custom Translations for SpeedSpaceChart Source: https://github.com/openrailassociation/osrd/blob/dev/front/ui/ui-charts/src/speedSpaceChart/README.md Provides an example of how to define a custom translations object for the SpeedSpaceChart component to support internationalization. This allows overriding default text strings for various UI elements. ```javascript const yourTranslations = { detailsBoxDisplay: { reticleInfos: 'Infos Réticule', energySource: 'Source d Energie', tractionStatus: 'Etat de la traction', // Add more keys as needed }, layersDisplay: { context: 'Contexte', steps: 'Paliers', declivities: 'Declivités', // Add more keys as needed }, }; ``` -------------------------------- ### Get Full Train Simulation Output Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves the complete simulation output for a train, including speed profiles, positions, and ETAs at each stop. Requires a train schedule ID and infrastructure ID. ```bash curl -s "http://localhost:4000/api/train_schedule/1/simulation?infra_id=42" | jq . ``` -------------------------------- ### Reproduce STDCM Request Locally Source: https://github.com/openrailassociation/osrd/blob/dev/core/stdcm_debugging_tips.md Use this command to reproduce a specific STDCM request locally. Ensure you have the necessary JAR file and input files. Adjust JVM heap size as needed. ```java STDCM_DEBUG_DATA_FILENAME=debug_stdcm.json java -Xmx6G -ea -jar build/libs/osrd-all.jar reproduce-request --stdcm-payload-path input-payload.json --railjson infra.railjson --cbor-timetable timetable.cbor ``` -------------------------------- ### Build with Debug Information Source: https://github.com/openrailassociation/osrd/blob/dev/editoast/README.md Builds the project using the 'dev-for-debug' profile to include debug information, which can improve the debugging experience at the cost of longer compilation times. ```sh cargo build --profile dev-for-debug ``` -------------------------------- ### Get Train Schedule Simulation Summary Source: https://context7.com/openrailassociation/osrd/llms.txt Retrieves simulation results for a batch of train schedules, including status, time, and energy consumption. Requires infrastructure ID and a list of train schedule IDs. ```bash # Get simulation results for a batch of train schedules curl -s -X POST "http://localhost:4000/api/train_schedule/simulation_summary?infra_id=42" \ -H "Content-Type: application/json" \ -d '[1, 2, 3]' ``` -------------------------------- ### Run Core Service Tests and Code Quality Checks Source: https://context7.com/openrailassociation/osrd/llms.txt Executes all tests and code quality checks for the Core service. Includes auto-formatting. ```bash ./gradlew check ./gradlew spotlessApply ``` -------------------------------- ### Build OSRD Shadow JAR Source: https://github.com/openrailassociation/osrd/blob/dev/core/README.md Builds the OSRD shadow JAR for server or CLI usage. Run on Linux/MacOS or Windows. ```sh # on Linux / MacOS ./gradlew shadowJar ``` ```bat # on Windows gradlew.bat shadowJar ``` -------------------------------- ### POST /api/project/{project_id}/study/{study_id}/scenario Source: https://context7.com/openrailassociation/osrd/llms.txt Create a new scenario, linking infrastructure and timetable within a study. ```APIDOC ## POST /api/project/{project_id}/study/{study_id}/scenario ### Description Create a new scenario, linking infrastructure and timetable within a study. ### Method POST ### Endpoint /api/project/{project_id}/study/{study_id}/scenario ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **study_id** (string) - Required - The ID of the study. #### Request Body - **name** (string) - Required - The name of the scenario. - **infra_id** (string) - Required - The infrastructure ID. - **timetable_id** (string) - Required - The timetable ID. - **tags** (array) - Optional - Tags associated with the scenario. ### Request Example ```json { "name": "Morning Peak", "infra_id": 42, "timetable_id": 7, "tags": [] } ``` ### Response #### Success Response (200) - (object) - Details of the created scenario. ``` -------------------------------- ### Load RailJSON Infrastructure with Helper Script Source: https://context7.com/openrailassociation/osrd/llms.txt Uses a helper script to load infrastructure data from a RailJSON file. ```bash ./scripts/load-railjson-infra.sh my_infra path/to/infra.railjson.json ``` -------------------------------- ### Create Scenario Linking Infrastructure and Timetable Source: https://context7.com/openrailassociation/osrd/llms.txt Creates a new scenario within a study, linking a specific infrastructure and timetable. Requires the project ID, study ID, and a JSON payload with the scenario name, infrastructure ID, timetable ID, and tags. ```bash curl -s -X POST http://localhost:4000/api/project/1/study/1/scenario \ -H "Content-Type: application/json" \ -d '{"name": "Morning Peak", "infra_id": 42, "timetable_id": 7, "tags": []}' | jq . ``` -------------------------------- ### Preview Auto-fixes for Infrastructure Errors Source: https://context7.com/openrailassociation/osrd/llms.txt Previews potential auto-fixes for detected infrastructure modeling errors without applying them. ```bash # Preview auto-fixes without applying them curl -s "http://localhost:4000/api/infra/42/auto_fixes" ``` -------------------------------- ### Apply Batch Operations to Infrastructure (Create/Update/Delete) Source: https://context7.com/openrailassociation/osrd/llms.txt Applies a batch of create, update, or delete operations to infrastructure objects in a single atomic transaction. Requires specifying operation type, object type, and RailJSON data. ```bash # Apply a batch of operations to infra #42 # Each operation has a type ("create", "update", "delete") and an object payload curl -s -X POST http://localhost:4000/api/infra/42 \ -H "Content-Type: application/json" \ -d '[ { "operation_type": "create", "obj_type": "TrackSection", "railjson": { "id": "track_1", "length": 500.0, "slopes": [], "curves": [], "loading_gauge_limits": [], "geo": {"type": "LineString", "coordinates": [[0,0],[0.005,0]]}, "sch": {"type": "LineString", "coordinates": [[0,0],[0.005,0]]} } }, { "operation_type": "create", "obj_type": "BufferStop", "railjson": { "id": "bs_west", "track": "track_1", "position": 0.0, "applicable_directions": "BOTH" } } ]' ``` -------------------------------- ### SimulationBuilder API Source: https://github.com/openrailassociation/osrd/blob/dev/python/railjson_generator/README.md Methods for building simulation configurations. ```APIDOC ## SimulationBuilder ### Description Provides methods to build simulation configurations. ### Methods - `__init__()`: Instantiates a simulation builder. - `add_train_schedule(*locations, label="train.X", rolling_stock="fast_rolling_stock", departure_time=0, initial_speed=0, stops=[])`: Adds a new train schedule. - `build()`: Builds the simulation configuration. ``` -------------------------------- ### Run Tests with Custom Browser, Workers, and Retries Source: https://github.com/openrailassociation/osrd/blob/dev/front/tests/README.md Configure test execution with specific browser projects, retry attempts on failure, and parallel worker counts. ```bash npx playwright test --project=chromium --retries=1 --workers=2 ``` -------------------------------- ### Create Study within a Project Source: https://context7.com/openrailassociation/osrd/llms.txt Creates a new study within an existing project. Requires the project ID and a JSON payload with the study name, description, and tags. ```bash curl -s -X POST http://localhost:4000/api/project/1/study \ -H "Content-Type: application/json" \ -d '{"name": "2024 Timetable", "description": "baseline", "tags": []}' | jq . ``` -------------------------------- ### POST /api/rolling_stock Source: https://context7.com/openrailassociation/osrd/llms.txt Create a new rolling stock configuration in the database. ```APIDOC ## POST /api/rolling_stock ### Description Create a rolling stock. ### Method POST ### Endpoint /api/rolling_stock ### Parameters #### Request Body - (object) - Rolling stock data, typically from a JSON file. ### Request Example ```json { "id": 10, "name": "fast_rolling_stock", ... } ``` ### Response #### Success Response (200) - **id** (integer) - The ID of the newly created rolling stock. - **name** (string) - The name of the rolling stock. ```