Skip to content

Commit

Permalink
PR for FARS Crash Data
Browse files Browse the repository at this point in the history
  • Loading branch information
saanikaaa committed Sep 12, 2024
1 parent c9f7994 commit 2b1ff6d
Show file tree
Hide file tree
Showing 14 changed files with 4,406 additions and 0 deletions.
20 changes: 20 additions & 0 deletions statvar_imports/USA/NHTSA_FARS_CrashData/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# USA - NHTSA FARS Crash Data

- source: https://www.nhtsa.gov/file-downloads?p=nhtsa/downloads/FARS/,

- how to download data: Manual download from source.

- type of place: Country, State and County.

- statvars: Demographics

- years: 1975 to 2022

- place_resolution: FIPS code present in data sheet.

### How to run:

`python3 stat_var_processor.py --input_data=<input_file>.csv --pv_map=statvar_imports/USA/NHTSA_FARS_CrashData/pv_map/<filename>_pvmap.csv --config=statvar_imports/USA/NHTSA_FARS_CrashData/test_data/common_metadata.csv --output_path=--output_path=<filepath/filename>`

#### Example
`python3 stat_var_processor.py --input_data=statvar_imports/USA/NHTSA_FARS_CrashData/test_data/sample_input/accident_1975Onwards_data.csv --pv_map=statvar_imports/USA/NHTSA_FARS_CrashData/pv_map/accident_1975Onwards_pvmap.csv --config=statvar_imports/USA/NHTSA_FARS_CrashData/test_data/common_metadata.csv --output_path=--output_path=/Users/sanikap/brazil_visadata/data/statvar_imports/USA/NHTSA_FARS_CrashData/test_data/sample_output/accident_1975Onwards`
15 changes: 15 additions & 0 deletions statvar_imports/USA/NHTSA_FARS_CrashData/common_metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameter,value
url,https://www.nhtsa.gov/file-downloads?p=nhtsa/downloads/FARS/
description,Data on fatal motor vehicle crashes in the USA.
#place_type,"country, state, county"
#places_within,country/USA
start_date,1975
end_date,2022
release_frequency,P1Y
process,
comments,
#places_resolved_csv,FIPS codes present in data sheet
multi_value_properties,"observationDate, observationAbout, observationPeriod"
header_rows,1
output_columns,"observationAbout,observationDate,variableMeasured,value,unit,observationPeriod"
word_delimiter,""""""

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
STATE,COUNTY,MONTH,DAY,YEAR,HOUR,MINUTE,VE_FORMS,PERSONS,VEHICLES,LAND_USE,CL_TWAY,ROAD_FNC,TA_1_CL,SP_JUR,HARM_EV,MAN_COLL,REL_JUNC,REL_ROAD,ROAD_FLO,NO_LANES,SP_LIMIT,ALIGNMNT,PROFILE,PAVE_TYP,SUR_COND,TRA_CONT,LGT_COND,WEATHER,HIT_RUN,C_M_ZONE,NOT_HOUR,NOT_MIN,ARR_HOUR,ARR_MIN,SCH_BUS,CF1,CF2,CF3,FATALS,DAY_WEEK,DRUNK_DR,ST_CASE,CITY,RAIL
1,95,1,4,75,22,24,3,3,,1,3,,,0,12,2,1,1,3,4,55,1,1,2,2,0,2,1,0,,99,99,22,40,1,0,0,0,1,7,0,10001,400,*******
1,95,1,2,75,4,30,1,2,,2,4,,,0,18,0,1,5,4,2,50,2,1,2,1,0,2,1,0,,99,99,4,50,1,0,0,0,1,5,0,10002,110,*******
1,35,1,1,75,4,0,1,1,,2,6,,,0,1,0,1,4,4,2,55,1,2,2,1,0,2,1,0,,99,99,5,40,1,0,0,0,1,4,0,10003,0,*******
1,77,1,2,75,14,50,1,3,,2,6,,,0,27,0,1,4,4,2,55,2,1,2,1,0,1,1,0,,99,99,17,20,1,0,0,0,1,5,0,10004,0,*******
1,97,1,5,75,20,0,1,1,,1,7,,,0,28,0,1,2,4,2,35,1,1,1,1,0,2,1,0,,99,99,20,10,1,0,0,0,1,1,0,10005,2100,*******
1,65,1,4,75,15,0,2,4,,2,4,,,0,12,4,5,1,4,2,55,1,2,2,1,0,1,1,0,,99,99,15,15,,0,0,0,1,7,0,10006,0,*******
1,89,1,8,75,13,20,1,1,,2,7,,,0,17,0,1,2,4,2,55,1,1,2,2,0,1,2,0,,99,99,13,30,,0,0,0,1,4,0,10007,2225,*******
1,69,1,4,75,1,15,1,1,,1,7,,,0,1,0,2,6,3,2,55,2,2,2,2,0,2,2,0,,99,99,1,40,,0,0,0,1,7,0,10008,2961,*******
1,73,1,6,75,17,40,1,2,,1,3,,,0,8,0,1,1,3,2,50,1,1,2,1,0,6,1,0,,99,99,17,52,,0,0,0,1,2,0,10009,1270,*******
1,101,1,3,75,17,44,2,5,,1,3,,,0,12,4,5,1,3,2,40,1,2,2,2,3,2,2,0,,99,99,17,58,,1,0,0,1,6,0,10010,2130,*******
1,3,1,10,75,23,0,1,1,,2,1,,,0,1,0,1,6,3,2,55,1,1,2,1,0,2,1,0,,99,99,23,45,,0,0,0,1,6,0,10011,0,*******
1,47,1,5,75,17,48,2,2,,2,3,,,0,12,1,2,1,3,2,55,1,2,2,1,0,2,9,0,,99,99,17,59,,0,0,0,1,1,0,10012,0,*******
1,117,1,11,75,15,55,1,1,,2,4,,,0,27,0,1,5,4,2,55,1,2,2,1,0,1,1,0,,99,99,16,50,,0,0,0,1,7,0,10013,0,*******
1,61,1,10,75,22,50,1,3,,2,4,,,0,14,1,1,2,4,2,55,1,1,2,2,0,2,1,0,,99,99,23,10,,0,0,0,2,6,0,10014,0,*******
1,117,1,13,75,18,10,1,2,,2,3,,,0,8,0,1,1,3,2,55,1,2,2,1,0,2,1,0,,99,99,18,20,,0,0,0,1,2,0,10015,2405,*******
1,101,1,8,75,21,30,1,3,,1,7,,,0,18,0,2,5,4,2,25,1,2,2,2,4,2,9,0,,99,99,21,42,,0,0,0,1,4,0,10016,2130,*******
1,97,1,11,75,16,1,1,2,,1,7,,,0,8,0,1,1,4,5,35,1,1,2,1,0,1,1,0,,99,99,16,8,,0,0,0,1,7,0,10017,2100,*******
1,95,1,7,75,18,30,2,2,,2,4,,,0,12,4,2,1,4,2,55,1,1,2,1,0,2,1,0,,99,99,18,45,,0,0,0,1,3,0,10018,0,*******
1,99,1,12,75,3,21,1,2,,2,3,,,0,7,0,1,5,4,2,55,2,2,2,1,0,2,1,0,,99,99,4,0,,0,0,0,1,1,0,10019,0,*******
1,73,1,17,75,99,99,1,1,,1,6,,,0,1,0,1,4,3,2,45,1,1,2,1,0,2,1,0,,99,99,24,0,,0,0,0,1,6,0,10020,1850,*******
1,41,1,15,75,8,30,1,1,,2,6,,,0,19,0,5,4,4,2,55,1,1,2,1,0,1,1,0,,99,99,10,40,,0,0,0,1,4,0,10021,0,*******
1,73,1,25,75,17,0,1,4,,1,7,,,0,14,1,5,2,4,2,25,2,2,2,1,0,6,1,0,,99,99,17,10,,0,0,0,1,7,1,10022,350,*******
1,117,1,10,75,15,20,1,2,,2,6,,,0,1,0,1,1,4,2,55,1,2,2,2,0,2,2,0,,99,99,16,20,,1,0,0,1,6,0,10023,0,*******
1,109,1,18,75,18,0,3,6,,2,4,,,0,12,2,1,1,3,2,55,2,2,2,1,0,2,1,0,,99,99,18,13,,0,0,0,1,7,0,10024,0,*******
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
STATE,COUNTY,MONTH,DAY,YEAR,HOUR,MINUTE,VE_FORMS,PERSONS,LAND_USE,ROAD_FNC,FED_AID,CL_TWAY,SP_JUR,HARM_EV,MAN_COLL,REL_JUNC,REL_ROAD,TWAY_FLO,NO_LANES,SP_LIMIT,ALIGNMNT,PROFILE,PAVE_TYP,SUR_COND,TRA_CONT,T_CONT_F,HIT_RUN,LGT_COND,WEATHER,C_M_ZONE,NOT_HOUR,NOT_MIN,ARR_HOUR,ARR_MIN,SCH_BUS,CF1,CF2,CF3,FATALS,DAY_WEEK,DRUNK_DR,ST_CASE,CITY,MILEPT,TWAY_ID,RAIL
1,53,1,4,85,8,10,1,1,2,3,2,2,0,34,0,1,6,1,2,55,2,1,2,1,0,0,0,1,1,0,99,99,8,30,0,2,0,0,1,6,0,10002,0,814,31,0
1,85,1,6,85,5,45,1,2,1,3,2,2,0,27,0,1,6,2,5,55,1,1,2,1,0,0,0,2,1,0,99,99,6,30,0,0,0,0,1,1,1,10003,9997,1093,80,0
1,119,1,6,85,4,5,1,1,2,3,2,2,0,24,0,1,6,1,2,55,1,1,2,1,0,0,0,2,1,0,4,41,4,58,0,0,0,0,1,1,0,10004,0,220,80,0
1,89,1,4,85,20,45,1,1,2,8,8,4,0,42,0,1,6,1,2,55,1,2,2,4,0,0,0,2,1,0,0,0,0,0,0,0,0,0,1,6,1,10005,0,0,1338,0
1,45,1,5,85,0,45,1,1,2,8,8,4,0,32,0,1,6,1,2,55,1,2,2,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,1,7,1,10006,0,0,1097,0
1,9,1,2,85,2,0,1,3,2,3,2,2,0,35,0,1,6,1,2,55,1,1,2,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,1,4,1,10007,0,3120,31,0
1,3,1,11,85,23,17,1,2,2,8,8,4,0,1,0,1,1,1,2,55,1,2,2,1,40,3,0,2,1,0,23,27,23,36,0,0,0,0,2,6,0,10008,0,0,1729,0
1,83,1,10,85,16,42,2,3,1,3,2,2,0,12,4,2,1,2,2,50,1,2,2,2,0,0,0,5,2,0,99,99,17,45,0,0,0,0,1,5,0,10009,170,99999,72,0
1,97,1,8,85,4,15,1,1,2,3,2,2,0,31,0,1,6,1,2,45,1,1,2,1,0,0,0,2,1,0,4,32,4,50,0,0,0,0,1,3,1,10010,0,108,45,0
1,53,1,12,85,14,0,1,1,2,3,2,2,0,1,0,1,1,1,2,55,2,1,2,1,0,0,0,1,1,0,14,13,14,23,0,0,0,0,1,7,1,10011,0,72,29,0
1,97,1,11,85,23,45,1,2,2,6,7,3,0,30,0,1,6,1,2,45,2,2,2,1,0,0,0,2,1,0,0,1,0,18,0,0,0,0,1,6,0,10012,0,46,193,0
1,41,1,10,85,18,20,1,2,2,8,8,4,0,8,0,1,2,1,2,55,1,1,2,1,0,0,0,2,1,0,99,99,18,35,0,0,0,0,1,5,0,10013,0,0,1069,0
1,97,1,6,85,17,49,1,2,1,8,8,5,0,8,0,2,1,2,2,35,1,1,2,1,0,0,0,3,1,0,17,50,17,57,0,0,0,0,1,1,0,10014,2100,0,6510,0
1,125,1,4,85,6,30,2,2,2,1,1,1,0,23,0,1,2,2,2,55,1,1,1,4,0,0,0,4,4,0,6,43,6,59,0,0,0,0,1,6,0,10015,0,799,59,0
1,119,1,10,85,10,15,2,2,2,6,7,3,0,12,2,1,1,1,2,55,1,1,2,2,0,0,0,1,1,0,99,99,10,52,0,0,0,0,1,5,0,10016,0,1738,17,0
1,21,1,10,85,9,40,1,1,2,8,8,4,0,22,0,1,2,1,2,55,1,2,2,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,5,0,10017,0,0,1134,0
1,9,1,13,85,2,0,1,1,2,8,8,4,0,42,0,1,6,1,2,55,1,1,2,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,1,1,1,10018,0,0,1073,0
1,73,1,1,85,15,52,1,2,1,8,8,4,0,43,0,1,6,1,2,35,2,2,2,1,0,0,0,1,1,0,99,99,99,99,0,0,0,0,1,3,0,10019,2960,0,5172,0
1,89,1,17,85,6,40,2,2,2,6,7,3,0,12,2,1,1,1,2,55,1,1,2,2,0,0,0,1,2,0,99,99,6,53,0,0,0,0,2,5,0,10020,0,3291,53,0
1,89,1,19,85,0,15,1,1,2,3,2,2,0,43,0,1,3,2,2,55,2,1,2,1,0,0,0,2,1,0,0,19,0,26,0,0,0,0,1,7,1,10021,0,868,72,0
1,103,1,17,85,9,10,1,1,2,8,8,4,0,42,0,1,6,1,2,55,2,2,2,2,0,0,0,1,1,0,9,20,9,30,0,0,0,0,1,5,0,10022,0,0,21,0
1,73,1,22,85,14,18,1,1,2,8,8,4,0,19,0,1,5,1,2,30,1,2,2,1,20,3,0,1,1,0,99,99,14,28,0,0,0,0,1,3,0,10023,0,0,5193,0
1,107,1,16,85,12,5,2,3,2,3,2,2,0,12,2,1,1,1,2,55,2,2,2,2,0,0,0,1,2,0,12,44,13,1,0,0,0,0,1,4,0,10024,0,115,82,0
1,15,1,17,85,7,0,2,3,2,6,7,3,0,12,2,1,1,1,2,55,1,1,2,2,0,0,0,1,3,0,7,15,7,22,0,2,0,0,2,5,0,10025,0,2375,9,0
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
STATE,ST_CASE,VE_TOTAL,VE_FORMS,PEDS,PERSONS,COUNTY,CITY,DAY,MONTH,YEAR,DAY_WEEK,HOUR,MINUTE,NHS,ROAD_FNC,ROUTE,TWAY_ID,TWAY_ID2,MILEPT,LATITUDE,LONGITUD,SP_JUR,HARM_EV,MAN_COLL,RELJCT1,RELJCT2,TYP_INT,REL_ROAD,WRK_ZONE,LGT_COND,WEATHER1,WEATHER2,WEATHER,SCH_BUS,RAIL,NOT_HOUR,NOT_MIN,ARR_HOUR,ARR_MIN,HOSP_HR,HOSP_MN,CF1,CF2,CF3,FATALS,DRUNK_DR
1,10001,1,1,0,2,81,2340,15,1,2010,6,4,10,1,11,1,I-85,,621,32.64106389,-85.35469167,0,42,0,0,1,1,4,0,3,1,0,1,0,0,99,99,4,20,99,99,0,0,0,1,1
1,10002,1,1,0,1,35,1080,11,1,2010,2,6,0,0,16,6,5010,,0,31.43044722,-86.95669444,0,30,0,0,1,1,4,0,3,1,0,1,0,0,99,99,6,9,99,99,0,0,0,1,0
1,10003,3,3,0,3,97,2100,14,1,2010,5,15,10,0,12,2,US-SR 42,4639,0,30.69163056,-88.08577778,0,12,11,0,2,3,1,0,1,1,0,1,0,0,99,99,15,16,99,99,0,0,0,1,0
1,10004,2,2,0,2,115,160,21,1,2010,5,1,16,0,14,2,US-SR 53,,2400,33.8687,-86.29116389,0,12,2,0,1,1,1,0,3,2,0,2,0,0,99,99,1,16,88,88,0,0,0,1,0
1,10005,2,2,0,2,117,0,4,1,2010,2,6,38,1,11,1,I-65,,2440,33.30974167,-86.78722222,0,12,7,0,1,1,1,1,4,1,0,1,0,0,99,99,6,49,88,88,0,0,0,1,0
1,10006,1,1,0,1,21,0,1,1,2010,6,5,34,1,1,1,I-65,,2043,32.78581389,-86.57450833,0,32,0,0,1,1,4,0,4,2,0,2,0,0,99,99,5,40,88,88,0,0,0,1,0
1,10007,1,1,0,2,97,0,1,1,2010,6,2,40,0,4,3,SR-188,,45,30.46146389,-88.29401944,0,53,0,0,1,1,4,0,3,2,0,2,0,0,99,99,3,15,99,99,0,0,0,2,0
1,10008,1,1,0,4,9,0,2,1,2010,7,15,37,0,3,3,SR-75,7842,334,33.99555556,-86.43900278,0,31,0,0,3,1,4,0,3,1,0,1,0,0,99,99,15,45,99,99,0,0,0,1,0
1,10009,1,1,0,2,51,0,2,1,2010,7,9,55,0,4,4,1209,,0,32.70871667,-86.14818611,0,1,0,0,1,1,4,0,1,1,0,1,0,0,99,99,10,10,99,99,0,0,0,1,0
1,10010,2,2,0,4,113,0,3,1,2010,1,13,50,0,4,3,SR-165,1119,202,32.25259444,-85.00338333,0,12,6,0,2,3,1,0,1,1,0,1,0,0,99,99,14,36,99,99,0,0,0,1,1
1,10011,1,1,0,1,95,0,4,1,2010,2,5,50,0,4,4,1409,,0,34.32906111,-86.16592222,0,17,0,0,1,1,4,0,4,1,0,1,0,0,99,99,6,4,88,88,0,0,0,1,0
1,10012,1,1,0,3,91,0,4,1,2010,2,16,20,0,5,4,1258,,0,31.9941,-87.86773056,0,42,0,0,1,1,4,0,1,1,0,1,0,0,99,99,16,51,99,99,0,0,0,1,1
1,10013,1,1,0,3,125,0,5,1,2010,3,23,30,0,5,4,1100,,0,33.06655,-87.53685278,0,42,0,0,1,1,4,0,6,1,0,1,0,0,99,99,23,53,99,99,0,0,0,1,1
1,10014,2,2,0,2,9,1600,6,1,2010,4,17,1,0,3,3,SR-160,,47,33.88872778,-86.76163056,0,12,2,0,1,1,1,0,3,1,0,1,0,0,99,99,5,8,99,99,0,0,0,1,0
1,10015,1,1,0,1,47,0,6,1,2010,4,15,21,0,4,4,1056,,0,32.58800833,-86.92938056,0,34,0,0,1,1,4,0,1,1,0,1,0,0,99,99,15,45,88,88,0,0,0,1,0
1,10016,2,2,0,2,127,0,7,1,2010,5,9,5,0,4,3,SR-269,,318,33.69823889,-87.25543611,0,12,2,0,1,1,1,0,1,1,0,1,0,0,99,99,9,20,99,99,0,0,0,1,0
1,10017,1,1,0,4,19,0,7,1,2010,5,15,0,0,3,3,SR-68,,251,34.23519444,-85.79175278,0,1,0,0,1,1,4,0,1,4,0,4,0,0,99,99,15,39,99,99,0,0,0,1,0
1,10018,2,2,0,3,99,0,7,1,2010,5,13,30,1,2,2,US-SR 12,,670,31.50969444,-87.48523611,0,12,6,0,1,1,1,0,1,2,0,2,0,0,99,99,14,0,99,99,0,0,0,2,0
1,10019,1,1,0,2,101,0,10,1,2010,1,4,37,1,3,2,US-SR 53,,932,32.03341944,-86.03257222,0,53,0,0,1,1,4,0,3,1,0,1,0,0,99,99,5,12,99,99,0,0,0,1,1
1,10020,2,2,0,3,43,0,7,1,2010,5,16,49,1,2,2,US-SR 74,,654,34.20842222,-87.05831944,0,12,6,0,1,1,1,0,5,4,0,4,0,0,99,99,17,15,99,99,0,0,0,1,0
1,10021,2,2,0,3,95,0,7,1,2010,5,16,34,0,3,3,SR-75,,522,34.21050556,-86.28487222,0,12,6,0,1,1,1,0,3,1,0,1,0,0,99,99,16,56,99,99,0,0,0,1,0
1,10022,1,1,1,1,55,0,11,1,2010,2,6,28,0,2,2,US-SR 25,7856,2241,34.07256944,-85.9192,0,8,0,0,3,3,1,0,1,1,0,1,0,0,99,99,6,39,99,99,0,0,0,1,0
1,10023,2,2,0,2,103,890,11,1,2010,2,13,4,1,2,3,SR-67,8231,0,34.54016667,-86.91805833,0,12,6,0,2,3,1,0,1,1,0,1,0,0,99,99,13,8,99,99,0,0,0,1,0
1,10024,2,2,1,2,49,0,12,1,2010,3,15,5,0,4,3,SR-168,,153,34.25094722,-86.10614167,0,8,0,0,8,1,1,0,1,1,0,1,0,0,99,99,15,21,99,99,0,0,0,1,0
Loading

0 comments on commit 2b1ff6d

Please sign in to comment.