Ingredients
Oils
Oil database loading and searching functions.
get_oil(name)
Retrieve an oil by name (case-insensitive).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the oil to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Oil]
|
The Oil object if found, else None. |
list_oils()
List all available oils sorted by name.
Returns:
| Type | Description |
|---|---|
List[Oil]
|
A list of all loaded Oil objects. |
search_oils(query)
Search for oils with names matching the query (case-insensitive).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The substring to search for. |
required |
Returns:
| Type | Description |
|---|---|
List[Oil]
|
A list of matching Oil objects, sorted by name. |
Additives
Additive database loading and searching functions.
get_additive(name)
Retrieve an additive by name (case-insensitive).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the additive to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[AdditiveInfo]
|
The AdditiveInfo object if found, else None. |
list_additives()
List all available additives sorted by name.
Returns:
| Type | Description |
|---|---|
List[AdditiveInfo]
|
A list of all loaded AdditiveInfo objects. |
search_additives(query)
Search for additives with names matching the query (case-insensitive).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The substring to search for. |
required |
Returns:
| Type | Description |
|---|---|
List[AdditiveInfo]
|
A list of matching AdditiveInfo objects, sorted by name. |
Fragrance
Fragrance calculator with EO safety data.
FragranceResult
dataclass
Computed fragrance amount with optional safety warning.
calculate_fragrance(fragrance, total_oil_weight)
Calculate the weight for a fragrance entry.
If the fragrance already has an amount set, it is used directly.
Otherwise, if percentage is set, it is applied to total_oil_weight.
Otherwise, default rates are used (5 % for FO, 3 % for EO).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fragrance
|
Fragrance
|
Fragrance specification with name, type, and optional amount/percentage. |
required |
total_oil_weight
|
float
|
Total weight of oils in recipe (grams). |
required |
Returns:
| Type | Description |
|---|---|
FragranceResult
|
FragranceResult with calculated amount, rate used, and optional safety warning. |
get_eo_max_rate(name)
Return the max safe usage rate (%) for an essential oil, or None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Essential oil name (case-insensitive). |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Maximum safe usage rate as percentage of total product weight, or None if not found. |
list_eo_rates()
Return the full EO safety rate dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, float]
|
Dictionary mapping essential oil names to maximum safe usage rates (%). |