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

Add/reimplement capability to get historical air quality data #104

Merged
merged 17 commits into from
Apr 12, 2022

Conversation

lahdjirayhan
Copy link
Contributor

@lahdjirayhan lahdjirayhan commented Apr 3, 2022

This PR enables Ozone to get historical air quality data through the means of (as noted in #58):

  1. (Optional) Making search request to aqicn URL using city name to get city ID.
  2. Making request for air quality data to aqicn URL using city ID.
  3. Receiving the encoded responses.
  4. Decoding those responses using relevant parts of aqicn's frontend scripts, imported into Python using js2py.

User can provide either city name or city ID. If only city name is provided, the first search result's city ID will be used, and a warning will be displayed telling the user what city ID and station name was called.


I'm explicitly welcoming reviews and suggestions for improvement. After all, I may have accidentally overlooked some stuffs that are not immediately obvious to me at the time of writing the code.

@Milind220 Milind220 added this to the historical data!!! milestone Apr 3, 2022
@Milind220 Milind220 linked an issue Apr 3, 2022 that may be closed by this pull request
to simplify reading and understanding because it's not really
necessary to put it in a separate subfolder
I forgot to remove it when writing and it escaped my subsequent reads
which is better than what I previously use but forgot to include in
dependencies i.e. sseclient
When this happens, server does not return event stream. Thus, code will
check first if server returns event stream or not.
The previous implementation fails when searching for the term
'ukraine', because one of the results don't have 'u' member
@Milind220
Copy link
Collaborator

@lahdjirayhan Hey! Firstly, absolutely legendary work with this feature.The amount of effort you put in is so amazing - the feature's really well made.

My review will follow this comment

Copy link
Collaborator

@Milind220 Milind220 left a comment

Choose a reason for hiding this comment

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

Tried it out with 10 different cities, and it works great.

  • I love that it lets users know what station it's getting data from so they can choose better
  • Works really fast, far faster than the selenium solution that we were going for earlier, so definitely a much better implementation

I've added a few review comments, after which I think it's good to go!

src/ozone/ozone.py Outdated Show resolved Hide resolved
src/ozone/ozone.py Outdated Show resolved Hide resolved
src/ozone/ozone.py Show resolved Hide resolved
src/ozone/ozone.py Outdated Show resolved Hide resolved
@Milind220
Copy link
Collaborator

@lahdjirayhan
I cannot put into words how excited I am to merge this into Ozone. This feature will allow us to market Ozone to a larger number of users, and will make the package much more well rounded!

Thank you so much for working on this with such dedication. Your contributions to Ozone have been extremely valuable and high quality.

@lahdjirayhan
Copy link
Contributor Author

@Milind220 Thank you, too, for having me as a contributor to this project! A wonderful opportunity.

Hope Ozone can be useful to a lot of people!

Copy link
Collaborator

@Milind220 Milind220 left a comment

Choose a reason for hiding this comment

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

Great! merging it into dev now - let's try it out there a few times, and if all's good we can have a new release soon :)

@Milind220 Milind220 merged commit 9568fc3 into Ozon3Org:dev Apr 12, 2022
@lahdjirayhan lahdjirayhan deleted the get-hist-data branch April 14, 2022 07:55
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.

Test out historical-data feature to ensure that it's production ready
2 participants