#181: Add date filter support to KPI analytics API#220
Open
sanobarasna wants to merge 1 commit into
Open
Conversation
- Add build_date_filter() helper supporting 7D/30D/1Y/All/Custom - Update fetch_request_status_distribution, fetch_total_requests, fetch_average_resolution_time_by_category to accept time_range, start_date, end_date - Update lambda_handler to read filter params from event payload - Add local DB connection path (LOCAL_DB_TEST env var) for local testing - Verified against Virginia dev schema (submission_date, serviced_date, req_status_id, req_cat_id confirmed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds date filter support (7D, 30D, 1Y, All, Custom) to the existing
KPI analytics Lambda (kpi_api_analytics.py).
Changes
build_date_filter(time_range, start_date=None, end_date=None)helper, returns a parameterized SQL condition + params
lambda_handler()to readtime_range,start_date,end_datefrom the event payload (defaults to "All")LOCAL_DB_TEST=1env var)Schema verification
Confirmed against Saayam_Table_column_names_data.xlsx for
virginia_dev_saayam_rdbms:
Testing
Ran locally with LOCAL_DB_TEST=1 against Virginia dev DB, all 6
required payloads (7D, 30D, 1Y, All, Custom), all return
statusCode 200 with the expected response shape. SLA block and
error-handling pattern unchanged.
Notes for reviewers
erroring, flagging for visibility since it's not explicitly
specified in the ticket
Closes 181