-
Notifications
You must be signed in to change notification settings - Fork 10
Implement single expression QA checks #715
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
base: develop
Are you sure you want to change the base?
Conversation
738363c to
a406db2
Compare
takinbo
left a comment
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.
We should have test cases for this change.
| def upgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| fetch_query = sa.sql.text( | ||
| "SELECT id, quality_checks FROM form WHERE quality_checks IS NULL OR quality_checks = 'null'::jsonb;") # noqa |
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.
Can you review this SQL query? Shouldn't it be IS NOT NULL?
| for form_id, quality_checks in op.execute(fetch_query).fetchall(): | ||
| for quality_check in quality_checks: | ||
| if 'expression' not in quality_check: | ||
| quality_check['expression'] = qb.build_expression( |
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.
Since we are practically doing away with criteria for quality_check shouldn't we also clean up the code and not have portions of the code that will never be used going forward? That should be the purpose of the data migration.
| {%- if 'expression' in control -%} | ||
| <h5><span class="badge badge-pill badge-primary">{{ control.expression }}</span></h5> | ||
| {%- else -%} | ||
| {%- for criterion in control.criteria %} |
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.
We would not be needing criteria anymore so the code should be cleaned up some.
| if 'criteria' in logical_check: | ||
| if 'expression' in logical_check: | ||
| control_expression = logical_check.get('expression') | ||
| elif 'criteria' in logical_check: |
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.
No need for criteria
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.
the migration working depends on this staying unchanged.
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.
What if this was just put in the migration itself?
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 also using it in the form import, which i have since updated
apollo/formsframework/views_forms.py
Outdated
| if 'criteria' in quality_check: | ||
| if 'expression' in quality_check: | ||
| quality_control['expression'] = quality_check['expression'] | ||
| elif 'criteria' in quality_check: |
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.
Remove check for criteria
| name = r'[a-zA-Z_][a-zA-Z0-9_]*' | ||
| lookup = "$" ("location" / "participant" / "submission") ("." / "@") name | ||
| null = "NULL" | ||
| true = "TRUE" |
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 think we have comparisons for TRUE or FALSE, it was put there as a hack when we were using the three-part criterion for the quality assurance and so isn't needed.
80439ad to
28a6a53
Compare
2cea70a to
2997c7d
Compare
2997c7d to
9145ce5
Compare
0965183 to
ae27e08
Compare
4ea9414 to
876be3c
Compare
876be3c to
c5d5b60
Compare
c5d5b60 to
5488150
Compare
bc1e20b to
f490f61
Compare
f490f61 to
07dfbd8
Compare
4b6c9de to
4649e16
Compare
4649e16 to
1dca009
Compare
b077c58 to
c7e81ba
Compare
c7e81ba to
6d3cedb
Compare
6d3cedb to
9211c65
Compare
9211c65 to
17dda8c
Compare
64794a6 to
0fb54e7
Compare
0fb54e7 to
35c99bd
Compare
35c99bd to
1ecc841
Compare
5911047 to
0a6315f
Compare
0a6315f to
00b274b
Compare
this commit fixes an issue with the QA dashboard, where checklists that should be marked as "missing" are marked as "flagged"
single-expression type
this commit adds a data migration for QA checks to single expressions
- this commit fixes an issue with the migration script where the user receives an `AttributeError` while running it - it also doesn't assume that QA is present on the form
00b274b to
34fd3e3
Compare
|
At this point, a rewrite would be better than a rebase. |
|
reopening to note, but still needs a lot of work |
This pull request adds some enhancements to QA expressions in order to fully resolve nditech/apollo-issues#39