Skip to content

Update the API upload and publish tutorial for GUI v2 projects - #379

Merged
JFRudzinski merged 5 commits into
developfrom
376-update-uploading-and-publishing-data-with-the-api-tutorial-gui-v2-projects
Oct 1, 2026
Merged

JFRudzinski merged 5 commits into
developfrom
376-update-uploading-and-publishing-data-with-the-api-tutorial-gui-v2-projects

Conversation

@siamakn

@siamakn siamakn commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Updates the "Upload and share with the API" tutorial for GUI v2 projects. for #376.

@siamakn
siamakn requested a review from ahm531 September 29, 2026 11:52
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://docs.nomad-lab.eu/pr-preview/pr-379/

Built to branch gh-pages at 2026-10-01 13:58 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@JFRudzinski JFRudzinski mentioned this pull request Sep 29, 2026
9 of 13 tasks
@siamakn
siamakn requested a review from JFRudzinski September 29, 2026 15:16

@JFRudzinski JFRudzinski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @siamakn , thanks for addressing this one. We are in a bit of an awkward transition phase. Many of the comments can be deferred to follow-up work by creating issues (here and in the utility repo)

I think most importantly we need to see about using this backend url, I am not sure how safe this is

Comment thread docs/tutorial/upload_publish_api.md Outdated
## Environment setup

