Add scoped calculate analytics endpoint#1502
Merged
Merged
Conversation
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.
Fixes #1501
Summary
GET /analytics/calculate/requestsfor value-free calculate request analytics.start_time/end_timefilters andunique=truevariable-key aggregation.read:calculate-analyticsscope for the analytics endpoint only.Testing
uv run pytest -q tests/unit/decorators/test_auth.py tests/unit/endpoints/test_analytics.pyuv run pytest -q tests/unit/utils/test_config_loader.py::TestEnvironmentVariableOverrides::test__given_traditional_env_vars__config_maps_them_correctly tests/unit/utils/test_config_loader.py::TestEnvironmentVariableSubstitution::test__given_auth0_config_with_env_vars__substitution_enables_auth tests/unit/utils/test_config_loader.py::TestConfigValueSettings::test__integration_with_real_config_structureuv run ruff check policyengine_household_api/decorators/auth.py policyengine_household_api/api.py policyengine_household_api/utils/config_loader.py tests/conftest.py tests/fixtures/decorators/auth.py tests/unit/decorators/test_auth.py tests/fixtures/endpoints/analytics.py tests/unit/endpoints/test_analytics.pyuv run ruff format --check policyengine_household_api/decorators/auth.py policyengine_household_api/api.py policyengine_household_api/utils/config_loader.py tests/conftest.py tests/fixtures/decorators/auth.py tests/unit/decorators/test_auth.py tests/fixtures/endpoints/analytics.py tests/unit/endpoints/test_analytics.pyuv run python -c "import yaml; yaml.safe_load(open('policyengine_household_api/openapi_spec.yaml'))"Manual setup
read:calculate-analytics.AUTH0_TEST_TOKEN_SCOPESshould be set toread:calculate-analyticswhere scoped token fetching is needed.