From 3c152590c451beb75d70dc58c475e71a1d21c08a Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Tue, 18 Aug 2020 09:15:58 +0200
Subject: [PATCH] Setup

---
 .gitignore                    |   1 +
 Dockerfile                    |   4 +-
 docs/dev/setup.md             |   8 +
 gui/src/searchQuantities.json | 728 ----------------------------------
 nomad/cli/dev.py              |  29 ++
 nomad/search.py               |  27 --
 setup.sh                      |   9 +-
 7 files changed, 47 insertions(+), 759 deletions(-)
 delete mode 100644 gui/src/searchQuantities.json

diff --git a/.gitignore b/.gitignore
index dfafb89a9f..25384ba2bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ dist/
 setup.json
 parser.osio.log
 gui/src/metainfo.json
+gui/src/searchQuantities.json
diff --git a/Dockerfile b/Dockerfile
index 406993b064..afe60f2b0a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -68,8 +68,8 @@ RUN pip install .[all]
 RUN python setup.py sdist
 RUN cp dist/nomad-lab-*.tar.gz dist/nomad-lab.tar.gz
 RUN python -m nomad.cli dev metainfo > gui/src/metainfo.json
+RUN python -m nomad.cli dev search-quantities > gui/src/searchQuantities.json
 WORKDIR /install/docs
-# COPY --from=gui_build /app/react-docgen.out /install/docs
 RUN make html
 RUN \
     find /usr/local/lib/python3.7/ -name 'tests' ! -path '*/networkx/*' -exec rm -r '{}' + && \
@@ -86,8 +86,8 @@ COPY gui/yarn.lock /app/yarn.lock
 RUN yarn
 COPY gui /app
 COPY --from=build /install/gui/src/metainfo.json /app/src/metainfo.json
+COPY --from=build /install/gui/src/searchQuantities.json /app/src/searchQuantities.json
 RUN yarn run build
-# RUN yarn run --silent react-docgen src/components --pretty > react-docgen.out
 
 # Build the Encyclopedia GUI in the gui build image
 RUN mkdir -p /encyclopedia
