-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add ADRs and AFs to API #3365
Add ADRs and AFs to API #3365
Conversation
9964dc7
to
aed34d5
Compare
Codecov Report
@@ Coverage Diff @@
## develop #3365 +/- ##
===========================================
- Coverage 88.75% 88.47% -0.29%
===========================================
Files 75 75
Lines 6199 6314 +115
===========================================
+ Hits 5502 5586 +84
- Misses 697 728 +31
Continue to review full report at Codecov.
|
85c04e3
to
4809fe2
Compare
webservices/resources/legal.py
Outdated
@@ -145,7 +154,12 @@ def mur_query_builder(q, type_, from_hit, hits_returned, **kwargs): | |||
.index('docs_search') \ | |||
.sort("sort1", "sort2") | |||
|
|||
return apply_mur_specific_query_params(query, **kwargs) | |||
if type_ == 'murs': |
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.
Instead of having distinctly named query parameters for every document type, we may want to consider combining them and having common parameters like document_no, respondents, dispositions, min_date, etc.
9de7bda
to
0906c2c
Compare
97f0617
to
ac0d5d7
Compare
ac0d5d7
to
3c4c7d8
Compare
c079002
to
66944f1
Compare
66944f1
to
4ac25f7
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.
Nice work! Made some minor comments.
SET search_path = fecmur, pg_catalog; | ||
|
||
CREATE OR REPLACE VIEW cases_with_parsed_case_serial_numbers AS | ||
CREATE OR REPLACE VIEW cases_with_parsed_case_serial_numbers_vw AS |
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 dropping the old view cases_with_parsed_case_serial_numbers
somewhere?
locustfile.py
Outdated
@@ -200,6 +200,20 @@ def get_mur(self, term=None): | |||
} | |||
self.client.get('legal/docs/murs/7074', name='legal_get_mur', params=params) | |||
|
|||
@locust.task |
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.
This appears to be pre-existing - the term
parameter is unused.
locustfile.py
Outdated
params = { | ||
'api_key': API_KEY, | ||
} | ||
self.client.get('legal/docs/adrs/668', name='legal_get_adr', params=params) |
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.
Again pre-existing - we may want to select a random document from a list of known document numbers. Also, applies to AOs, AFs and MURs.
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, I'll put in a new commit.
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.
2 WHERE keywords in the query
RECENTLY_MODIFIED_MURS = """
SELECT case_no, pg_date
FROM fecmur.cases_with_parsed_case_serial_numbers
WHERE pg_date >= NOW() - '8 hour'::INTERVAL
WHERE case_type = 'MUR'
ORDER BY case_serial
"""
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.
doc strings need to be updated too - like Mur --> case -
- to avoid confusion.
in the mapping file, 'url' mapping could be discussed a little more.
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.
in current_murs.py:
def load_current_murs(mur_no=None):
load_cases(mur_no, 'MUR') load_cases(mur_no, 'MUR')
to be unified with adrs and AF, better to change mur_no --> case_no
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 see different string formatting patterns in the code:
if case_type == 'MUR':
return mur case['mur_type'] = 'current'
case['url'] = '/legal/matter-under-review/%s/' % row['case_no']
else:
case['url'] = '/legal/{0}/{1}'.format(case_type.lower(),
not a big issue, but better to be unified.
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.
later on, we can move hard-coded 'MUR', 'AF', 'ADR' to a case config file or something like that.
Thanks for your feedback, @qqss88! Re: #3365 (review), I unify them in this commit: cc6e4d8 sorry if that doesn't address your comment. |
Great job!!! Ignore my comments for those pre-existing stuff. We can discuss how to improve the code the base in a general discussion. Thx. |
eb1855f
to
bd6cb12
Compare
c2f6def
to
a50986a
Compare
GRANT SELECT ON TABLE cases_with_parsed_case_serial_numbers_vw TO fec_read; | ||
GRANT SELECT ON TABLE cases_with_parsed_case_serial_numbers_vw TO openfec_read; | ||
|
||
DROP VIEW cases_with_parsed_case_serial_numbers |
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.
Missing semicolon?
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.
Thank you! I'm surprised the migrations run - probably because it's at the end.
a50986a
to
52fcbeb
Compare
@vrajmohan @qqss88 I've made your suggested changes and split the celery task for automatic reloading of ADR/AF to a new PR: #3374 |
Summary (required)
Resolves #3359
_vw
suffixRemaining dev work
mur_
query fields or we'll break the front end, but build generic ones as for MUR/ADR/AF. Put in an issue to refactor front end to use generic filters for MURs.How to test the changes locally
invoke create_sample_db
fecmur.cases_with_parsed_case_serial_numbers_vw
tofecmur.cases_with_parsed_case_serial_numbers_lb_tmp
Search ADR/AF/MUR
http://localhost:5000/v1/legal/search/?type=admin_fines
ADR/AF/MUR "canonical" page
Impacted areas of the application
List general components of the application that this PR will affect: