-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENG-6119] api changes for institution-users updates #10742
[ENG-6119] api changes for institution-users updates #10742
Conversation
6241ca4
to
46fdfb4
Compare
5328629
to
012fd0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really have any hard changes, just a couple questions and ideas. Good work! 💯
operator: str, | ||
value: str, | ||
) -> edsl.Search: | ||
match operator: # operators from FilterMixin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure there's no [lt]/[lte]/[gt]/[gte] ? Thinking about if admins want custom csv files in certain date ranges they may want to filter by date. I'm not sure it's necessary from this view, not for the user's tab anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm open to adding range filters if/when we have a use for it (would be nice to make this base view a more generally reusable thing), but there's been no ask for it yet and i'm trying to embrace at least the good parts of agile :)
(if we decide to offer an institution-summary history and/or use this to improve the unstable/terrible /_/metrics/reports/
api, then yeah, range queries for sure)
- add skeletons for new institution-user metrics view and serializer - add `toggle_view_by_flag` util to ease feature-flagged views - use that util to toggle new/old views (with new/old serializers) - (nit) use django's `view_fn.view_class` instead of drf's `view_fn.cls`
- set INSTITUTIONAL_DASHBOARD_2024 flag inactive for existing institution-user metrics tests - remove `time.sleep` calls; use index refreshes instead (saves ~70 sec) - unskip tests -- "non-deterministic fails" may be fixed by refreshes?
- add base `ElasticsearchListView` - use `elasticsearch_dsl.Search` as queryset-analogue for code reuse - allows filtering (with 'eq' and 'ne' operators) following `filterable_fields` on the serializer - allows sorting, following `default_ordering` and `ordering_fields` on the view - allows pagination (with `page` and `page[size]` params) - update "new" institution user metrics view with ElasticsearchListView - add `MonthlyReport.most_recent_yearmonth`
- rename the `es` pytest marker to `es_metrics` (for clarity) - update the effect of that marker: - patch a prefix to each metric class's index and template names - instead of deleting ALL indexes and index templates, delete only those with the patched prefix - update `api_tests.metrics.test_raw_metrics` to clean up after itself and stop depending on the clobbering
9384d76
into
CenterForOpenScience:feature/insti-dash-improv
Purpose
update api to serve institutional-user metrics based on the monthly report added in #10722
Changes
reusable things added:
toggle_view_by_flag
util to ease feature-flagged viewsElasticsearchListView
elasticsearch_dsl.Search
as queryset-analogue, for code reusefilterable_fields
on the serializer (usingapi.base.filters.FilterMixin
)default_ordering
andordering_fields
on the viewpage
andpage[size]
params), using default paginatorapi.base.serializers.YearmonthField
MonthlyReport.most_recent_yearmonth
classmethodspecific to this project:
INSTITUTIONAL_DASHBOARD_2024
Old
prefixtoggle_view_by_flag
to toggle new/old views (with new/old serializers)ElasticsearchListView
)incidental:
time.sleep
calls; use index refreshes instead (saves ~70 sec)es
pytest marker toes_metrics
(for clarity)those with the patched prefix
api_tests.metrics.test_raw_metrics
to clean up after itselfand stop depending on the clobbering
QA Notes
Please make verification statements inspired by your code and what your code touches.
What are the areas of risk?
Any concerns/considerations/questions that development raised?
Documentation
Side Effects
Ticket
ENG-6119