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

Dev air quality agent #227

Merged
merged 43 commits into from
Oct 5, 2022
Merged

Dev air quality agent #227

merged 43 commits into from
Oct 5, 2022

Conversation

markushofmeister
Copy link
Collaborator

Agent to continuously instantiate/update latest air quality data across the UK and create output files for DTVF. Current updating frequency once per day, but can easily be increased/amended by different frequency of job scheduler within Docker container.
More frequent instantiation or output file creation also to be trigger by HTTP requests when needed.

One remaining observed issue is the correct display of the respective units in the time series panel, i.e. µg/m3.
When creating the output files outside of Docker (i.e. locally run script or locally deployed agent) the units get displayed correctly. In case the output files are created from within Docker, the units get messed up.

Created outside Docker:
unit representation in timeseries json file: "units": [ "\u03bcg/m3" ]
image

Created from within Docker:
unit representation in timeseries json file: "units": [ "\u00ce\u00bcg/m3" ]
image

…formation from API (not time series data itself)
…and retrieve_timeseries_information_from_api
… pollutant reading as individual time series
…readings at the same station where several pollutant readings for same pollutant are provided; continued functionality to add time series data
@markushofmeister markushofmeister self-assigned this Jun 17, 2022
@gpeb2
Copy link
Collaborator

gpeb2 commented Jun 20, 2022

It looks like a difference in the encoding Unicode vs UTF-8, see https://en.wikipedia.org/wiki/Mu_(letter)#Character_encodings

@markushofmeister
Copy link
Collaborator Author

It looks like a difference in the encoding Unicode vs UTF-8, see https://en.wikipedia.org/wiki/Mu_(letter)#Character_encodings

I tried several things now, and "simply" changing the encoding doesn't seem to help. I debugged a little and figured out that the error likely occurs when writing the unit symbol μg/m3 into Blazegraph when running the agent and Blazegraph within Docker. I tried to replace the unit μg/m3 with its UTF-8 or UTF-16 representation, but also then the populated unit within Blazegraph is not what we want. Could setting the locale/encoding for the Blazegraph image within the container help? And if so, how could that be done?

@gpeb2
Copy link
Collaborator

gpeb2 commented Jun 22, 2022

It looks like a difference in the encoding Unicode vs UTF-8, see https://en.wikipedia.org/wiki/Mu_(letter)#Character_encodings

I tried several things now, and "simply" changing the encoding doesn't seem to help. I debugged a little and figured out that the error likely occurs when writing the unit symbol μg/m3 into Blazegraph when running the agent and Blazegraph within Docker. I tried to replace the unit μg/m3 with its UTF-8 or UTF-16 representation, but also then the populated unit within Blazegraph is not what we want. Could setting the locale/encoding for the Blazegraph image within the container help? And if so, how could that be done?

Not sure how helpful this is but I think it's probably relevant https://github.com/blazegraph/database/wiki/Unicode.

@markushofmeister markushofmeister requested a review from sm453 July 14, 2022 07:03
…e. geometry information missing for some stations)
Copy link
Collaborator

@gpeb2 gpeb2 left a comment

Choose a reason for hiding this comment

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

Assuming what I said in my comment is correct then this looks fine. If you don't already, I would suggest you open this in VSCode with the sonarlint linter enabled as there are a few minor suggestions mainly regarding exceptions that might make the code a little bit nicer.

Comment on lines +252 to +267
if __name__ == '__main__':

# Create station and time series output files
create_json_output_files('C:\TheWorldAvatar-git\Agents\AirQualityAgent\output')

# create_json_output_files('C:\TheWorldAvatar-git\Agents\AirQualityAgent\output',
# observation_types=['PM10Concentration'])

# Data retrieval with geospatial search require a geospatially-enabled
# Blazegraph namespace to work successfully
# create_json_output_files('C:\TheWorldAvatar-git\Agents\AirQualityAgent\output',
# circle_center='52.75#0.4', circle_radius='100')

# create_json_output_files('C:\TheWorldAvatar-git\Agents\AirQualityAgent\output',
# circle_center='52.75#0.4', circle_radius='100',
# observation_types=['PM10Concentration'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this block is just for debugging/manual testing, is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this code is only reached when executed as main script (i.e. called manually)

@markushofmeister
Copy link
Collaborator Author

markushofmeister commented Oct 5, 2022

@gpeb2: As this agent in its current design is not working with/within the stack, will the FeatureInfoAgent still be able to visualise and extract the data? Or shall the agent be re-factored to work within the same stack as all other agents?

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