diff --git a/docs/dev/setup.md b/docs/dev/setup.md
index 7885f4a2e7..a40307be6d 100644
--- a/docs/dev/setup.md
+++ b/docs/dev/setup.md
@@ -116,6 +116,14 @@ Finally, you can add nomad to the environment itself (including all extras)
 pip install -e .[all]
 ```
 
+### Generate GUI artifacts
+The NOMAD GUI requires static artifacts that are generated from the NOMAD Python codes.
+```
+nomad dev metainfo > gui/src/metainfo.json
+nomad dev searchQuantities > gui/src/searchQuantities.json
+./gitinfo.sh
+```
+
 ## Build and run the infrastructure with docker
 
 ### Docker and nomad
diff --git a/gui/src/searchQuantities.json b/gui/src/searchQuantities.json
deleted file mode 100644
index 2c3caf9f5a..0000000000
--- a/gui/src/searchQuantities.json
+++ /dev/null
@@ -1,728 +0,0 @@
-{
-  "ems.chemical": {
-    "name": "ems.chemical",
-    "description": null,
-    "many": false
-  },
-  "ems.sample_constituents": {
-    "name": "ems.sample_constituents",
-    "description": null,
-    "many": false
-  },
-  "ems.sample_microstructure": {
-    "name": "ems.sample_microstructure",
-    "description": null,
-    "many": false
-  },
-  "ems.experiment_summary": {
-    "name": "ems.experiment_summary",
-    "description": null,
-    "many": false
-  },
-  "ems.experiment_location": {
-    "name": "ems.experiment_location",
-    "description": null,
-    "many": false
-  },
-  "ems.experiment_time": {
-    "name": "ems.experiment_time",
-    "description": null,
-    "many": false
-  },
-  "ems.method": {
-    "name": "ems.method",
-    "description": null,
-    "many": false
-  },
-  "ems.probing_method": {
-    "name": "ems.probing_method",
-    "description": null,
-    "many": false
-  },
-  "ems.repository_name": {
-    "name": "ems.repository_name",
-    "description": null,
-    "many": false
-  },
-  "ems.repository_url": {
-    "name": "ems.repository_url",
-    "description": null,
-    "many": false
-  },
-  "ems.entry_repository_url": {
-    "name": "ems.entry_repository_url",
-    "description": null,
-    "many": false
-  },
-  "ems.preview_url": {
-    "name": "ems.preview_url",
-    "description": null,
-    "many": false
-  },
-  "ems.quantities": {
-    "name": "ems.quantities",
-    "description": null,
-    "many": false
-  },
-  "ems.group_hash": {
-    "name": "ems.group_hash",
-    "description": null,
-    "many": false
-  },
-  "dft.labels.label": {
-    "name": "dft.labels.label",
-    "description": "The label as a string",
-    "many": false
-  },
-  "dft.labels.type": {
-    "name": "dft.labels.type",
-    "description": "The type of the label",
-    "many": false
-  },
-  "dft.labels.source": {
-    "name": "dft.labels.source",
-    "description": "The source that this label was taken from.",
-    "many": false
-  },
-  "dft.optimade.elements": {
-    "name": "dft.optimade.elements",
-    "description": "Names of the different elements present in the structure.",
-    "many": false
-  },
-  "dft.optimade.nelements": {
-    "name": "dft.optimade.nelements",
-    "description": "Number of different elements in the structure as an integer.",
-    "many": false
-  },
-  "dft.optimade.elements_ratios": {
-    "name": "dft.optimade.elements_ratios",
-    "description": "Relative proportions of different elements in the structure.",
-    "many": false
-  },
-  "dft.optimade.chemical_formula_descriptive": {
-    "name": "dft.optimade.chemical_formula_descriptive",
-    "description": "The chemical formula for a structure as a string in a form chosen by the API\nimplementation.",
-    "many": false
-  },
-  "dft.optimade.chemical_formula_reduced": {
-    "name": "dft.optimade.chemical_formula_reduced",
-    "description": "The reduced chemical formula for a structure as a string with element symbols and\ninteger chemical proportion numbers. The proportion number MUST be omitted if it is 1.",
-    "many": false
-  },
-  "dft.optimade.chemical_formula_hill": {
-    "name": "dft.optimade.chemical_formula_hill",
-    "description": "The chemical formula for a structure in Hill form with element symbols followed by\ninteger chemical proportion numbers. The proportion number MUST be omitted if it is 1.",
-    "many": false
-  },
-  "dft.optimade.chemical_formula_anonymous": {
-    "name": "dft.optimade.chemical_formula_anonymous",
-    "description": "The anonymous formula is the chemical_formula_reduced, but where the elements are\ninstead first ordered by their chemical proportion number, and then, in order left to\nright, replaced by anonymous symbols A, B, C, ..., Z, Aa, Ba, ..., Za, Ab, Bb, ... and\nso on.",
-    "many": false
-  },
-  "dft.optimade.dimension_types": {
-    "name": "dft.optimade.dimension_types",
-    "description": "List of three integers. For each of the three directions indicated by the three lattice\nvectors (see property lattice_vectors). This list indicates if the direction is\nperiodic (value 1) or non-periodic (value 0). Note: the elements in this list each\nrefer to the direction of the corresponding entry in lattice_vectors and not\nthe Cartesian x, y, z directions.",
-    "many": false
-  },
-  "dft.optimade.nsites": {
-    "name": "dft.optimade.nsites",
-    "description": "An integer specifying the length of the cartesian_site_positions property.",
-    "many": false
-  },
-  "dft.optimade.structure_features": {
-    "name": "dft.optimade.structure_features",
-    "description": "A list of strings that flag which special features are used by the structure.\n\n- disorder: This flag MUST be present if any one entry in the species list has a\nchemical_symbols list that is longer than 1 element.\n- unknown_positions: This flag MUST be present if at least one component of the\ncartesian_site_positions list of lists has value null.\n- assemblies: This flag MUST be present if the assemblies list is present.",
-    "many": false
-  },
-  "dft.basis_set": {
-    "name": "dft.basis_set",
-    "description": "The used basis set functions.",
-    "many": false,
-    "statistic_size": 9,
-    "statistic_values": [
-      "(L)APW+lo",
-      "FLAPW",
-      "gaussians",
-      "numeric AOs",
-      "plane waves",
-      "psinc functions",
-      "real-space grid",
-      "unavailable",
-      "not processed"
-    ]
-  },
-  "dft.xc_functional": {
-    "name": "dft.xc_functional",
-    "description": "The libXC based xc functional classification used in the simulation.",
-    "many": false,
-    "statistic_size": 9,
-    "statistic_values": [
-      "GGA",
-      "HF",
-      "OEP",
-      "hybrid",
-      "meta-GGA",
-      "vdW",
-      "LDA",
-      "unavailable",
-      "not processed"
-    ]
-  },
-  "dft.system": {
-    "name": "dft.system",
-    "description": "The system type of the simulated system.",
-    "many": false,
-    "statistic_size": 8,
-    "statistic_values": [
-      "1D",
-      "2D",
-      "atom",
-      "bulk",
-      "molecule / cluster",
-      "surface",
-      "unavailable",
-      "not processed"
-    ]
-  },
-  "dft.compound_type": {
-    "name": "dft.compound_type",
-    "description": "The compound type of the simulated system.",
-    "many": false,
-    "statistic_size": 11,
-    "statistic_values": [
-      "unary",
-      "binary",
-      "ternary",
-      "quaternary",
-      "quinary",
-      "sexinary",
-      "septenary",
-      "octanary",
-      "nonary",
-      "decinary",
-      "not processed"
-    ]
-  },
-  "dft.crystal_system": {
-    "name": "dft.crystal_system",
-    "description": "The crystal system type of the simulated system.",
-    "many": false,
-    "statistic_size": 9,
-    "statistic_values": [
-      "cubic",
-      "hexagonal",
-      "monoclinic",
-      "orthorhombic",
-      "tetragonal",
-      "triclinic",
-      "trigonal",
-      "unavailable",
-      "not processed"
-    ]
-  },
-  "dft.spacegroup": {
-    "name": "dft.spacegroup",
-    "description": "The spacegroup of the simulated system as number.",
-    "many": false
-  },
-  "dft.spacegroup_symbol": {
-    "name": "dft.spacegroup_symbol",
-    "description": "The spacegroup as international short symbol.",
-    "many": false
-  },
-  "dft.code_name": {
-    "name": "dft.code_name",
-    "description": "The name of the used code.",
-    "many": false
-  },
-  "dft.code_version": {
-    "name": "dft.code_version",
-    "description": "The version of the used code.",
-    "many": false
-  },
-  "dft.n_geometries": {
-    "name": "dft.n_geometries",
-    "description": "Number of unique geometries.",
-    "many": false
-  },
-  "dft.n_calculations": {
-    "name": "dft.n_calculations",
-    "description": "Number of single configuration calculation sections",
-    "many": false
-  },
-  "dft.n_total_energies": {
-    "name": "dft.n_total_energies",
-    "description": "Number of total energy calculations",
-    "many": false
-  },
-  "dft.n_quantities": {
-    "name": "dft.n_quantities",
-    "description": "Number of metainfo quantities parsed from the entry.",
-    "many": false
-  },
-  "dft.quantities": {
-    "name": "dft.quantities",
-    "description": "All quantities that are used by this entry.",
-    "many": true
-  },
-  "dft.searchable_quantities": {
-    "name": "dft.searchable_quantities",
-    "description": "All quantities with existence filters in the search GUI.",
-    "many": true,
-    "statistic_size": 23
-  },
-  "dft.geometries": {
-    "name": "dft.geometries",
-    "description": "Hashes for each simulated geometry",
-    "many": false
-  },
-  "dft.group_hash": {
-    "name": "dft.group_hash",
-    "description": "Hashes that describe unique geometries simulated by this code run.",
-    "many": true
-  },
-  "dft.labels_springer_compound_class": {
-    "name": "dft.labels_springer_compound_class",
-    "description": "Springer compund classification.",
-    "many": true,
-    "statistic_size": 20
-  },
-  "dft.labels_springer_classification": {
-    "name": "dft.labels_springer_classification",
-    "description": "Springer classification by property.",
-    "many": true,
-    "statistic_size": 20
-  },
-  "dft.workflow.workflow_type": {
-    "name": "dft.workflow.workflow_type",
-    "description": "The type of calculation workflow. Can be one of relaxation, elastic, phonon,\nmolecular dynamics.",
-    "many": false
-  },
-  "dft.workflow.relaxation_energy_tolerance": {
-    "name": "dft.workflow.relaxation_energy_tolerance",
-    "description": "The tolerance value in the energy between relaxation steps for convergence.",
-    "many": false
-  },
-  "dft.workflow": {
-    "name": "dft.workflow",
-    "description": null,
-    "many": false
-  },
-  "encyclopedia.material.bulk.bravais_lattice": {
-    "name": "encyclopedia.material.bulk.bravais_lattice",
-    "description": "The Bravais lattice type in the Pearson notation, where the first\nlowercase letter indicates the crystal system, and the second uppercase\nletter indicates the lattice type. The value can only be one of the 14\ndifferent Bravais lattices in three dimensions.\n\nCrystal system letters:\n\na = Triclinic\nm = Monoclinic\no = Orthorhombic\nt = Tetragonal\nh = Hexagonal and Trigonal\nc = Cubic\n\nLattice type letters:\n\nP = Primitive\nS (A, B, C) = One side/face centred\nI = Body centered\nR = Rhombohedral centring\nF = All faces centred",
-    "many": false
-  },
-  "encyclopedia.material.bulk.crystal_system": {
-    "name": "encyclopedia.material.bulk.crystal_system",
-    "description": "The detected crystal system. One of seven possibilities in three dimensions.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.has_free_wyckoff_parameters": {
-    "name": "encyclopedia.material.bulk.has_free_wyckoff_parameters",
-    "description": "Whether the material has any Wyckoff sites with free parameters. If a\nmaterials has free Wyckoff parameters, at least some of the atoms are\nnot bound to a particular location in the structure but are allowed to\nmove with possible restrictions set by the symmetry.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.point_group": {
-    "name": "encyclopedia.material.bulk.point_group",
-    "description": "Point group in Hermann-Mauguin notation, part of crystal structure\nclassification. There are 32 point groups in three dimensional space.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.space_group_number": {
-    "name": "encyclopedia.material.bulk.space_group_number",
-    "description": "Integer representation of the space group, part of crystal structure\nclassification, part of material definition.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.space_group_international_short_symbol": {
-    "name": "encyclopedia.material.bulk.space_group_international_short_symbol",
-    "description": "International short symbol notation of the space group.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.structure_prototype": {
-    "name": "encyclopedia.material.bulk.structure_prototype",
-    "description": "The prototypical material for this crystal structure.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.structure_type": {
-    "name": "encyclopedia.material.bulk.structure_type",
-    "description": "Classification according to known structure type, considering the point\ngroup of the crystal and the occupations with different atom types.",
-    "many": false
-  },
-  "encyclopedia.material.bulk.strukturbericht_designation": {
-    "name": "encyclopedia.material.bulk.strukturbericht_designation",
-    "description": "Classification of the material according to the historically grown \"strukturbericht\".",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.a": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.a",
-    "description": "Length of the first basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.b": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.b",
-    "description": "Length of the second basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.c": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.c",
-    "description": "Length of the third basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.alpha": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.alpha",
-    "description": "Angle between second and third basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.beta": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.beta",
-    "description": "Angle between first and third basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.lattice_parameters.gamma": {
-    "name": "encyclopedia.material.idealized_structure.lattice_parameters.gamma",
-    "description": "Angle between first and second basis vector.",
-    "many": false
-  },
-  "encyclopedia.material.idealized_structure.cell_volume": {
-    "name": "encyclopedia.material.idealized_structure.cell_volume",
-    "description": "Volume of the idealized cell. The cell volume can only be reported\nconsistently after idealization and may not perfectly correspond to the\noriginal simulation cell.",
-    "many": false
-  },
-  "encyclopedia.material.material_type": {
-    "name": "encyclopedia.material.material_type",
-    "description": "\"Broad structural classification for the material, e.g. bulk, 2D, 1D... \",",
-    "many": false
-  },
-  "encyclopedia.material.material_id": {
-    "name": "encyclopedia.material.material_id",
-    "description": "Search for a particular material by its id.",
-    "many": false
-  },
-  "encyclopedia.material.material_name": {
-    "name": "encyclopedia.material.material_name",
-    "description": "Most meaningful name for a material.",
-    "many": false
-  },
-  "encyclopedia.material.formula": {
-    "name": "encyclopedia.material.formula",
-    "description": "Formula giving the composition and occurrences of the elements in the\nHill notation. For periodic materials the formula is calculated fom the\nprimitive unit cell.",
-    "many": false
-  },
-  "encyclopedia.material.formula_reduced": {
-    "name": "encyclopedia.material.formula_reduced",
-    "description": "Formula giving the composition and occurrences of the elements in the\nHill notation where the number of occurences have been divided by the\ngreatest common divisor.",
-    "many": false
-  },
-  "encyclopedia.material.species_and_counts": {
-    "name": "encyclopedia.material.species_and_counts",
-    "description": "The formula separated into individual terms containing both the atom\ntype and count. Used for searching parts of a formula.",
-    "many": false
-  },
-  "encyclopedia.material.species": {
-    "name": "encyclopedia.material.species",
-    "description": "The formula separated into individual terms containing only unique atom\nspecies. Used for searching materials containing specific elements.",
-    "many": false
-  },
-  "encyclopedia.method.method_type": {
-    "name": "encyclopedia.method.method_type",
-    "description": "Generic name for the used methodology.",
-    "many": false
-  },
-  "encyclopedia.method.core_electron_treatment": {
-    "name": "encyclopedia.method.core_electron_treatment",
-    "description": "How the core electrons are described.",
-    "many": false
-  },
-  "encyclopedia.method.functional_long_name": {
-    "name": "encyclopedia.method.functional_long_name",
-    "description": "Full identified for the used exchange-correlation functional.",
-    "many": false
-  },
-  "encyclopedia.method.functional_type": {
-    "name": "encyclopedia.method.functional_type",
-    "description": "Basic type of the used exchange-correlation functional.",
-    "many": false
-  },
-  "encyclopedia.method.group_eos_id": {
-    "name": "encyclopedia.method.group_eos_id",
-    "description": "A fixed length, unique identifier for equation-of-state calculations.\nOnly calculations within the same upload and with a method hash\navailable will be grouped under the same hash.",
-    "many": false
-  },
-  "encyclopedia.method.group_parametervariation_id": {
-    "name": "encyclopedia.method.group_parametervariation_id",
-    "description": "A fixed length, unique identifier for calculations where structure is\nidentical but the used computational parameters are varied. Only\ncalculations within the same upload and with a method hash available\nwill be grouped under the same hash.",
-    "many": false
-  },
-  "encyclopedia.properties.energies.energy_total": {
-    "name": "encyclopedia.properties.energies.energy_total",
-    "description": "Total energy.",
-    "many": false
-  },
-  "encyclopedia.properties.energies.energy_total_T0": {
-    "name": "encyclopedia.properties.energies.energy_total_T0",
-    "description": "Total energy projected to T=0.",
-    "many": false
-  },
-  "encyclopedia.properties.energies.energy_free": {
-    "name": "encyclopedia.properties.energies.energy_free",
-    "description": "Free energy.",
-    "many": false
-  },
-  "encyclopedia.properties.atomic_density": {
-    "name": "encyclopedia.properties.atomic_density",
-    "description": "Atomic density of the material (atoms/volume).\"",
-    "many": false
-  },
-  "encyclopedia.properties.mass_density": {
-    "name": "encyclopedia.properties.mass_density",
-    "description": "Mass density of the material.",
-    "many": false
-  },
-  "encyclopedia.properties.band_gap": {
-    "name": "encyclopedia.properties.band_gap",
-    "description": "Band gap value. If multiple spin channels are present, this value is\ntaken from the channel with smallest band gap value.",
-    "many": false
-  },
-  "encyclopedia.properties.band_gap_direct": {
-    "name": "encyclopedia.properties.band_gap_direct",
-    "description": "Whether band gap is direct or not. If multiple spin channels are\npresent, this value is taken from the channel with smallest band gap\nvalue.",
-    "many": false
-  },
-  "encyclopedia.properties.electronic_band_structure": {
-    "name": "encyclopedia.properties.electronic_band_structure",
-    "description": "Reference to an electronic band structure.",
-    "many": false
-  },
-  "encyclopedia.properties.electronic_dos": {
-    "name": "encyclopedia.properties.electronic_dos",
-    "description": "Reference to an electronic density of states.",
-    "many": false
-  },
-  "encyclopedia.properties.phonon_band_structure": {
-    "name": "encyclopedia.properties.phonon_band_structure",
-    "description": "Reference to a phonon band structure.",
-    "many": false
-  },
-  "encyclopedia.properties.phonon_dos": {
-    "name": "encyclopedia.properties.phonon_dos",
-    "description": "Reference to a phonon density of states.",
-    "many": false
-  },
-  "encyclopedia.properties.thermodynamical_properties": {
-    "name": "encyclopedia.properties.thermodynamical_properties",
-    "description": "Reference to a section containing thermodynamical properties.",
-    "many": false
-  },
-  "encyclopedia.calculation.calculation_type": {
-    "name": "encyclopedia.calculation.calculation_type",
-    "description": "Defines the type of calculation that was detected for this entry.",
-    "many": false
-  },
-  "encyclopedia.status": {
-    "name": "encyclopedia.status",
-    "description": "The final Encyclopedia processing status for this entry. The meaning of the status is as follows:\n\n| Status                           | Description                                                                   |\n| -------------------------------- | ----------------------------------------------------------------------------- |\n| `\"success\"`                      | Processed successfully                                                        |\n| `\"unsupported_material_type\"`    | The detected material type is currently not supported by the Encyclopedia.    |\n| `\"unsupported_calculation_type\"` | The detected calculation type is currently not supported by the Encyclopedia. |\n| `\"invalid_metainfo\"`             | The entry could not be processed due to missing or invalid metainfo.          |\n| `\"failure\"`                      | The entry could not be processed due to an unexpected exception.              |",
-    "many": false
-  },
-  "upload_id": {
-    "name": "upload_id",
-    "description": "A random UUID that uniquely identifies the upload of the entry.",
-    "many": true
-  },
-  "calc_id": {
-    "name": "calc_id",
-    "description": "A unique ID based on the upload id and entry's mainfile.",
-    "many": true
-  },
-  "calc_hash": {
-    "name": "calc_hash",
-    "description": "A raw file content based checksum/hash.",
-    "many": true
-  },
-  "mainfile": {
-    "name": "mainfile",
-    "description": "Search within the mainfile path.",
-    "many": true
-  },
-  "mainfile_path": {
-    "name": "mainfile_path",
-    "description": "Search for the exact mainfile.",
-    "many": true
-  },
-  "path": {
-    "name": "path",
-    "description": "Search within the paths.",
-    "many": false
-  },
-  "files": {
-    "name": "files",
-    "description": "Search for exact paths.",
-    "many": true
-  },
-  "pid": {
-    "name": "pid",
-    "description": "The unique, sequentially enumerated, integer persistent identifier",
-    "many": true
-  },
-  "raw_id": {
-    "name": "raw_id",
-    "description": "A raw format specific id that was acquired from the files of this entry",
-    "many": true
-  },
-  "domain": {
-    "name": "domain",
-    "description": "The material science domain",
-    "many": false
-  },
-  "published": {
-    "name": "published",
-    "description": "Indicates if the entry is published",
-    "many": false
-  },
-  "processed": {
-    "name": "processed",
-    "description": "Indicates that the entry is successfully processed.",
-    "many": false
-  },
-  "last_processing": {
-    "name": "last_processing",
-    "description": "The datetime of the last attempted processing.",
-    "many": false
-  },
-  "nomad_version": {
-    "name": "nomad_version",
-    "description": "The NOMAD version used for the last processing attempt.",
-    "many": true
-  },
-  "nomad_commit": {
-    "name": "nomad_commit",
-    "description": "The NOMAD commit used for the last processing attempt.",
-    "many": true
-  },
-  "parser_name": {
-    "name": "parser_name",
-    "description": "The NOMAD parser used for the last processing attempt.",
-    "many": true
-  },
-  "comment": {
-    "name": "comment",
-    "description": "A user provided comment.",
-    "many": false
-  },
-  "references": {
-    "name": "references",
-    "description": "User provided references (URLs).",
-    "many": false
-  },
-  "uploader.user_id": {
-    "name": "uploader.user_id",
-    "description": "The unique, persistent keycloak UUID",
-    "many": false
-  },
-  "uploader.name": {
-    "name": "uploader.name",
-    "description": null,
-    "many": false
-  },
-  "uploader.email": {
-    "name": "uploader.email",
-    "description": null,
-    "many": false
-  },
-  "uploader": {
-    "name": "uploader",
-    "description": "Search uploader with exact names.",
-    "many": true,
-    "statistic_size": 10
-  },
-  "uploader_id": {
-    "name": "uploader_id",
-    "description": "The uploader of the entry",
-    "many": false
-  },
-  "authors": {
-    "name": "authors",
-    "description": "Search authors with exact names.",
-    "many": true
-  },
-  "owners": {
-    "name": "owners",
-    "description": "Search owner with exact names.",
-    "many": true
-  },
-  "with_embargo": {
-    "name": "with_embargo",
-    "description": "Indicated if this entry is under an embargo",
-    "many": false
-  },
-  "upload_time": {
-    "name": "upload_time",
-    "description": "The datetime this entry was uploaded to nomad",
-    "many": false
-  },
-  "upload_name": {
-    "name": "upload_name",
-    "description": "The user provided upload name",
-    "many": true
-  },
-  "datasets.dataset_id": {
-    "name": "datasets.dataset_id",
-    "description": "The unique identifier for this dataset as a string. It should be\na randomly generated UUID, similar to other nomad ids.",
-    "many": false
-  },
-  "datasets.name": {
-    "name": "datasets.name",
-    "description": "The human readable name of the dataset as string. The dataset name must be\nunique for the user.",
-    "many": false
-  },
-  "datasets.doi": {
-    "name": "datasets.doi",
-    "description": "The optional Document Object Identifier (DOI) associated with this dataset.\nNomad can register DOIs that link back to the respective representation of\nthe dataset in the nomad UI. This quantity holds the string representation of\nthis DOI. There is only one per dataset. The DOI is just the DOI name, not its\nfull URL, e.g. \"10.17172/nomad/2019.10.29-1\".",
-    "many": false
-  },
-  "datasets.created": {
-    "name": "datasets.created",
-    "description": "The date when the dataset was first created.",
-    "many": false
-  },
-  "datasets": {
-    "name": "datasets",
-    "description": "Search for a particular dataset by exact name.",
-    "many": true
-  },
-  "dataset_id": {
-    "name": "dataset_id",
-    "description": "Search for a particular dataset by its id.",
-    "many": true
-  },
-  "external_id": {
-    "name": "external_id",
-    "description": "A user provided external id.",
-    "many": true
-  },
-  "last_edit": {
-    "name": "last_edit",
-    "description": "The datetime the user metadata was edited last.",
-    "many": false
-  },
-  "formula": {
-    "name": "formula",
-    "description": "A (reduced) chemical formula.",
-    "many": false
-  },
-  "atoms": {
-    "name": "atoms",
-    "description": "The atom labels of all atoms of the entry's material.",
-    "many": true,
-    "statistic_size": 119
-  },
-  "only_atoms": {
-    "name": "only_atoms",
-    "description": "The atom labels concatenated in order-number order.",
-    "many": true
-  },
-  "n_atoms": {
-    "name": "n_atoms",
-    "description": "The number of atoms in the entry's material",
-    "many": false
-  }
-}
diff --git a/nomad/cli/dev.py b/nomad/cli/dev.py
index f6f955e7a9..8c05c7246d 100644
--- a/nomad/cli/dev.py
+++ b/nomad/cli/dev.py
@@ -75,6 +75,35 @@ def metainfo():
     print(json.dumps(export.m_to_dict(with_meta=True), indent=2))
 
 
