Open johnnyporkchops opened 1 year ago
Three brainstorming ideas:
1) We can put a hidden text field with id="committee_id"
using the simple text field macro (don't necessarily need a hidden typeahead field) in the filings_filter.jinja
which would allow committee_id
to work in a URL (including unverified comms)
Remaining issues with this solution:
- FIXED with https://github.com/fecgov/openFEC/pull/5424 unverified committees still need to be fixed for `q_filer` typeahead (@fec-jli and @hcaofec have fix)
- **Frontend issue:** How to display the tag checkboxes in the filter panel to make sense to the user
- **API issue:** You cannot combine `committee_id` and `q_filer` in the same URL or API query to the filings endpoint. (Tested on OpenFEC.)
2) Or we could put two fields here instead:
Commitee id
(with id="commitee_id"
)And the existing typeahead/free-text field labeled Committee name or id
(with id="q_filer"
)
Remaining issues with this solution:
committee_id
and q_filer
in the same API query to the filings endpoint. (Tested on OpenFEC.)3) Or maybe we can just redirect( in proxy app), URLS with /filings/?committee_id...
to filings/?q_filer...
because arguably it is a legacy pattern. Or redirect with this JS, with a pushState
or replaceState
to convert committee_id
to q_filer
in URLS: (Tested and works well)
const queryx = this.parseParams(this.getVars());
if (queryx.committee_id && /\/filings/.test(window.location.href)){
if (queryx.q_filer) {
queryx.q_filer = urls.ensureArray(queryx.q_filer)
queryx.q_filer.push(...urls.ensureArray(queryx.committee_id))
}
else {
queryx.q_filer = queryx.committee_id
}
delete queryx.committee_id
const urlx = new URL(window.location.href.split('?')[0])
let new_query = URI.buildQuery(queryx)
let new_url = `${urlx}?${new_query}`
history.pushState(null, '', new_url);
//OR TO USE `replaceState` INSTEAD
NOTE: Also @fec-jli mentioned that, of the two parameters, q_filer
is the more "expensive" option and we should only call it when doing a free-text search, otherwise call the API, with committee_id
, but which endpoint? This changes everything mentioned above :-(
sample api urls: https://fec-dev-api.app.cloud.gov/v1/filings/?q_filer=C00780197 (return 9 rows) https://fec-dev-api.app.cloud.gov/v1/filings/?q_filer=C007801 (return 122 rows)
Had a convo with back-end and database about this issue and we came to the following three issues that need resolution:
Follow-up Typeahead research ticket https://github.com/fecgov/fec-cms/issues/5800
Summary
The link to an unverified committee doesn't seem to work anymore., https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197, but links to unverified candidates seem to still work, https://www.fec.gov/data/filings/?data_type=processed&candidate_id=H8NC00023.
committee_id
withq_filer
(in the URL) for a verified committee, it returns the correct datacommittee_id
withq_filer
(in the URL) for the unverified committee C00780197, there is no data. @PaulClark2 says that he expects 9 filings to appear for this committee. Related: https://github.com/fecgov/fec-cms/pull/5512 https://github.com/fecgov/fec-cms/pull/5408What happened? https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197 shows all filings with no filter
What should have happened? https://www.fec.gov/data/filings/?data_type=processed&committee_id=C00780197 should show nine filings for the unverified committee.
~Completion Criteria~ Possible tech steps
Completion criteria