Skip to content

Commit

Permalink
Merge branch 'feature/sc-175067-add-summary-type-selector' into bug/s…
Browse files Browse the repository at this point in the history
…c-188829-pi-time-expression-value-drift
  • Loading branch information
alexbourret committed Jun 25, 2024
2 parents 829bf4f + b523899 commit 512a6f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions python-lib/osisoft_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def parse_pi_time(self, pi_time, to_epoch=False):
headers = self.get_requests_headers()
json_response = self.get(url=url, headers=headers, params={
"expression": 'ParseTime("*")',
"time": "{}".format(pi_time)
"time": escape(pi_time)
})
items = json_response.get("Items", [{}])
item = items[0]
Expand Down Expand Up @@ -211,9 +211,12 @@ def get_row_from_webid(self, webid, data_type, start_date=None, end_date=None,
if OSIsoftConstants.DKU_ERROR_KEY in json_response:
json_response['object_id'] = "{}".format(webid)
yield json_response
items = json_response.get(OSIsoftConstants.API_ITEM_KEY, [json_response])
for item in items:
yield item
else:
items = json_response.get(OSIsoftConstants.API_ITEM_KEY, [json_response])
if not items:
items = [{}]
for item in items:
yield item

def get_rows_from_webids(self, input_rows, data_type, start_date=None, end_date=None,
interval=None, sync_time=None, boundary_type=None, selected_fields=None, search_full_hierarchy=None,
Expand Down
9 changes: 5 additions & 4 deletions python-lib/osisoft_plugin_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,18 @@ def remove_unwanted_columns(row):
def format_output(input_row, reference_row=None, is_enumeration_value=False):
output_row = copy.deepcopy(input_row)
type_column = None
if reference_row:
if type_column:
reference_row["Type"] = type_column
output_row.update(reference_row)
if "Value" in output_row and isinstance(output_row.get("Value"), dict):
type_column = output_row.get("Type")
output_row = output_row.get("Value")
output_row.pop("Good", None)
output_row.pop("Questionable", None)
output_row.pop("Substituted", None)
output_row.pop("Annotated", None)
if reference_row:
if type_column:
reference_row["Type"] = type_column
output_row.update(reference_row)
return output_row
if is_enumeration_value:
value = output_row.pop("Value", {})
output_row["Value"] = value.get("Name", "")
Expand Down

0 comments on commit 512a6f3

Please sign in to comment.