Skip to content

Conversation

ka-sarthak
Copy link
Collaborator

@ka-sarthak ka-sarthak commented Apr 25, 2025

  • m_to_dict adds the m_def by default when the EntryData section is wrapped with EntryArchive, and this is supplied to create_entry_from_api. If a standalone EntryData section is supplied instead, with_root_def=True needs to be specified in m_to_dict.
  • Fixed a bug where the save method used entry_name instead of mainfile.

@ka-sarthak ka-sarthak linked an issue Apr 25, 2025 that may be closed by this pull request
@ka-sarthak ka-sarthak requested a review from Copilot April 25, 2025 21:45
@ka-sarthak ka-sarthak merged commit e222c89 into develop Apr 25, 2025
5 checks passed
@ka-sarthak ka-sarthak deleted the 68-create_entry_from_api-creates-entries-without-m_def branch April 25, 2025 21:47
@ka-sarthak ka-sarthak self-assigned this Apr 25, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that entries created from the API correctly include the m_def information when a standalone EntryData section is supplied and fixes a bug in the save method where the wrong file attribute was used.

  • Updated m_to_dict call to use with_root_def=True for standalone EntryData cases
  • Fixed a bug in the save method by switching from entry_name to mainfile

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/nomad_analysis/utils.py Updates the m_to_dict call to include m_def using with_root_def for standalone EntryData.
src/nomad_analysis/jupyter/schema.py Fixes the file name parameter by using mainfile instead of entry_name.
Comments suppressed due to low confidence (2)

src/nomad_analysis/utils.py:200

  • Consider adding unit tests to verify that m_to_dict correctly adds the m_def field when with_root_def is True for standalone EntryData cases.
            'data': section.m_to_dict(with_root_def=True),

src/nomad_analysis/jupyter/schema.py:493

  • Consider adding tests to verify that the save method correctly uses the mainfile attribute to set the file name, ensuring the bug fix is maintained.
            file_name=self.m_parent.metadata.mainfile,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create_entry_from_api creates entries without m_def
1 participant