Skip to content

Commit

Permalink
Merge pull request #24 from FAIRmat-NFDI/22-extend-ion-schema
Browse files Browse the repository at this point in the history
Added new perovskite composition and perovskite ion schemas with parser for the ions.
  • Loading branch information
hampusnasstrom authored Nov 7, 2024
2 parents b29cbbd + 4731838 commit 0a881f6
Show file tree
Hide file tree
Showing 7 changed files with 1,095 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ readme = "README.md"
authors = [
{name = "Jose Marquez", email = "[email protected]"},
{name = "Yaru Wang", email = "[email protected]"},
{name = "Hampus Näsström", email = "[email protected]"},
]
maintainers = [
{name = "Jose Marquez", email = "[email protected]"},
{name = "Yaru Wang", email = "wangyaru@physik.hu-berlin.de"},
{name = "Hampus Näsström", email = "hampus.naesstroem@physik.hu-berlin.de"},
]
requires-python = ">=3.9"
dependencies = [
Expand Down Expand Up @@ -131,4 +132,6 @@ where = ["src"]

[project.entry-points.'nomad.plugin']
perovskite_solar_cell = "perovskite_solar_cell_database:perovskite_solar_cell"
solar_cell_app = "perovskite_solar_cell_database.apps:solar_cells"
solar_cell_app = "perovskite_solar_cell_database.apps:solar_cells"
perovskite_composition = "perovskite_solar_cell_database:perovskite_composition"
ion_parser = "perovskite_solar_cell_database:ion_parser"
51 changes: 50 additions & 1 deletion src/perovskite_solar_cell_database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from nomad.config.models.plugins import SchemaPackageEntryPoint
from nomad.config.models.plugins import (
ParserEntryPoint,
SchemaPackageEntryPoint,
)
from pydantic import Field


Expand All @@ -17,3 +20,49 @@ def load(self):
name='PerovskiteSolarCell',
description='Schema package defined for the perovskite solar cells database.',
)


class PerovskiteCompositionEntryPoint(SchemaPackageEntryPoint):
def load(self):
from perovskite_solar_cell_database.composition import (
m_package,
)

return m_package


perovskite_composition = PerovskiteCompositionEntryPoint(
name='PerovskiteComposition',
description='Schema package defined for the perovskite compositions.',
)


class IonParserEntryPoint(ParserEntryPoint):
def load(self):
from perovskite_solar_cell_database.parser import IonParser

return IonParser(**self.dict())


ion_parser = IonParserEntryPoint(
name='PerovskiteIonParser',
description='Parse excel files containing perovskite ions.',
mainfile_name_re=r'.+\.xlsx',
mainfile_mime_re='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
mainfile_contents_dict={
'Sheet1': {
'__has_all_keys': [
'perovskite_site',
'abbreviation',
'molecular_formula',
'smiles',
'common_name',
'iupac_name',
'cas_number',
'source_compound_iupac_name',
'source_compound_smiles',
'source_compound_cas_number',
]
},
},
)
Loading

0 comments on commit 0a881f6

Please sign in to comment.