1
1
from __future__ import annotations
2
2
3
3
import warnings
4
+ from datetime import datetime
4
5
5
6
from emmet .core .tasks import TaskDoc
6
7
@@ -48,6 +49,7 @@ def search(
48
49
elements : list [str ] | None = None ,
49
50
exclude_elements : list [str ] | None = None ,
50
51
formula : str | list [str ] | None = None ,
52
+ last_updated : tuple [datetime , datetime ] | None = None ,
51
53
num_chunks : int | None = None ,
52
54
chunk_size : int = 1000 ,
53
55
all_fields : bool = True ,
@@ -64,6 +66,7 @@ def search(
64
66
formula (str, List[str]): A formula including anonymized formula
65
67
or wild cards (e.g., Fe2O3, ABO3, Si*). A list of chemical formulas can also be passed
66
68
(e.g., [Fe2O3, ABO3]).
69
+ last_updated (tuple[datetime, datetime]): A tuple of min and max UTC formatted datetimes.
67
70
num_chunks (int): Maximum number of chunks of data to yield. None will yield all possible.
68
71
chunk_size (int): Number of data entries per chunk. Max size is 100.
69
72
all_fields (bool): Whether to return all fields in the document. Defaults to True.
@@ -93,6 +96,14 @@ def search(
93
96
94
97
query_params .update ({"chemsys" : "," .join (chemsys )})
95
98
99
+ if last_updated :
100
+ query_params .update (
101
+ {
102
+ "last_updated_min" : last_updated [0 ],
103
+ "last_updated_max" : last_updated [1 ],
104
+ }
105
+ )
106
+
96
107
return super ()._search (
97
108
num_chunks = num_chunks ,
98
109
chunk_size = chunk_size ,
0 commit comments