File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,13 @@ class ObservablesTable(BaseModel):
9898
9999 observables : list [Observable ]
100100
101+ def __getitem__ (self , observable_id : str ) -> Observable :
102+ """Get an observable by ID."""
103+ for observable in self .observables :
104+ if observable .id == observable_id :
105+ return observable
106+ raise KeyError (f"Observable ID { observable_id } not found" )
107+
101108 @classmethod
102109 def from_dataframe (cls , df : pd .DataFrame ) -> ObservablesTable :
103110 if df is None :
@@ -200,6 +207,13 @@ class ConditionsTable(BaseModel):
200207
201208 conditions : list [ChangeSet ]
202209
210+ def __getitem__ (self , condition_id : str ) -> ChangeSet :
211+ """Get a condition by ID."""
212+ for condition in self .conditions :
213+ if condition .id == condition_id :
214+ return condition
215+ raise KeyError (f"Condition ID { condition_id } not found" )
216+
203217 @classmethod
204218 def from_dataframe (cls , df : pd .DataFrame ) -> ConditionsTable :
205219 if df is None :
You can’t perform that action at this time.
0 commit comments