insight-lane / crash-model

Build a crash prediction modeling application that leverages multiple data sources to generate a set of dynamic predictions we can use to identify potential trouble spots and direct timely safety interventions.
https://insightlane.org
MIT License
112 stars 40 forks source link

Handle military time, such as in Pittsburgh's case #180

Closed j-t-t closed 5 years ago

mtjones330 commented 5 years ago

The time of day for the Allegheny county crash data is represented as an integer in 24-hour format. https://data.wprdc.org/dataset/allegheny-county-crash-data

TIME_OF_DAY HOUR_OF_DAY
257 2
1027 10
1839 18
914 9
2230 22
1415 14
1430 14
847 8
1244 12
1150 11
1614 16
terryf82 commented 5 years ago

I've created PR 181 from a new branch _crashimport to resolve this, which actually covers a few separate issues. Of relevance to this specific issue though, the _initializecity script now provides additional options for specifying different time formats. If you specify time (indicating it exists separately from the crash date) you also need to specify _timeformat as one of "military", "seconds" (since midnight) or "default", and the date parser acts accordingly.

I've updated the configs for our 3 test cities, as well as added a Pittsburgh config, which is presently the only city using the "military" time option.