Welcome to the NOVA tutorial! This guide will walk you through the process of creating applications for the analysis and visualization of neutron scattering data using the NOVA framework. You will learn how to create scripts that interact with the existing tools deployed on the Neutrons Data Interpretation Platform (NDIP), and interactive web applications that can be deployed to NDIP to create simple user interfaces or complex visualizations. All these leverage the NOVA libraries to simplify interaction with the Neutron Data Interpretation Platform (NDIP).
As mentioned in the introduction, all code examples in this tutorial are based on a template application. In this episode, we will create this starting point by cloning a template using the `copier` library. This template provides a basic project structure and pre-configured files that will help us get started quickly with our NOVA project, saving us from setting up everything from scratch.
@@ -232,7 +233,7 @@ poetry run deploy-tool
This script will:
1. Clone the Galaxy tools repository
2. Copy your tool XML file to the correct location (now configured as `tools/neutrons/tutorials/YOUR_USERNAME-nova-tutorial.xml`)
2. Copy your tool XML file to the correct location (for the tutorial this is configured as `tools/neutrons/tutorials/YOUR_USERNAME-nova-tutorial.xml`)
3. Commit the changes
4. Push to the `prototype` branch of the galaxy-tools repository
@@ -248,17 +249,17 @@ Let's understand the key components that make your tool work in NDIP:
1.**Repository Structure**:
- Your code is hosted at `https://code.ornl.gov/ndip/tool-sources/tutorial/YOUR_USERNAME-nova-tutorial`
- The Docker container is built automatically by CI and stored at `code.ornl.gov:4567/ndip/tool-sources/tutorial/YOUR_USERNAME-nova-tutorial`
- The Docker container is built automatically by CI and stored at `savannah.ornl.gov/ndip/tool-sources/tutorial/YOUR_USERNAME-nova-tutorial`
2.**Tool XML File**:
- Defines your tool for Galaxy/NDIP
- References your container so NDIP knows which image to run
- Configures the command to run your application
- Is stored in the galaxy-tools repository at `tools/neutrons/tutorials/YOUR_USERNAME-nova-tutorial.xml`
- Is stored on the prototype branch in the galaxy-tools repository at [https://code.ornl.gov/ndip/galaxy-tools/-/tree/prototype/tools/neutrons/tutorials](https://code.ornl.gov/ndip/galaxy-tools/-/tree/prototype/tools/neutrons/tutorials). The xml file will have a name in the format of YOUR_USERNAME-nova-tutorial.xml
3.**Deployment Process**:
- When you push code to your repository → CI builds a new container
- When you run `push-xml` → The utility checks if your container exists and pushes your tool XML to the galaxy-tools prototype branch
- When you run `deploy-tool` → The utility checks if your container exists and pushes your tool XML to the galaxy-tools prototype branch
- After XML is merged → Your tool appears in the NDIP interface
In this episode, we will start using the `nova-galaxy` library to interact with the NDIP platform and run a neutron analysis tool. First, ensure you have set your `GALAXY_URL` and `GALAXY_API_KEY` as environment variables, as explained in the Summary and Setup Episode. We also need to add `nova-galaxy` as a project dependency.
# 4. User Interface Best Practices: The MVVM Design Pattern
## User Interface Best Practices: The MVVM Design Pattern
In this section, we will introduce the Model-View-ViewModel (MVVM) design pattern, a powerful architectural approach for structuring applications, particularly those with user interfaces. We\'ll explore the core principles of MVVM, the roles of each component, and how the NOVA framework simplifies its implementation, making your code more organized, testable, and maintainable.
@@ -349,6 +349,21 @@ If you don't want Trame to launch a tab by default, you can instead run ```poetr
Now that we have updated our Fractal tool and integrated it into the NOVA application using the MVVM pattern, the next step is to push these changes to NDIP. This step ensures that the tool on NDIP reflects the latest version of the tool and is available for others.
Here are the steps to push your changes and deploy the tool:
1.**Bump the version:** Open the `pyproject.toml` file in the root of your project. Increment the `version` number to `0.2.0` in the `[tool.poetry]` section. Save the file.
2.**Stage your changes:** Use `git add .` to stage all changes that have been made to the application.
3.**Commit your changes:** Create a commit with a descriptive message: `git commit -m "Update Fractal tool with MVVM, bump to version 0.2.0"`.
4.**Push to the repository:** Push your committed changes to the remote repository with `git push`.
5.**Wait for CI/CD:** The push will trigger a CI/CD pipeline in gitlab. Wait for the pipeline to complete which includes building the container image for your tool. You can monitor the pipeline status in the Gitlab interface.
6.**Deploy the tool:** Once the pipeline is successful, run the deployment command from your project's root directory: `poetry run deploy-tool`.
This process ensures that your updated tool is built, containerized, and made available through NDIP.
In this section, we will dive into Trame and the `nova-trame` library to build interactive web-based user interfaces for our NOVA applications. We\'ll explore how `nova-trame` simplifies UI development within the NOVA ecosystem and how to use common layout components.