nomad-hzb / nomad-chemical-energy

Apache License 2.0
1 stars 1 forks source link

Add explore view for voila #3

Closed RoteKekse closed 1 month ago

RoteKekse commented 4 months ago

Please add an explore view for voila schema. Add sth like below to your nomad.yaml file https://nomad-lab.eu/prod/v1/staging/docs/howto/oasis/apps.html

ui:
  unit_systems:
    selected: 'my_units'
    options:
      my_units:
        label: 'my_units'
        units:
          current:
             definition: 'mA'
          length:
            definition: 'cm'
  apps:
    # Configures which apps to show. Note that the app for 'entries' (which
    # corresponds to searching all entries) has to be included at the moment.
                #- 'data.name#baseclasses.chemical_energy.voltammetry.Voltammetry'
                #- 'data.voltage_shift#baseclasses.chemical_energy.voltammetry.Voltammetry'
                #- 'data.resistance#baseclasses.chemical_energy.voltammetry.Voltammetry'
    include:
      - 'eln'
      - 'solarcells'
      - 'entries'
      - 'voltammetry'
      - 'environments'
      - 'nkdata'
    # Configures a new app for samples
    options:
      nkdata:
        # Label of the App
        label: 'NK Data'
        # Path used in the URL, must be unique
        path: 'nkdata'
        # Used to categorize apps in the explore menu
        category: 'Experiment'
        # Brief description used in the app menu
        description: 'An app customized for NK Data.'
        # Longer description that can also use markdown
        # Controls which columns are shown in the results table
        columns:
          selected:
            - 'entry_name'
            - 'data.chemical_composition_or_formulas#hysprint_s.HZB_NKData'
            - 'entry_create_time'
            - 'entry_type'
            - 'authors'
            - 'upload_name'
          options:
            entry_name:
              label: 'Name'
              align: 'left'
            results.material.elements:
              label: 'Elements'
              align: 'left'
            data.chemical_composition_or_formulas#hysprint_s.HZB_NKData:
              label: 'Elements and Formulas'
              align: 'left'
            results.material.chemical_formula_hill:
              label: 'Formula'
              align: 'left'
            entry_type:
              label: 'Entry type'
              align: 'left'
            upload_name:
              label: 'Upload name'
              align: 'left'
            upload_id:
              label: 'Upload id'
              align: 'left'
            upload_create_time:
              label: 'Upload time'
              align: 'left'
            entry_create_time:
              label: 'Entry time'
              align: 'left'
            authors:
              label: 'Authors'
              align: 'left'
        # Dictionary of search filters that are always enabled for queries made within
        # this app. This is especially important to narrow down the results to the
        # wanted subset. Any available search filter can be targeted here.
        filters:
          include:
            - '*#hysprint_s.HZB_NKData'
        filters_locked:
          section_defs.definition_qualified_name: 'hysprint_s.HZB_NKData'

        # Controls the filter menus shown on the left
        filter_menus:
          options:
            material:
              label: 'Material'
              level: 0
            elements:
              label: 'Elements / Formula'
              level: 1
              size: 'xl'
            eln:
              label: 'Electronic Lab Notebook'
              level: 0
            custom_quantities:
              label: 'User Defined Quantities'
              level: 0
              size: 'l'
            author:
              label: 'Author / Origin / Dataset'
              level: 0
              size: 'm'
            metadata:
              label: 'Visibility / IDs / Schema'
              level: 0
        dashboard:
          widgets:
            - type: 'periodictable'
              scale: 'linear'
              quantity: 'results.material.elements'
              layout:
                xxl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 12
                  y: 0
                  x: 6
                xl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 12
                  y: 0
                  x: 0
                lg:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 12
                  y: 0
                  x: 6
                md:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 12
                  y: 0
                  x: 6
                sm:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 12
                  y: 0
                  x: 6
            - type: scatterplot
              autorange: true
              color: results.material.n_elements
              y: data.data.n_data.maximum#hysprint_s.HZB_NKData
              x: data.data.n_data.minimum#hysprint_s.HZB_NKData
              layout:
                xxl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 6
                xl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0
                lg:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 6
                md:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 6
                sm:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 6
carla-terboven commented 4 months ago

Since the yaml file type is not supported here, I add my nomad.yaml this way:

keycloak:
  realm_name: fairdi_nomad_test
north:
  hub_connect_ip: 'host.docker.internal'
  jupyterhub_crypt_key: '0696e441589e13e933ff977a74da325cf266e507f51a129668555f08525a97fe'

ui:
  apps:
    # Configures which apps to show. Note that the app for 'entries' (which
    # corresponds to searching all entries) has to be included at the moment.
                #- 'data.name#baseclasses.chemical_energy.voltammetry.Voltammetry'
                #- 'data.voltage_shift#baseclasses.chemical_energy.voltammetry.Voltammetry'
                #- 'data.resistance#baseclasses.chemical_energy.voltammetry.Voltammetry'
    include:
      - 'eln'
      - 'entries'
      - 'voila'
    # Configures a new app for samples
    options:
      voila:
        # Label of the App
        label: 'Voila'
        # Path used in the URL, must be unique
        path: 'voila'
        # Used to categorize apps in the explore menu
        category: 'Use Cases'
        # Brief description used in the app menu
        description: 'Search Voila notebooks.'
        # Longer description that can also use markdown
        # Controls which columns are shown in the results table
        columns:
          selected:
            - 'entry_name'
            - 'entry_create_time'
            - 'entry_type'
            - 'authors'
            - 'upload_name'
            - 'upload_id'
          options:
            entry_name:
              label: 'Name'
              align: 'left'
            entry_create_time:
              label: 'Entry time'
              align: 'left'
            entry_type:
              label: 'Entry type'
              align: 'left'
            authors:
              label: 'Authors'
              align: 'left'
            upload_name:
              label: 'Upload name'
              align: 'left'
            upload_id:
              label: 'Upload id'
              align: 'left'
            upload_create_time:
              label: 'Upload time'
              align: 'left'
        # Dictionary of search filters that are always enabled for queries made within
        # this app. This is especially important to narrow down the results to the
        # wanted subset. Any available search filter can be targeted here.
        filters:
          include:
            - '*baseclasses.voila.VoilaNotebook'
        filters_locked:
          section_defs.definition_qualified_name: 'baseclasses.voila.VoilaNotebook'

        # Controls the filter menus shown on the left
        filter_menus:
          options:
            custom_quantities:
              label: 'User Defined Quantities'
              level: 0
              size: 'l'
            author:
              label: 'Author / Origin / Dataset'
              level: 0
              size: 'm'
            metadata:
              label: 'Visibility / IDs / Schema'
              level: 0
        dashboard:
          widgets:
            - type: 'terms'
              showinput: true
              scale: 'linear'
              quantity: 'authors.name'
              layout:
                xxl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0
                xl:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0
                lg:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0
                md:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0
                sm:
                  minH: 3
                  minW: 3
                  h: 6
                  w: 6
                  y: 0
                  x: 0

plugins:
    include:
        - nomad-baseclasses
        - nomad-chemical-energy
    options:
        nomad-baseclasses:
            name: nomad-baseclasses
            python_package: baseclasses
        nomad-chemical-energy:
          name: nomad-chemical-energy
          python_package: ce_nome_s