<commit_before>defmodule GnServer.Logic.Assemble do

  alias GnServer.Data.Store, as: Store

  def menu_main do
    species = Store.menu_species
    nlist = Enum.map(species, fn(x) -> [_,sname,menu]=x ;
        [sname,menu,Store.menu_groups(sname)]
      end
    );
    groups = for [s,_,gs] <- nlist, into: %{}, do: { s, gs }

    types =
      for [s,smenu,gs] <- nlist, # for every species,group combi
        into: %{},
        do: { s, [smenu , (
              for [_,gname,_] <- gs,
                into: %{},
                do: { gname, Store.menu_types(s,gname) } ) ]
        }

    datasets =
        for [s, smenu, gs] <- nlist,
          into: %{},
          do: { s, (
              for [_,gname,_] <- gs,
                into: %{},
                do: { gname, (
                   for [t] <- Store.menu_types(s,gname),
                     into: %{},
                     do: { t, Store.menu_datasets(s,gname,t) }
               )}

        )}
    %{ # species: species,
       groups: groups,
       types: types,
       datasets: datasets }
  end

end<commit_msg>Menu: rename elements in JSON<commit_after>defmodule GnServer.Logic.Assemble do

  alias GnServer.Data.Store, as: Store

  def menu_main do
    species = Store.menu_species
    nlist = Enum.map(species, fn(x) -> [_,sname,menu]=x ;
        [sname,menu,Store.menu_groups(sname)]
      end
    );
    groups = for [s,_,gs] <- nlist, into: %{}, do: { s, gs }

    types =
      for [s,smenu,gs] <- nlist, # for every species,group combi
        into: %{},
        do: { s, %{ "menu" => smenu , "types" => (
              for [_,gname,_] <- gs,
                into: %{},
                do: { gname, Store.menu_types(s,gname) } ) }
        }

    datasets =
        for [s, smenu, gs] <- nlist,
          into: %{},
          do: { s, (
              for [_,gname,_] <- gs,
                into: %{},
                do: { gname, (
                   for [t] <- Store.menu_types(s,gname),
                     into: %{},
                     do: { t, Store.menu_datasets(s,gname,t) }
               )}

        )}
    %{ # species: species,
       groups: groups,
       menu: types,
       datasets: datasets }
  end

end
{'fraction_non_alphanumeric': 0.15559599636032756, 'fraction_numerical': 0.0, 'mean_word_length': 1.4487750556792873, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6679572', 'n_tokens_mistral': 782, 'n_tokens_neox': 735, 'n_words': 159}