Skip to content

Commit

Permalink
Added possibility to overwrite PubChem CID
Browse files Browse the repository at this point in the history
  • Loading branch information
hampusnasstrom committed Dec 11, 2024
1 parent 3568f85 commit 85f7d16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/perovskite_solar_cell_database/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
cas_number=self.cas_number,
name=self.common_name,
)
if isinstance(self.pure_substance, PubChemPureSubstanceSection):
pure_substance.pub_chem_cid = self.pure_substance.pub_chem_cid
pure_substance.normalize(archive, logger)
if self.molecular_formula is None:
self.molecular_formula = pure_substance.molecular_formula
Expand All @@ -297,6 +299,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
iupac_name=self.source_compound_iupac_name,
cas_number=self.source_compound_cas_number,
)
if isinstance(self.source_compound, PubChemPureSubstanceSection):
source_compound.pub_chem_cid = self.source_compound.pub_chem_cid
source_compound.normalize(archive, logger)
if self.source_compound_molecular_formula is None:
self.source_compound_molecular_formula = source_compound.molecular_formula
Expand Down Expand Up @@ -720,6 +724,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
iupac_name=self.iupac_name,
cas_number=self.cas_number,
)
if isinstance(self.pure_substance, PubChemPureSubstanceSection):
pure_substance.pub_chem_cid = self.pure_substance.pub_chem_cid
pure_substance.normalize(archive, logger)
if self.molecular_formula is None:
self.molecular_formula = pure_substance.molecular_formula
Expand All @@ -731,6 +737,7 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
self.cas_number = pure_substance.cas_number
if self.common_name is None:
self.common_name = pure_substance.name
self.pure_substance = pure_substance
super().normalize(archive, logger)


Expand Down

0 comments on commit 85f7d16

Please sign in to comment.