|
6 | 6 | from safe_logger import SafeLogger |
7 | 7 | from osisoft_plugin_common import ( |
8 | 8 | get_credentials, get_interpolated_parameters, |
9 | | - get_advanced_parameters, check_debug_mode, PerformanceTimer, get_max_count, reorder_dataframe |
| 9 | + get_advanced_parameters, check_debug_mode, PerformanceTimer, |
| 10 | + get_max_count, reorder_dataframe, get_summary_parameters |
10 | 11 | ) |
11 | 12 | from osisoft_constants import OSIsoftConstants |
12 | 13 | from osisoft_client import OSIsoftClient |
|
45 | 46 | end_time_column = config.get("end_time_column") |
46 | 47 | server_url_column = config.get("server_url_column") |
47 | 48 | search_full_hierarchy = config.get("search_full_hierarchy", None) |
48 | | -summary_type = config.get("summary_type") |
49 | 49 | use_batch_mode, batch_size = get_advanced_parameters(config) |
50 | 50 | interval, sync_time, boundary_type = get_interpolated_parameters(config) |
| 51 | +summary_type, summary_duration = get_summary_parameters(config) |
51 | 52 |
|
52 | 53 | network_timer = PerformanceTimer() |
53 | 54 | processing_timer = PerformanceTimer() |
|
109 | 110 | search_full_hierarchy=search_full_hierarchy, |
110 | 111 | can_raise=False, |
111 | 112 | max_count=max_count, |
112 | | - summary_type=summary_type |
| 113 | + summary_type=summary_type, |
| 114 | + summary_duration=summary_duration |
113 | 115 | ) |
114 | 116 | elif use_batch_mode: |
115 | 117 | buffer.append({"WebId": object_id, "StartTime": event_frame_start_time, "EndTime": event_frame_end_time}) |
|
120 | 122 | search_full_hierarchy=search_full_hierarchy, |
121 | 123 | can_raise=False, |
122 | 124 | batch_size=batch_size, |
123 | | - summary_type=summary_type |
| 125 | + summary_type=summary_type, |
| 126 | + summary_duration=summary_duration |
124 | 127 | ) |
125 | 128 | batch_buffer_size = 0 |
126 | 129 | buffer = [] |
|
138 | 141 | search_full_hierarchy=search_full_hierarchy, |
139 | 142 | max_count=max_count, |
140 | 143 | can_raise=False, |
141 | | - summary_type=summary_type |
| 144 | + summary_type=summary_type, |
| 145 | + summary_duration=summary_duration |
142 | 146 | ) |
143 | 147 | unnested_items_rows = [] |
144 | 148 | row_count = 0 |
|
155 | 159 | item_row = {} if use_batch_mode else {"event_frame_webid": event_frame_webid} |
156 | 160 | value = item.get("Value", {}) |
157 | 161 | if isinstance(value, dict): |
158 | | - item.pop("Value") |
| 162 | + item.pop("Value", None) |
159 | 163 | item_row.update(value) |
160 | 164 | item_row.update(base_row) |
161 | 165 | item_row.update(item) |
|
164 | 168 | item_row = {} if use_batch_mode else {"event_frame_webid": event_frame_webid} |
165 | 169 | value = base_row.get("Value", {}) |
166 | 170 | if isinstance(value, dict): |
167 | | - base_row.pop("Value") |
| 171 | + base_row.pop("Value", None) |
168 | 172 | base_row.update(value) |
169 | 173 | item_row.update(base_row) |
170 | 174 | unnested_items_rows.append(item_row) |
|
0 commit comments