Compound¶
compound ¶
Compound Value Object
Represents a chemical compound in the system.
Classes¶
Compound dataclass ¶
Value Object for chemical compound.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cpd | str | Compound identifier code (e.g., 'C00001') | required |
name | str | Compound name (e.g., 'H2O', 'Water') | required |
smiles | Optional[str] | SMILES notation of the compound | None |
chebi | Optional[str] | ChEBI identifier | None |
Raises:
| Type | Description |
|---|---|
ValueError | If cpd or name are empty |
Notes
Compounds are uniquely identified by cpd code. SMILES and ChEBI are optional for data enrichment.
Functions¶
__post_init__ ¶
Validates required compound fields.
Raises:
| Type | Description |
|---|---|
ValueError | If cpd or name are invalid. |
Source code in src/domain/value_objects/compound.py
__str__ ¶
__repr__ ¶
Returns debug representation of compound.
Returns:
| Type | Description |
|---|---|
str | Representation with cpd and name. |
__hash__ ¶
has_structure ¶
Checks if compound has structural information (SMILES).
Returns:
| Type | Description |
|---|---|
bool | True if SMILES is defined. |
has_chebi ¶
Checks if compound has ChEBI reference.
Returns:
| Type | Description |
|---|---|
bool | True if ChEBI is defined. |