In this tutorial, we will use the [NOMAD test deployment](https://nomad-lab.eu/prod/v1/test/gui/search/entries){:target="_blank" rel="noopener"}. Therefore, in all code examples, we will set `url="test"` when calling the helper functions. Later, you can switch to `url="prod"` or a custom NOMAD API URL if needed.
In this tutorial, we will use the [NOMAD test deployment](https://nomad-lab.eu/test/){:target="_blank" rel="noopener"}. Therefore, in all code examples, we will set `url="test"` when calling the helper functions. Later, you can switch to `url="prod"` or a custom NOMAD API URL if needed. When you switch to `url="prod"`, also set `nomad_gui`, defined in [Create projects](#create-projects), to `https://nomad-lab.eu/prod/v1/gui/v2`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't really make sense to link to a section further down the page. Probably it makes more sense to create a section towards the end called something like "using the production server" and then list all adjustments when you go beyond simply testing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, these gui addresses should (eventually) be added to the nomad-utility-workflows package ... it would be great if you could open an issue there

@siamakn siamakn Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After concluding the modifications, I removed the link. Since the settings now sit together in the environment setup, I listed the changes for production below them. Please check and see if moving to a section at the end is a better solution.

Comment thread docs/tutorial/upload_publish_api.md Outdated
# Upload and publish data using the NOMAD API

In this tutorial, we interact with the NOMAD API using Python and the [`nomad-utility-workflows`](https://fairmat-nfdi.github.io/nomad-utility-workflows/){:target="_blank" rel="noopener"} package, to programmatically perform the full data upload and publishing workflow. We work with example data files to inspect generated entries, modify metadata, organize entries into datasets, and publish the results on the NOMAD test deployment. By the end of the tutorial, we will have reproduced the core upload and publishing workflows available in the NOMAD GUI.
<!-- TODO: Align the capitalization of "project"/"entry" with the docs-wide decision (#365 uses "Project"/"Entry", #374 uses "project"/"entry"), and add "project" to the glossary. -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - added via #381

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the TODO is removed.

Comment thread docs/tutorial/upload_publish_api.md Outdated
!pip install python-dotenv
```
<!-- markdownlint-disable MD046 -->
<!-- markdownlint-enable MD046 -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like all of these linting adjustments throughout, the linting is there for a reason, if an adjustment is needed it should be raised and made at a more global level if possible

since this is already there partially from before, it does not need to be addressed in this PR, but please open a corresponding issue to keep track

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I had them in the old page when I couldnt figure out why some tests fail. I remove them here.

Comment thread docs/tutorial/upload_publish_api.md Outdated
Username: siamak.nakhaie@physik.hu-berlin.de
Email: siamak.nakhaie@physik.hu-berlin.de
Authenticated as: FAIRmat Training
Username: test_siamak.nakhaie

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you could also remove your name from here, this is not validated anywhere right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I agree. They are now placeholders here and in the user-search output further down.

Comment thread docs/tutorial/upload_publish_api.md Outdated
```python
from nomad_utility_workflows.utils import core

core.NOMAD_TEST_URL = 'https://nomad-lab.eu/test/backend/api/v1'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lauri-codes please check this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Quick context: the address itself is the test deployment's official API (its config at https://nomad-lab.eu/test/config.js sets api_base_path to /test/backend). The issue is that url='test' in nomad-utility-workflows still points to the old address, which now rejects uploads over 1 MiB, so the tutorial breaks without this line.

I saw 3 ways, and I chose 1 because I thought we want it to be published by tonight.

  1. Keeping the workaround so the tutorial works with the current package, open issues in nomad-utility-workflows, and update the tutorial once fixed.
  2. Hold this tutorial back until the package is updated.
  3. If possible/fine, lift the 1 MiB constraint in the old test address. I checked with the Prod deployment and it was fine. However I stayed with the workaround because I though the tutorial is meant to be performed on the Test.

@lauri-codes @JFRudzinski , I would leave the decision to you.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying, why don't we just update nomad-utility-workflows? Can you open an issue there and list all the changes that should be made? Then I can see if we can make a quick update and release, then you could simplify this tutorial again

Comment thread docs/tutorial/upload_publish_api.md Outdated
`url='test'` in nomad-utility-workflows 0.3.2 points to https://nomad-lab.eu/prod/v1/test/api/v1, which currently rejects request bodies larger than 1 MiB (nginx "413 Request Entity Too Large").
Without the workaround below, `upload_files_to_nomad` fails with a JSONDecodeError for miscellaneous_data.zip (1.97 MB) and FHI-aims.zip (1.27 MB); xps_nexus_data.zip (0.23 MB) still works.
The new test API address https://nomad-lab.eu/test/backend/api/v1 and the production API accept these files.
Once the limit on the old address is lifted, or the package sets NOMAD_TEST_URL (nomad_utility_workflows/utils/core.py) to the new address, remove the workaround below: the sentence, the snippet, and the explanation after it. -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think a change is needed in nomad-utility-workflows, please open an issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAIRmat-NFDI/nomad-utility-workflows#56 (the outdated test URL, which causes the 1 MiB upload problem).

Comment thread docs/tutorial/upload_publish_api.md Outdated
```
<!-- markdownlint-enable MD046 -->

The address that the package uses for `url='test'` by default currently rejects files larger than 1 MiB, so the uploads below would fail without this line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this workaround is kept: I don't think the user needs to know this, just tell them what to do directly, they don't need to know why

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Righ, I removed the explanation. The reason is now only in a comment for maintainers, linked to FAIRmat-NFDI/nomad-utility-workflows#56.

Comment thread docs/tutorial/upload_publish_api.md Outdated

# Base URL of the new NOMAD GUI on the test deployment,
# used below to build links to projects and entries
nomad_gui = 'https://nomad-lab.eu/test'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would collect all configuration adjustments / variable definitions together and add it to the environmental setup section before starting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, both settings are now together at the end of the environment setup.

Comment thread docs/tutorial/upload_publish_api.md Outdated

This code triggers the publication action for the DFT project and prints the server response confirming the operation.

<!-- TODO: Decide whether to add a section on assigning a DOI to the published project via the API (/uploads/{upload_id}/action/assign-doi), mirroring "Assign a DOI to your project" in upload_publish.md -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes, but it could be deferred to a follow-up PR if you prefer, just make sure you create an issue to not lose track

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, I would defer it and for now kept a TODO for it in the page. the test deployment used in this tutorial cannot assign DOIs, so readers could not run that step yet. But if we insist to have it in the Tutorial, then we can add an admonition, with a warning, and give example to be performed on the production instance. I wouldn't say so, because users might use it for learning/testing purposes, and we dont want that. I guess majority of the users can easily use GUI and a couple of clicks to do so. Specific/advanced users would better to refer to the workflows utility docs.

Comment thread docs/tutorial/upload_publish_api.md Outdated
The helper `upload_files_to_nomad` both **creates a new project** and **uploads the given ZIP file** to it in a single API call.

!!! info "Projects and uploads"
In the NOMAD GUI, you organize your data in projects. The NOMAD API and `nomad-utility-workflows` still use the term *upload* for a project: the API endpoints retain *upload* in their paths, helper functions such as `upload_files_to_nomad` and `get_upload_by_id` work on projects, and the `upload_id` they return is the project ID.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something I just noticed: As far as I can see the new GUI does not use the terminology "project ID", under archive.metadata there is still upload_id, since the overarching metadata display is not yet there, it is unclear what the end results should be ... it seems to me that we should continue using upload_id though since this is the actual quantity stored, @lauri-codes ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok, I see now that under Project > Settings there is a Project ID listed. Just note users can also go to archive.metadata.upload_id ... so maybe for now we want to say upload_id/project_id refer to the same quantity?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. For now I updated the note to say that the upload_id identifies the project, that it can be found as Project ID under Settings > General, and that entries store it as upload_id in their metadata.

In case it helps, the new GUI currently uses both labels: "Project ID" (e.g. project settings, Actions table) and "Upload ID" (e.g. the file delete/rename dialogs). I personally think, the fine adjustments of the terminologies used in the tutorial can be addressed later.

@JFRudzinski JFRudzinski added the announcement Create an announcement on Discord for this PR label Sep 30, 2026
@siamakn
siamakn requested a review from JFRudzinski September 30, 2026 11:05
@JFRudzinski
JFRudzinski force-pushed the 376-update-uploading-and-publishing-data-with-the-api-tutorial-gui-v2-projects branch from a13de03 to 227b171 Compare October 1, 2026 10:29
@JFRudzinski JFRudzinski mentioned this pull request Oct 1, 2026
@JFRudzinski
JFRudzinski force-pushed the 376-update-uploading-and-publishing-data-with-the-api-tutorial-gui-v2-projects branch from c2e829d to 794a292 Compare October 1, 2026 13:57
@JFRudzinski
JFRudzinski merged commit e73dc61 into develop Oct 1, 2026
5 checks passed
@JFRudzinski
JFRudzinski deleted the 376-update-uploading-and-publishing-data-with-the-api-tutorial-gui-v2-projects branch October 1, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

announcement Create an announcement on Discord for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants