-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
improve report filtering related to system forms #31654
Conversation
This was only filtering on a selection of system forms and is also unnecessary since there are already other filters that won't match system forms.
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.
Very nice, I'm excited about these changes
assert re.match(r'\w+$', name), \ | ||
"Names must be valid python variable names, was {}".format(name) | ||
self.name = name | ||
self.body = { | ||
"field": field, | ||
"size": size if size is not None else SIZE_LIMIT, | ||
} | ||
if missing: | ||
self.body["missing"] = missing |
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.
That's neat - I didn't know this was part of the query language: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_missing_value_5
|
||
# filter results by app and xmlns if applicable | ||
if FormsByApplicationFilter.has_selections(self.request): | ||
form_values = list(self.all_relevant_forms.values()) | ||
if form_values: | ||
query = query.OR(*[self._form_filter(f) for f in form_values]) | ||
else: |
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.
aside: FormsByApplicationFilter.has_selections
counts "Show Advanced Options" as a selection, which is a little unintuitive in my opinion.
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 agree but if you to select it and not change anything else then it does change the results to only include 'known forms'. I toyed with changing but the added complexity didn't seem worth it in the context of this PR.
Product Description
Changes to the way we filter forms by application and user.
User filter changes
Change made to allow 'system' forms to be displayed which don't usually have a user associated with them:
App filter changes
Dropdown options for 'unknown forms'
app_id
fieldapp_id
fieldWhen the default options are selected ("Show Forms in all Applications")
Unknown user system form filter
Spec: https://docs.google.com/document/d/1t97k35y9juT7Wl_suOiWi-NYP3cpiaV4hUmZ0j2e-e4/edit#heading=h.lqyt6iorkjwv
Jira: https://dimagi-dev.atlassian.net/browse/USH-1844
Technical Summary
The biggest change was to make the app / xml ES aggregation include forms with no
app_id
: 54c51aaA few other filter changes.
Safety Assurance
Safety story
I consider this quite safe. It does alter a system report but only minor logic changes have been done.
Automated test coverage
None
QA Plan
Will be QA'd on staging.
Rollback instructions
Labels & Review