This Elixir app processes reservation data from an input file and shows the transformed data on the console. For complete details, refer to the challenge description here.
Make sure you have Erlang and Elixir installed. Clone the repository and navigate to the project directory in your terminal.
-
Compiling and Running:
- Compile the project:
mix compile
. - Run the app:
mix run
.
- Compile the project:
-
Escript Execution:
- Generate an escript executable:
mix escript.build
- Run the escript with the input file path:
./fcm_challenge --input <input_file_path>
- Generate an escript executable:
-
Test.MixProject
Module:- Holds project configuration settings for dependencies, versions, Elixir compatibility, and escript creation.
-
ReservationTransformer
Module:- Handles processing and transforming the input file in multiple steps:
-
Reading and Filtering:
- Reads and filters valid reservation lines based on predefined criteria.
-
Segmentation and Sorting:
- Splits reservations into 'based' and trip 'segments', sorting segments using a comparison function.
-
Trip Grouping and Summary:
- Groups segments into trips and creates trip summaries by excluding base segments and detailing trip destinations.
-
Formatting and Output:
- Formats trip summaries and segments into a final output string for display.
-
- Handles processing and transforming the input file in multiple steps:
test/
directory holds the test suite with input files and expected output along with unit tests for modules.
- Erlang 24 (Ensure binaries are included in the
Path
environment variable) - Elixir 1.15.7
- VScode 1.84.2
- ElixirLS: Elixir support and debugger v0.17.10
- Elixir Test v1.8.0