Skip to content
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

Resolve Issue 95: Added SQL to prune 311 data to most recent 30 days #123

Merged
merged 8 commits into from
Mar 21, 2017
Merged

Resolve Issue 95: Added SQL to prune 311 data to most recent 30 days #123

merged 8 commits into from
Mar 21, 2017

Conversation

BenjaminMuscato
Copy link
Contributor

Updated the SQL query for gathering 311 data, to limit the data returned
to be from the most recent 30 days.

Also removed the arbitrary limitation that had been on the 311 data,
which limited it to gather the 250 most recent records.

Updated the SQL query for gathering 311 data, to limit the data returned
to be from the most recent 30 days.

Also removed the arbitrary limitation that had been on the 311 data,
which limited it to gather the 250 most recent records.
main.js Outdated
@@ -286,7 +286,7 @@
// TODO: would be great to prune 311 data to the last 30 days, like the police data
"311": {
id: "40776043-ad00-40f5-9dc8-1fde865ff571",
primaryFiltering: "WHERE \"NEIGHBORHOOD\" LIKE '%Oakland' ORDER BY \"CREATED_ON\" DESC",
primaryFiltering: "WHERE \"NEIGHBORHOOD\" LIKE '%Oakland' AND \"CREATED_ON\" >= (NOW() - '30 day'::INTERVAL) ORDER BY \"CREATED_ON\" DESC",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this works on all data sets from the WPRDC? That would be awesome

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tried it on the other data-sets, but I'll try it out and get back to you!

main.js Outdated
@@ -455,7 +455,7 @@
function fetchAllData() {
Promise.all([
fetchWPRDCData("Police", { limit: 250 }),
fetchWPRDCData("311", { limit: 250 }),
fetchWPRDCData("311"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rm the arbitrary limitation on the others, too? Or do we need to have the work-around there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the updated ".primaryFilter" that I used for the 311 data-set works for the others, we shouldn't need this limit for any of them. I'll test it out and get back to you!

@vonbearshark
Copy link
Contributor

@BenjaminMuscato did you get a chance to run your tests? Before you commit again, you'll need to merge in the recent changes, which separate some constants into another JS file.
Also, could you remove this block of code https://github.com/Pitt-CSC/PantherView/blob/master/main.js#L264 ? Since you've made it unnecessary. You can also remove the TODO comment on line 204, too.

@vonbearshark
Copy link
Contributor

Looks great! If you take out those TODO comments I can merge it in!

Removed the "TODO" statements about adding the SQL filtering. I left the
JS filtering in place for now, as it's also needed to filter by Day and
Week, even after the data is gathered from the database.
@BenjaminMuscato
Copy link
Contributor Author

@vonbearshark I've removed the "TODO" comments, I think the PR is ready to go.

I didn't touch any of the JS filtering that's currently in place, since I think we still need it in its current form to filter through the data even after we've gotten it from the database (to show by Day, Week, and Month in the GUI).

Copy link
Contributor

@vonbearshark vonbearshark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic!

@vonbearshark
Copy link
Contributor

Great work, @BenjaminMuscato. Thanks a lot! This is a good addition

@vonbearshark vonbearshark merged commit ca6db1a into pittcsc:master Mar 21, 2017
@BenjaminMuscato BenjaminMuscato deleted the Issue-95---WPRDC-SQL-Date-Range branch March 22, 2017 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants