Open MichalOren opened 3 years ago
@rsperer we want to create multiple similar widgets - each one with different vehicle type. We want each widget to have a unique id - maybe we can use class inheritance here? Perhaps @ziv17 you have an idea what's the best way to model this?
Is it exactly same widget, but for different vehicle type? Or with small differences?
@ziv17 yes it's exactly the same widget but with different vehicle types
I would use a @classmethod
as a factory to generate the widget instances. One at Widget
class for all the regular cases, and one for this widget, were it will generate an instance for each vehicle. I can do the infrastructure part if you prefer.
I'd like to tackle it myself, will consult @ziv17 about the class infrastructure
sorry i did not mean to cose it ):
@MichalOren I see that the query returns accident_type as int but the visualization shows it as string. What should it be?
@MichalOren @atalyaalon I see all other infographics extract from "involved_markers_hebrew" while this one goes to "markers". Wanted to verify with you this is indeed what we want.
@ziv17 yes it's exactly the same widget but with different vehicle types
@atalyaalon do we expect to generate all those widgets when returning data per a specific news_flash or I we likely to generate just one\two depending on the vehicle(s) involved?
@MichalOren I see that the query returns accident_type as int but the visualization shows it as string. What should it be?
return accident_type and use the english_accident_type_dict as used here
@MichalOren @atalyaalon I see all other infographics extract from "involved_markers_hebrew" while this one goes to "markers". Wanted to verify with you this is indeed what we want.
Yes, in this widget we count accidents, using markers is enough
@ziv17 yes it's exactly the same widget but with different vehicle types
@atalyaalon do we expect to generate all those widgets when returning data per a specific news_flash or I we likely to generate just one\two depending on the vehicle(s) involved?
We might generate more than one widget - we don't want to be limited in that sense and have the option to send all of the Widgets with different vehicle types.
@atalyaalon @MichalOren I have a question about how we should retrieve "last 5 years". The referenced query uses field accident_year and values (2014,2019) while in most queries we look at last 5 years ranging back from the accident date. Which one should it be for this query? For now I did the latter (like other queries)
OK by me
@rsperer closing this one
@rsperer can you create a FE issue now that API exists?
Similar to this one - https://github.com/hasadna/anyway-newsflash-infographics/issues/541 With the visualization @MichalOren created
Name Query for: most common motorcycle accidents types in a specific road vs all other interurban roads. Most common refer to the top 5 accidents types in the current road (in our case road 20)
Title סוגי תאונות אופנועים בכביש __ בהשוואה לכל הארץ (שם הכותרת משתנה כתלות במספר כביש)
Visualization![image](https://user-images.githubusercontent.com/61007501/100002456-3e32e300-2dcd-11eb-80b2-c2968d883b5e.png)
Visualization explanation Visualization contains 5 bars on etch side, we refer as ‘butterfly graph’. for a specific road and for all of Israel interurban roads. Bars is will not completing to 100%. Etch one displaying the percentage of accidents by type with motorcycles vs all other interurban roads.
Use case This infographic should be displayed – when motorcycle is involved/mention in the newsflash
SQL query See query here Road number changes - according to the newsflash road1 field. Time frame: 2014-2019 Vehicle type changes - according to the newsflash (find definition below)
Additional context Add accidents involving other vehicle types--> replace "vehicle_type IN (8,9,10,19)" : Bus: vehicle_type IN (11,18) Train: vehicle_type IN (16) Tractor: vehicle_type IN (14) Private car: vehicle_type IN (1,12) Trucks: vehicle_type IN (4,5,6,7,24,25) Tracks category does not include medium vehicle type like Van\Tender\Transit