forked from enviPath/enviPy
[Feature] Minimal IUCLID export (#338)
This is an initial implementation that creates a working minimal .i6z document. It passes schema validation and can be imported into IUCLID. Caveat: IUCLID files target individual compounds. Pathway is not actually covered by the format. It can be added in either soil or water and soil OECD endpoints. **I currently only implemented the soil endpoint for all data.** This sort of works, and I can report all degradation products in a pathway (not a nice view, but we can report many transformation products and add a diagram attachment in the future). Adding additional information is an absolute pain, as we need to explicitly map each type of information to the relevant OECD field. I use the XSD scheme for validation, but unfortunately the IUCLID parser is not fully compliant and requires a specific order, etc. The workflow is: finding the AI structure from the XSD scheme -> make the scheme validation pass -> upload to IUCLID to get obscure error messages -> guess what could be wrong -> repeat 💣 New specifications get released once per year, so we will have to update accordingly. I believe that this should be a more expensive feature, as it requires significant effort to uphold. Currently implemented for root compound only in SOIL: - Soil Texture 2 - Soil Texture 1 - pH value - Half-life per soil sample / scenario (mapped to disappearance; not sure about that). - CEC - Organic Matter (only Carbon) - Moisture content - Humidity <img width="2123" alt="image.png" src="attachments/d29830e1-65ef-4136-8939-1825e0959c62"> <img width="2124" alt="image.png" src="attachments/ac9de2ac-bf68-4ba4-b40b-82f810a9de93"> <img width="2139" alt="image.png" src="attachments/5674c7e6-865e-420e-974a-6b825b331e6c"> Reviewed-on: enviPath/enviPy#338 Co-authored-by: Tobias O <tobias.olenyi@envipath.com> Co-committed-by: Tobias O <tobias.olenyi@envipath.com>
This commit is contained in:
58
epapi/v1/interfaces/iuclid/dto.py
Normal file
58
epapi/v1/interfaces/iuclid/dto.py
Normal file
@ -0,0 +1,58 @@
|
||||
from dataclasses import dataclass, field
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayCompoundDTO:
|
||||
pk: int
|
||||
name: str
|
||||
smiles: str | None = None
|
||||
cas_number: str | None = None
|
||||
ec_number: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayScenarioDTO:
|
||||
scenario_uuid: UUID
|
||||
name: str
|
||||
additional_info: list = field(default_factory=list) # EnviPyModel instances
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayNodeDTO:
|
||||
node_uuid: UUID
|
||||
compound_pk: int
|
||||
name: str
|
||||
depth: int
|
||||
smiles: str | None = None
|
||||
cas_number: str | None = None
|
||||
ec_number: str | None = None
|
||||
additional_info: list = field(default_factory=list) # EnviPyModel instances
|
||||
scenarios: list[PathwayScenarioDTO] = field(default_factory=list)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayEdgeDTO:
|
||||
edge_uuid: UUID
|
||||
start_compound_pks: list[int] = field(default_factory=list)
|
||||
end_compound_pks: list[int] = field(default_factory=list)
|
||||
probability: float | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayModelInfoDTO:
|
||||
model_name: str | None = None
|
||||
model_uuid: UUID | None = None
|
||||
software_name: str | None = None
|
||||
software_version: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PathwayExportDTO:
|
||||
pathway_uuid: UUID
|
||||
pathway_name: str
|
||||
compounds: list[PathwayCompoundDTO] = field(default_factory=list)
|
||||
nodes: list[PathwayNodeDTO] = field(default_factory=list)
|
||||
edges: list[PathwayEdgeDTO] = field(default_factory=list)
|
||||
root_compound_pks: list[int] = field(default_factory=list)
|
||||
model_info: PathwayModelInfoDTO | None = None
|
||||
Reference in New Issue
Block a user