+@dev.command(help='Generates a JSON with all search quantities.')
+def search_quantities():
+    from nomad import search
+    # Due to this import, the parsing module will register all code_names based on parser
+    # implementations.
+    from nomad import parsing  # pylint: disable=unused-import
+    import json
+
+    def to_dict(search_quantity):
+        result = {
+            'name': search_quantity.qualified_name,
+            'description': search_quantity.description,
+            'many': search_quantity.many,
+        }
+
+        if search_quantity.statistic_fixed_size is not None:
+            result['statistic_size'] = search_quantity.statistic_fixed_size
+        if search_quantity.statistic_values is not None:
+            result['statistic_values'] = search_quantity.statistic_values
+
+        return result
+
+    export = {
+        search_quantity.qualified_name: to_dict(search_quantity)
+        for search_quantity in search.search_quantities.values()
+    }
+    print(json.dumps(export, indent=2))
+
+
 @dev.command(help='Generates source-code for the new metainfo from .json files of the old.')
 @click.argument('path', nargs=-1)
 def legacy_metainfo(path):
diff --git a/nomad/search.py b/nomad/search.py
index 94e2976921..588e5e8252 100644
--- a/nomad/search.py
+++ b/nomad/search.py
@@ -753,30 +753,3 @@ def flat(obj, prefix=None):
         return result
     else:
         return obj
