Skip to content

Commit

Permalink
Comment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Nov 7, 2024
1 parent 54eba8e commit 23cd8a5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/dashboard/get_chart_data/get_chart_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ def _get_table_cols(dp_id: str) -> list:


def _build_query(query_params: dict, filter_groups: list, path_params: dict) -> str:
"""Creates a query from the dashboard API spec"""
"""Creates a query from the dashboard API spec
:arg queryparams: All arguments passed to the endpoint
:arg filter_groups: Filter params used to generate filtering logic.
These should look like ['col:arg:optionalvalue,...','']
:path path_params: URL specific arguments, as a convenience
"""
dp_id = path_params["data_package_id"]
columns = _get_table_cols(dp_id)

Expand All @@ -141,7 +146,7 @@ def _build_query(query_params: dict, filter_groups: list, path_params: dict) ->
# in this block we are trying to do the following things:
# - create a config for where the selected column is not `cumulus__none`
# - create a config for where the selected column is `cumulus__none`, removing
# - filters that would cause type cast errors
# filters that would cause type cast errors
filter_group = filter_group.split(",")
config_params = []
none_params = []
Expand Down Expand Up @@ -191,7 +196,12 @@ def _build_query(query_params: dict, filter_groups: list, path_params: dict) ->
def _format_payload(
df: pandas.DataFrame, query_params: dict, filter_groups: list, count_col: str
) -> dict:
"""Coerces query results into the return format defined by the dashboard"""
"""Coerces query results into the return format defined by the dashboard
:arg queryparams: All arguments passed to the endpoint
:arg filter_groups: Filter params used to generate filtering logic.
These should look like ['col:arg:optionalvalue,...','']
:path count_col: column to use as the primary count column"""
payload = {}
payload["column"] = query_params["column"]
payload["filters"] = filter_groups
Expand Down

0 comments on commit 23cd8a5

Please sign in to comment.