Skip to content

Swarm-DISC/product-catalogue-tools

Repository files navigation

product-catalogue-tools

Overview



This repository contains tools for editing and displaying the contents of the linked product-catalogue repository. That repository holds json files (one for each data product) containing the product metadata. The schema is defined using JSON Schema.

graph LR

    subgraph product-catalogue
    direction LR
        schema.json
        catalogue/*.json
    end

    update((Updates from<BR>Swarm team)) --> product-catalogue

    tags((Tagged releases<br>for external teams))
    product-catalogue --> tags
Loading

This repository contains editor.py that serves a Panel application that can be used to edit the json records individually. The tool allows creation of new records and editing of existing records, to generate a new json file which must then be then manually committed to the product-catalogue repository.

graph LR

    subgraph product-catalogue-tools
        editor[editor.py<br>Panel app]
    end
    editor <--> json[a json file]
    json --> commi((Commit to<br>product-catalogue))
Loading

product-catalogue is here as a git submodule but is updated to the latest version online when the editor runs

Development setup

git clone --recurse-submodules [email protected]:Swarm-DISC/product-catalogue-tools.git

We are using uv which is the latest and greatest tool for Python project and dependency management.

Developing the dashboard

Run the dashboard in the browser and use any editor to develop it:

uv run panel serve editor.py --autoreload

OR use the provided development environment containing JupyterLab:

uv run --extra dev jupyter-lab

Right click on editor.py and select Open With / Notebook (the notebook is stored as .py file using jupytext). See the Panel documentation for more info.

Building the HTML preview

See Makefile:

  • make clean && make html generates the HTML in a directory ./html/

Deployment of the editor

Docker

See Dockerfile.

WASM and Pyodide?

See https://panel.holoviz.org/how_to/wasm/standalone.html

panel convert editor.py --to pyodide-worker --out pyodide --requirements requirements.editor.txt
python -m http.server

This seems to require editor.py to be self contained, without local imports. And the catalogue loading needs to be changed to make http requests?

TODO

  • Refactor code to rely directly on schema.json
  • Add fields like version information, in support of the DOI task
  • Include generation of network diagram (try pyvis?)
  • Investigate mapping to SPASE