-
-
-if __name__ == '__main__':
-    # Due to this import, the parsing module will register all code_names based on parser
-    # implementations.
-    from nomad import parsing  # pylint: disable=unused-import
-    import json
-
-    def to_dict(search_quantity):
-        result = {
-            'name': search_quantity.qualified_name,
-            'description': search_quantity.description,
-            'many': search_quantity.many,
-        }
-
-        if search_quantity.statistic_fixed_size is not None:
-            result['statistic_size'] = search_quantity.statistic_fixed_size
-        if search_quantity.statistic_values is not None:
-            result['statistic_values'] = search_quantity.statistic_values
-
-        return result
-
-    export = {
-        search_quantity.qualified_name: to_dict(search_quantity)
-        for search_quantity in search_quantities.values()
-    }
-    print(json.dumps(export, indent=2))
diff --git a/setup.sh b/setup.sh
index c2239be45b..aba6a9fb23 100755
--- a/setup.sh
+++ b/setup.sh
@@ -1,8 +1,13 @@
-#!/bin/sh
+#!/bin/bash
 
 set -e
 
+pip install --upgrade pip
+
 git submodule sync
 git submodule update --init --jobs=4
 ./dependencies.sh -e
-pip install -e .[all]
\ No newline at end of file
+pip install -e .[all]
+
+nomad dev metainfo > gui/src/metainfo.json
+nomad dev search-quantities > gui/src/search-quantities.json
-- 
GitLab