Skip to content
Open
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
3 changes: 3 additions & 0 deletions pychunkedgraph/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def default(self, obj):
elif isinstance(obj, datetime.datetime):
return obj.__str__()
elif isinstance(obj, pd.DataFrame):
for col, col_dtype in obj.dtypes.items():
if isinstance(col_dtype, pd.DatetimeTZDtype):
obj[col] = obj[col].map(lambda x: x.timestamp())
return obj.to_json()
return json.JSONEncoder.default(self, obj)

Expand Down
7 changes: 4 additions & 3 deletions pychunkedgraph/app/segmentation/v1/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def handle_user_operations(table_id):
if disp:
return user_operations.to_html()
else:
return user_operations.to_json()
return jsonify_with_kwargs(user_operations)


### GET ROOT -------------------------------------------------------------------
Expand Down Expand Up @@ -380,7 +380,7 @@ def tabular_change_log_weekly(table_id):
if disp:
return weekly_tab_change_log.to_html()
else:
return weekly_tab_change_log.to_json()
return jsonify_with_kwargs(weekly_tab_change_log)


@bp.route("/table/<table_id>/root/<root_id>/change_log", methods=["GET"])
Expand All @@ -405,7 +405,8 @@ def tabular_change_log(table_id, root_id):
if disp:
return tab_change_log.to_html()
else:
return tab_change_log.to_json()
return jsonify_with_kwargs(tab_change_log)



@bp.route("/table/<table_id>/tabular_change_log_many", methods=["GET"])
Expand Down