Need Help how to refactor this code with Elixir to be more readable and to avoid nested cases

Thank you so much for your help ! this so readable and so clear ! :smiley: :smiley: