-
Notifications
You must be signed in to change notification settings - Fork 12
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
Weather Data Plots #168
base: master
Are you sure you want to change the base?
Weather Data Plots #168
Conversation
A static html button has been added to the template for county. Also some css has been removed for a correctly bootstrap css display.
When the checkbox is pressed will be activated a filter to add the weather info. Its needed to change the chart to draw the data.
to not to redo the logic once return is extracted, the use of if-else will not compute the (consult)
now text in label weather is inside for smaller views added previous classes for mobile view
Some dummy data is added to check that it works
useful for drawing areachart plots
- Moving code to an external file to keep code organised - Drawing dynamic plot per county with precipitations and temperature data
yaxis has been added, colors improved, datestamp improved, texts and titles improved, margins added
p tag not needed and series already defined in chart.
when the div was not created for states, program was throwing an error. Now fixed with jquery
- All the information is not in one plot, if I have 3 counties it would be 9 lines, too much - X Axis when one county is selected will 100% match - The correlations are perfectly visible - Adding another Y axis data is no effort and will not compromise the main plot
Now a weather var has been created in case that some new changes are done for result. In this case this should not affect to the weather data.
Data is represented if a venue type is not selected.
Feature/300420 weather info
Hi, you are probably seeing that app.yaml conflicts here? |
Hi! I just saw the new data version, you are too quick! ;) I fix it! |
This is very cool! I'm looking at https://visitdata-275208.wl.r.appspot.com/bydatesel/California/ALL/Beach I would rather see only high temperature rather than the low-high range, to avoid overwhelming the viewer/user. Nevertheless it's very cool! Continuing to play with it... |
One weird thing:
It's probably "Shops & Services" that's being displayed but there's no way for the user to know that. |
And minor issue but call it "Precipitation" not "Precipitations" |
What is more useful for clients? A) As a line |
I think as a line is better, but I think it should be a separate chart not
directly overlapping the visit data, because all the superimposed data
makes it hard to read.
Example: https://www.highcharts.com/demo/synchronized-charts
…On Tue, May 5, 2020 at 12:16 PM petramika ***@***.***> wrote:
@dsjoerg <https://github.com/dsjoerg>
I would rather see only high temperature rather than the low-high range
What is more useful for clients?
A) As a line
<https://i.ibb.co/M537p4N/Screenshot-2020-05-05-at-18-03-53.png>
B) Or as a column
<https://i.ibb.co/Mpsk7cC/Screenshot-2020-05-05-at-18-08-43.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#168 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF7HKLNJ3O777YX7MZJTCTRQA3VFANCNFSM4MWDE3JQ>
.
|
Features/weather anne 050520
Hi David, you have the fixes that you wanted on live. Just one thing, I left it at the moment as a line, I didn’t separate it into several plots. This was the first approach that I wanted to take, the problem is that the JSON that I had to do it was making that visits data or weather data was lost, I needed to have all the data with the timestamps filled, if not it was not possible. This is why I followed this solution:
https://www.highcharts.com/demo/combo-multi-axes <https://www.highcharts.com/demo/combo-multi-axes>
It even looks that this plot was designed for the specific issue that we are facing here :) Cheers.
… On 5 May 2020, at 18:41, David Joerg ***@***.***> wrote:
I think as a line is better, but I think it should be a separate chart not
directly overlapping the visit data, because all the superimposed data
makes it hard to read.
Example: https://www.highcharts.com/demo/synchronized-charts
On Tue, May 5, 2020 at 12:16 PM petramika ***@***.***> wrote:
> @dsjoerg <https://github.com/dsjoerg>
>
> I would rather see only high temperature rather than the low-high range
>
> What is more useful for clients?
>
> A) As a line
> <https://i.ibb.co/M537p4N/Screenshot-2020-05-05-at-18-03-53.png>
> B) Or as a column
> <https://i.ibb.co/Mpsk7cC/Screenshot-2020-05-05-at-18-08-43.png>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#168 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAF7HKLNJ3O777YX7MZJTCTRQA3VFANCNFSM4MWDE3JQ>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#168 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABOAHCKAWRQ333AOKDJBAITRQA6T7ANCNFSM4MWDE3JQ>.
|
|
||
BASE_URL = "http://api.weatherapi.com/v1/history.json?key={}&q={}+united+states&dt={}" | ||
# Get a weatherapi.com api key | ||
API_KEY = os.environ.get("API_WEATHER_KEY", "a70a4e2736644cdcb9d85348202404") |
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.
Keys must never be committed to version control. This must be removed and the history squashed before merging. We can register the API key as an airflow secret.
BASE_URL = "http://api.weatherapi.com/v1/history.json?key={}&q={}+united+states&dt={}" | ||
# Get a weatherapi.com api key | ||
API_KEY = os.environ.get("API_WEATHER_KEY", "a70a4e2736644cdcb9d85348202404") | ||
BUCKET_NAME = os.environ.get("BUCKET_NAME", "default") |
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.
Should fail if env not set, to force correct configuration, instead of silently choosing an invalid bucket name.
cached_data = stated_cached_data.get(county, {}) | ||
data[county] = always_merger.merge(cached_data, api_data) | ||
|
||
state_blob = bucket.blob("{}.json".format(selected_state)) |
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.
Proposed: Let's use gs://data.visitdata.org/processed/vendor/api.weatherapi.com/asof/yyyymmdd/*.json
to store this data.
@@ -0,0 +1,7 @@ | |||
BASE_URL = "http://api.weatherapi.com/v1/history.json?key={}&q={}+united+states&dt={}" | |||
API_KEY = "a70a4e2736644cdcb9d85348202404" |
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.
API keys must never be committed to version control. This must be removed and squashed before merging.
|
||
return weather | ||
|
||
def __load_state_file(state): |
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.
dunders are typically reserved for the Python Core API team. A single _
prefix would suffice here. See https://amontalenti.com/2013/04/11/python-double-under-double-wonder
`BUCKET_NAME` variable must be defined in the airflow server | ||
|
||
Once the data is stored in the bucket, we can get the weather data for one state in the route | ||
`weather/<state>` |
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 might want to consolidate all of this under https://visitdata.org/data/
and present it as a single bundle that all goes together.
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.
@markroth8 the only issue is that it would increase the size of the initial data load for each page before it renders. If we assume that in most cases, people will be looking at the visits and not the weather, it would be better to load it only upon request.
In general if we plan to add more data sources which might be only displayed based on user's choices in the UI, the architecture of separating those data sources might be better?
@@ -2,4 +2,5 @@ runtime: python37 | |||
entrypoint: gunicorn -b :$PORT main:app | |||
|
|||
env_variables: | |||
FOURSQUARE_DATA_VERSION: "20200503-v0" | |||
FOURSQUARE_DATA_VERSION: "20200504-v0" | |||
BUCKET_NAME: "vd-weather-data" |
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.
Let's add a WEATHERAPI_DATA_VERSION
variable to set the as of date for the weather data as part of the deployment. We can use the same bucket (data.visitdata.org
).
@@ -1,2 +1,4 @@ | |||
apache-airflow==1.10.10 | |||
google-cloud-storage==1.27.0 | |||
requests | |||
deepmerge |
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.
Pin version in requirements.txt
so we know we're running the same thing.
@@ -143,6 +145,13 @@ def data(path): | |||
snapshot_id=app_state['foursquare_data_version']) | |||
|
|||
|
|||
@app.route("/weather/<state>") |
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.
Maybe we can just get this from /data/weather/<state>
google-cloud-storage==1.27.0 | ||
pyyaml==5.3.1 | ||
requests | ||
deepmerge |
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.
Pin version in requirements.txt so we know we're all running the same thing.
I've added some review comments. I can help with them, as well. |
Feature to show weather plots data per county for the last 30 days.
This Feature is related to #32
For further documentation of how does this work, please refer to: https://github.com/strivelabs/ca_visit_tracking/wiki
For live test deployment, check: https://visitdata-275208.wl.r.appspot.com/index.html, if you get a CORS problem, please check a chrome extension as "Moesif Orign & CORS Changer"