-
Notifications
You must be signed in to change notification settings - Fork 244
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 weather data infographic [don't merge] #1551
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1551 +/- ##
==========================================
- Coverage 50.62% 50.07% -0.55%
==========================================
Files 52 54 +2
Lines 5485 5665 +180
==========================================
+ Hits 2777 2837 +60
- Misses 2708 2828 +120
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
FYI: you can just mark it as draft |
@idosavion |
@Hedingber can you please split this one to a few logically separated commits? |
b80676a
to
bb49592
Compare
bb49592
to
2efdb94
Compare
@idosavion Done |
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.
👏 👏
@@ -1041,6 +1046,66 @@ def pedestrian_injured_in_junctions_mock_data(): # Temporary for Frontend | |||
] | |||
|
|||
|
|||
@WidgetCollection.register | |||
class AccidentCausedByRainWidget(Widget): | |||
# the rain rate threshold after which we count the accident as a cause of the rain |
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 .. as caused by rain
?
This PR adds a weather infographic which includes the following list of the following data:
This allows to show infographic that shows amount of accidents caused by rain (and their percentage) by severity
Notes:
get_weather_at_station
function inweather_interpolator.py
)rain_rate
is above theACCIDENT_RAIN_RATE_THRESHOLD
which is defined ininfographics_utils.py
ensure_accidents_weather_data
function after every import of new accidents from the cbs.Basically backfill will happen automatically the next time we'll get update from the cbs (the function ensures all db records, not just new ones)
But if we don't want to wait we can do it manually, it can be done by running:
python main.py process weather-data
Running it on the whole history is pretty heavy, so we can separate it to several batches by using the
start_date
filter, e.g.python main.py process weather-data --start_date 01-01-2019
After the backfill everytime new accidents are inserted from new data from the cbs the
ensure_accidents_weather_data
function will be triggered which will fill weather data for the new accidents