1
- from typing import Any , Dict
1
+ from typing import Dict
2
2
3
3
from pandas import DataFrame
4
4
@@ -17,7 +17,7 @@ def __init__(self, papi_client: PapiClient, **kwargs):
17
17
18
18
self .__dict__ .update (kwargs )
19
19
20
- def to_dict (self , * args , ** kwargs ) -> Dict [ str , Any ] :
20
+ def to_dict (self , * args , ** kwargs ) -> Dict :
21
21
return self ._get_data ()
22
22
23
23
def to_df (self , * args , ** kwargs ) -> TraceType :
@@ -47,26 +47,36 @@ def __init__(self, papi_client: PapiClient, well: 'rogii_solo.well.Well', **kwar
47
47
self .well = well
48
48
self .hash = None
49
49
self .unit = None
50
+ self .start_date_time_index = None
51
+ self .last_date_time_index = None
50
52
51
53
self .__dict__ .update (kwargs )
52
54
53
- def to_dict (self , time_from : str , time_to : str ) -> Dict [ str , Any ] :
55
+ def to_dict (self , time_from : str = None , time_to : str = None ) -> Dict :
54
56
return self ._get_data (time_from = time_from , time_to = time_to )
55
57
56
- def to_df (self , time_from : str , time_to : str ) -> TraceType :
58
+ def to_df (self , time_from : str = None , time_to : str = None ) -> TraceType :
57
59
data = self ._get_data (time_from = time_from , time_to = time_to )
58
60
59
61
return {
60
62
'meta' : DataFrame ([data ['meta' ]]),
61
63
'points' : DataFrame (data ['points' ]),
62
64
}
63
65
64
- def _get_data (self , time_from : str , time_to : str ):
66
+ def _get_data (self , time_from : str = None , time_to : str = None ):
67
+ if time_from is None :
68
+ time_from = self .start_date_time_index
69
+
70
+ if time_to is None :
71
+ time_to = self .last_date_time_index
72
+
65
73
meta = {
66
74
'uuid' : self .uuid ,
67
75
'name' : self .name ,
68
76
'hash' : self .hash ,
69
- 'unit' : self .unit
77
+ 'unit' : self .unit ,
78
+ 'start_date_time_index' : self .start_date_time_index ,
79
+ 'last_date_time_index' : self .last_date_time_index
70
80
}
71
81
points = self ._get_points (time_from = time_from , time_to = time_to )
72
82
@@ -76,9 +86,6 @@ def _get_data(self, time_from: str, time_to: str):
76
86
}
77
87
78
88
def _get_points (self , time_from : str , time_to : str ):
79
- if time_from is None or time_to is None :
80
- return []
81
-
82
89
return self ._papi_client .get_well_time_trace_data (
83
90
well_id = self .well .uuid ,
84
91
trace_id = self .uuid ,
0 commit comments