Skip to content

Commit

Permalink
add metadata/tags to sample dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
rekumar committed Aug 17, 2023
1 parent a7e7128 commit 668058a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion alab_management/sample_view/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from dataclasses import dataclass, field
from typing import Optional, ClassVar, Dict, Type
from typing import Any, List, Optional, ClassVar, Dict, Type

from bson import ObjectId

Expand All @@ -24,6 +24,8 @@ class Sample:
task_id: Optional[ObjectId]
name: str
position: Optional[str]
metadata: Optional[Dict[str, Any]] = field(default_factory=dict)
tags: Optional[List[str]] = field(default_factory=list)


@dataclass(frozen=True)
Expand Down
2 changes: 2 additions & 0 deletions alab_management/sample_view/sample_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ def get_sample(self, sample_id: ObjectId) -> Sample:
name=result["name"],
position=result["position"],
task_id=result["task_id"],
metadata=result.get("metadata", {}),
tags=result.get("tags", []),
)

def update_sample_task_id(self, sample_id: ObjectId, task_id: Optional[ObjectId]):
Expand Down

0 comments on commit 668058a

Please sign in to comment.