diff --git a/epdb/legacy_api.py b/epdb/legacy_api.py index f55a6c82..4d2538af 100644 --- a/epdb/legacy_api.py +++ b/epdb/legacy_api.py @@ -94,6 +94,8 @@ class SimpleObject(Schema): return "reviewed" if obj.compound.package.reviewed else "unreviewed" elif isinstance(obj, Node) or isinstance(obj, Edge): return "reviewed" if obj.pathway.package.reviewed else "unreviewed" + elif isinstance(obj, dict) and "review_status" in obj: + return "reviewed" if obj.get("review_status") else "unreviewed" else: raise ValueError("Object has no package") @@ -1464,7 +1466,7 @@ class PathwayEdge(Schema): class PathwayNode(Schema): atomCount: int = Field(None, alias="atom_count") - depth: int = Field(None, alias="depth") + depth: float = Field(None, alias="depth") dt50s: List[Dict[str, str]] = Field([], alias="dt50s") engineeredIntermediate: bool = Field(None, alias="engineered_intermediate") id: str = Field(None, alias="url") @@ -1805,7 +1807,7 @@ class EdgeSchema(Schema): startNodes: List["EdgeNode"] = Field([], alias="start_nodes") @staticmethod - def resolve_review_status(obj: Node): + def resolve_review_status(obj: Edge): return "reviewed" if obj.pathway.package.reviewed else "unreviewed" diff --git a/epdb/models.py b/epdb/models.py index 02416265..87bac4af 100644 --- a/epdb/models.py +++ b/epdb/models.py @@ -2344,7 +2344,10 @@ class Edge(EnviPathModel, AliasMixin, ScenarioMixin, AdditionalInformationMixin) "reaction_probability": self.kv.get("probability"), "start_node_urls": [x.url for x in self.start_nodes.all()], "end_node_urls": [x.url for x in self.end_nodes.all()], - "scenarios": [{"name": s.get_name(), "url": s.url} for s in self.scenarios.all()], + "scenarios": [ + {"name": s.get_name(), "url": s.url, "review_status": s.package.reviewed} + for s in self.scenarios.all() + ], } for n in self.start_nodes.all():