Skip to content

Commit

Permalink
Add AddPolymerizationReactions section
Browse files Browse the repository at this point in the history
  • Loading branch information
ka-sarthak committed Aug 15, 2024
1 parent 9b8777a commit 1292e3f
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from nomad.datamodel.metainfo.annotations import ELNAnnotation, ELNComponentEnum
from nomad.datamodel.metainfo.basesections import (
Activity,
BaseSection,
CompositeSystem,
PubChemPureSubstanceSection,
PublicationReference,
Expand Down Expand Up @@ -125,4 +126,43 @@ class PolymerizationReactionReference(SectionReference):
)


class AddPolymerizationReactions(BaseSection, Schema):
"""
A section to add polymerization reaction entries in the current upload.
Each entry is also referenced in this section.
"""

zip_file = Quantity(
type=str,
description='Zip file containing one JSON for each polymerization reaction.',
a_eln=ELNAnnotation(
component=ELNComponentEnum.FileEditQuantity,
),
)
polymerization_reactions = SubSection(
section_def=PolymerizationReactionReference,
repeats=True,
description='References to polymerization reaction entries.',
)
reprocess = Quantity(
type=bool,
description='Reprocess the zip file to generate entries.',
a_eln=ELNAnnotation(
component=ELNComponentEnum.BoolEditQuantity,
),
default=True,
)

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
logger.info(
'AddPolymerizationReactions.normalize', parameter=configuration.parameter
)
super().normalize(archive, logger)
if self.zip_file and self.reprocess:
## create entry archives with overwriting
## use generate archive from json
## add the entry to the polymerization_reactions reference list
self.reprocess = False


m_package.__init_metainfo__()

0 comments on commit 1292e3f

Please sign in to comment.