Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"configurations": [
"configurations":
[
{
"name": "Attach to Python Functions",
"type": "python",
Expand All @@ -19,6 +20,6 @@
"PYTEST_ADDOPTS": "--no-cov"
},
"justMyCode": false
}
},
]
}
3 changes: 1 addition & 2 deletions src/api/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ def __init__(
self,
window_size_mins: int = Query(..., description="Window Size Mins", example=20),
window_length: int = Query(..., description="Window Length", examples=10),
step: Union[bool, str] = Query(..., description="step" )
#examples={"metadata": {"value": "metadata"}, "True": {"value": True}, "False": {"value": False}}),
step: str = Query(..., description="step", examples={"metadata": {"value": "metadata"}, "true": {"value": "true"}, "false": {"value": "false"}})
):
self.window_size_mins = window_size_mins
self.window_length = window_length
Expand Down
6 changes: 3 additions & 3 deletions src/sdk/python/rtdip_sdk/functions/time_weighted_average.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get(connection: object, parameters_dict: dict) -> pd.DataFrame:
window_size_mins (int): Window size in minutes
window_length (int): (Optional) add longer window time for the start or end of specified date to cater for edge cases
include_bad_data (bool): Include "Bad" data points with True or remove "Bad" data points with False
step (bool, str): data points with step "enabled" or "disabled". The options for step are "metadata" (string), True or False (bool)
step (str): data points with step "enabled" or "disabled". The options for step are "metadata", "true" or "false". "metadata" will get the step requirements from the metadata table if applicable.
Returns:
DataFrame: A dataframe containing the time weighted averages.
'''
Expand Down Expand Up @@ -103,9 +103,9 @@ def set_dtz(dt, is_end_date = False):
metadata_df.set_index("TagName", inplace=True)
metadata_df = metadata_df.loc[:, "Step"]
preprocess_df = preprocess_df.merge(metadata_df, left_index=True, right_index=True)
elif parameters_dict["step"] == True:
elif parameters_dict["step"].lower() == "true":
preprocess_df["Step"] = True
elif parameters_dict["step"] == False:
elif parameters_dict["step"].lower() == "false":
preprocess_df["Step"] = False
else:
raise Exception('Unexpected step value', parameters_dict["step"])
Expand Down