Nason commited on
Commit
b40e258
·
verified ·
1 Parent(s): adb6da0

Align reader guide with established datapond documentation

Browse files
Files changed (1) hide show
  1. README.md +200 -18
README.md CHANGED
@@ -3,39 +3,221 @@ license: other
3
  license_name: nhtsa-public-information
4
  license_link: https://www.nhtsa.gov/about-nhtsa/privacy-policy
5
  pretty_name: FARS 2024 National Annual Report File
6
- tags: [fars, traffic-safety, fatal-crashes, duckdb]
7
- size_categories: [100K<n<1M]
 
 
 
 
 
 
 
8
  ---
9
 
10
- # FARS 2024 national Annual Report File
11
 
12
- Official NHTSA FARS **2024 ARF**, first released April 1, 2026, acquired October 18, 2026. This is not the later final file. The national source covers 50 states and DC; Puerto Rico is separate. Four data tables contain **190,798 rows and 413 columns**: accident 36,297; vehicle 56,011; person 88,326; code_labels 10,164. Three views are excluded from these totals. Artifact size: 26,488,832 bytes. SHA-256: `2bc31f9e9fdd973ddf728cc4e1e0811a7bacf9450dd80c7671c36fa6a1fc7442`.
13
 
14
- With DuckDB and an available httpfs extension:
 
 
 
 
 
 
 
 
15
 
16
  ```sql
 
 
 
 
17
  LOAD httpfs;
18
- ATTACH 'https://huggingface.co/datasets/Nason/fars-database/resolve/main/fars.duckdb' AS fars (READ_ONLY);
19
- SELECT state,statename,count(*) AS fatal_crashes,sum(fatals) AS fatalities
20
- FROM fars.crashes GROUP BY state,statename ORDER BY fatalities DESC,state;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ```
22
 
23
- Pin the dataset commit rather than main for reproducibility. Registry discovery requires the separate registry entry or a local override. The safe crash view aggregates children first; direct vehicle/person joins by crash multiply records. Keys are state/st_case, plus veh_no for vehicles and veh_no/per_no for people, within this year. Nonoccupants have veh_no=0; 426 people of per_typ=3 belong to omitted Parkwork and must not be discarded by an inner vehicle join.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- ## Interpretation
26
 
27
- Only fatal traffic crashes are represented, with a death within 30 days. There is no population or travel-exposure denominator here, so counts are not risk rates. Recorded people are not all travelers, and uninjured occupants may be incompletely recorded. No causal or longitudinal-person interpretation is supported.
28
 
29
- Raw source fields preserve codes and paired labels; numeric blanks on nonoccupant vehicle attributes become NULL, while blank text stays empty. `crashes` adds reconciled child counts and coordinates with unavailable codes set to NULL. `people` adds age_years (998/999→NULL), measured_bac_g_dl (0–939×0.001), a separate top-code indicator for 940, and recorded-fatal-injury status. Alcohol 995–999 means nonmeasurement categories, never zero; police drinking flags and measured tests are distinct. The three alcohol multiple-imputation files are not loaded. This release does not reproduce imputed impairment estimates; analyses across ten imputations must combine estimates rather than average a person's imputed BAC.
30
 
31
- `code_labels` retains observed tuples for 30 selected fields, including four city code/context keys with conflicting official names. `unambiguous_code_labels` excludes ambiguous keys for unique lookups. Use all table/column/context/code fields, never code alone. Raw paired labels for other fields remain in their tables. This is not a complete historical code catalog.
 
 
32
 
33
- Only accident, vehicle, person and the derived dictionary are loaded from the pinned archive. Parkwork, multiple-response factors, detailed drug/race/vPIC files, auxiliary files and alcohol MI tables are omitted. See [source documentation](https://github.com/ian-nason/fars-database) for precise scope, source conflicts, missing codes, update instructions and queries; [DICTIONARY.md](DICTIONARY.md) documents every data column and manual PDF page.
34
 
35
- ## Provenance, validation and permission
36
 
37
- The original 32,672,161-byte ZIP SHA-256 is `5112727a8c0dc91ffee27ca05bddb073934f2d192ce4fae997da767dccdbe04f`. [sources-2024.json](sources-2024.json) records an immutable historical pre-publication evidence snapshot. Every raw typed cell was checked against original CSV/Decimal reads before checkpoint and after read-only reopening; full selected code/label tuples were independently rebuilt. Schemas, metadata, missingness, keys, relationships, all analytic NULL mappings, per-crash count/fatality reconciliation, six examples and 44 fixtures pass. Rebuilds match logical fingerprints and dictionary bytes, not necessarily physical database bytes.
 
38
 
39
- Installed Python/R readers passed localhost HTTP range checks. This evidence does not establish public-host verification; consult the source audit records for later hosting checks and the exact independent review scope. Supplied-evidence review is distinct from independent execution.
40
 
41
- Source credit: **National Highway Traffic Safety Administration, National Center for Statistics and Analysis, Fatality Analysis Reporting System, 2024 national Annual Report File**, April 1, 2026 release. The official [Ownership policy](https://www.nhtsa.gov/about-nhtsa/privacy-policy) permits copying/distribution of website information. No third-party compilation license is borrowed or NHTSA endorsement/trademark permission implied. Cite the release, acquisition date and derivative checksum. This derivative types CSV fields, lowercases names, handles numeric blanks, adds observed labels/metadata and safe views, and preserves source values/codes.
 
 
 
3
  license_name: nhtsa-public-information
4
  license_link: https://www.nhtsa.gov/about-nhtsa/privacy-policy
5
  pretty_name: FARS 2024 National Annual Report File
6
+ tags:
7
+ - fars
8
+ - nhtsa
9
+ - traffic-safety
10
+ - fatal-crashes
11
+ - transportation
12
+ - duckdb
13
+ size_categories:
14
+ - 100K<n<1M
15
  ---
16
 
17
+ # FARS 2024 National Annual Report File
18
 
19
+ A pinned DuckDB edition of NHTSA's [Fatality Analysis Reporting System](https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars), 2024 national Annual Report File: **190,798 rows across 4 tables (413 columns)**, three convenience views, metadata and a dictionary tied to manual pages. The three source tables hold **36,297 fatal crashes, 56,011 vehicles in transport and 88,326 people**; the accident and person tables reconcile to **39,254 fatalities**.
20
 
21
+ This is the **first 2024 ARF, released April 1, 2026**, not the later final file. Coverage is the 50 states and the District of Columbia; Puerto Rico is a separate archive and is not included.
22
+
23
+ Built with [fars-database](https://github.com/ian-nason/fars-database). Published to Hugging Face on 2026-10-18. The datapond registry entry is a draft pull request, so `datapond.connect('fars')` does not resolve this database until it is merged; the direct URL below works now.
24
+
25
+ [Quick start](#quick-start) · [Tables](#tables) · [Views](#pre-built-views) · [Examples](#example-queries) · [Caveats](#researcher-caveats) · [Source](#data-source-and-version) · [License](#license-and-attribution) · [Changelog](#changelog)
26
+
27
+ ## Quick Start
28
+
29
+ ### DuckDB CLI
30
 
31
  ```sql
32
+ SET memory_limit = '128MiB';
33
+ SET threads = 1;
34
+ SET max_temp_directory_size = '0B';
35
+ INSTALL httpfs;
36
  LOAD httpfs;
37
+ ATTACH 'https://huggingface.co/datasets/Nason/fars-database/resolve/adb6da02a314c39d8b6caf776529bf4a373075da/fars.duckdb' AS fars (READ_ONLY);
38
+
39
+ -- Fatal crashes and fatalities by state; the crashes view never multiplies rows
40
+ SELECT state, statename, count(*) AS fatal_crashes,
41
+ sum(fatals) AS fatalities, sum(nonoccupant_fatalities) AS nonoccupant_fatalities
42
+ FROM fars.crashes
43
+ GROUP BY state, statename
44
+ ORDER BY fatalities DESC, state LIMIT 15;
45
+ ```
46
+
47
+ The database is 26 MB. DuckDB fetches byte ranges as needed; transfer volume depends on the query. The examples use this immutable artifact URL:
48
+
49
+ ```
50
+ https://huggingface.co/datasets/Nason/fars-database/resolve/adb6da02a314c39d8b6caf776529bf4a373075da/fars.duckdb
51
+ ```
52
+
53
+ ### Python (duckdb)
54
+
55
+ ```python
56
+ import duckdb
57
+ con = duckdb.connect(config={"memory_limit": "128MiB", "threads": "1", "max_temp_directory_size": "0B"})
58
+ con.sql("INSTALL httpfs; LOAD httpfs;")
59
+ con.sql("ATTACH 'https://huggingface.co/datasets/Nason/fars-database/resolve/adb6da02a314c39d8b6caf776529bf4a373075da/fars.duckdb' AS fars (READ_ONLY)")
60
+ con.sql("SELECT * FROM fars._metadata").show()
61
+ con.sql("SELECT count(*) AS fatal_crashes, sum(fatals) AS fatalities FROM fars.crashes").show()
62
+ con.close()
63
+ ```
64
+
65
+ ### R (DBI + duckdb)
66
+
67
+ ```r
68
+ library(DBI)
69
+ con <- dbConnect(duckdb::duckdb(config = list(memory_limit = "128MiB", threads = "1", max_temp_directory_size = "0B")))
70
+ dbExecute(con, "INSTALL httpfs")
71
+ dbExecute(con, "LOAD httpfs")
72
+ dbExecute(con, "ATTACH 'https://huggingface.co/datasets/Nason/fars-database/resolve/adb6da02a314c39d8b6caf776529bf4a373075da/fars.duckdb' AS fars (READ_ONLY)")
73
+ dbGetQuery(con, "SELECT month, monthname, count(*) AS fatal_crashes, sum(fatals) AS fatalities
74
+ FROM fars.crashes GROUP BY month, monthname ORDER BY month")
75
+ dbDisconnect(con, shutdown = TRUE)
76
+ ```
77
+
78
+ In the tested R DuckDB 1.5.5 configuration, BIGINT and DECIMAL results are exposed as doubles. Counts here are exact; coordinates and `measured_bac_g_dl` may be approximate in R although the stored DECIMAL values are exact.
79
+
80
+ ### datapond package (after catalog integration)
81
+
82
+ The public default catalog does not yet include `fars`. After its registry entry is merged, these examples use the package's normal discovery and connection API:
83
+
84
+ ```python
85
+ import datapond
86
+ print(datapond.list())
87
+ datapond.describe('fars', table='person')
88
+ con = datapond.connect('fars')
89
+ con.sql('SELECT count(*) AS fatal_crashes, sum(fatals) AS fatalities FROM crashes').show()
90
+ con.close()
91
+ ```
92
+
93
+ ```r
94
+ library(datapond)
95
+ dp_list()
96
+ con <- dp_connect('fars')
97
+ dp_describe(con, table = 'person')
98
+ DBI::dbGetQuery(con, "SELECT count(*) AS fatal_crashes, sum(fatals) AS fatalities FROM crashes")
99
+ dp_disconnect(con)
100
+ ```
101
+
102
+ For repeated scans, after catalog integration, download once and connect locally:
103
+
104
+ ```python
105
+ import datapond
106
+ datapond.download('fars')
107
+ con = datapond.connect('fars', local=True)
108
+ con.sql('SELECT count(*) AS fatal_crashes, sum(fatals) AS fatalities FROM crashes').show()
109
+ con.close()
110
  ```
111
 
112
+ ```r
113
+ library(datapond)
114
+ dp_download('fars')
115
+ con <- dp_connect('fars', local = TRUE)
116
+ DBI::dbGetQuery(con, "SELECT count(*) AS fatal_crashes, sum(fatals) AS fatalities FROM crashes")
117
+ dp_disconnect(con)
118
+ ```
119
+
120
+ Verify the recorded artifact SHA-256 after downloading. In tested Python 0.1.1, the optional Hugging Face download path follows the default branch rather than the pinned URL; see [consumer verification](https://github.com/ian-nason/fars-database/blob/main/docs/CONSUMERS.md) for the tested configuration.
121
+
122
+ Package checks use an isolated candidate registry; default-catalog discovery remains pending. See [consumer verification](https://github.com/ian-nason/fars-database/blob/main/docs/CONSUMERS.md) for exact client versions, paths, resource limits and download behavior. The direct URL examples above work independently of the catalog. The SQL examples below use the `fars` catalog alias from the direct-URL quick start.
123
+
124
+
125
+ ## Tables
126
+
127
+ | Table | Description | Rows | Columns |
128
+ |---|---|---:|---:|
129
+ | `person` | One record per involved person, including nonoccupants and occupants of vehicles not in transport | 88,326 | 126 |
130
+ | `vehicle` | One record per motor vehicle in transport; parked/working vehicles are in the omitted Parkwork file | 56,011 | 201 |
131
+ | `accident` | One record per fatal crash in the 2024 national Annual Report File | 36,297 | 80 |
132
+ | `code_labels` | Distinct observed code/label tuples for 30 selected fields; county/city scoped by state; four city codes have multiple source labels | 10,164 | 6 |
133
+
134
+ Keys: `accident (state, st_case)`; `vehicle (state, st_case, veh_no)`; `person (state, st_case, veh_no, per_no)`; all within this year. Every original column and paired `NAME` label is kept with lowercase names; codes are not recoded. Character fields such as `dr_zip`, VIN characters and `tway_id` stay strings; integer codes are BIGINT; coordinates are DECIMAL(18,12). `_metadata` and `_columns` carry provenance, definitions and manual page links.
135
+
136
+ ## Pre-built Views
137
+
138
+ | View | What it does |
139
+ |---|---|
140
+ | `crashes` | All `accident` columns plus per-crash counts aggregated before joining: `vehicle_records`, `in_transport_vehicle_fatalities`, `person_records`, `person_fatalities`, `in_transport_people`, `parked_working_vehicle_people`, `nonoccupant_people`, `nonoccupant_fatalities`, `parked_working_vehicle_fatalities`, and `latitude_degrees`/`longitude_degrees` with the unavailable codes (77.7777, 88.8888, 99.9999; 777.7777, 888.8888, 999.9999) set to NULL. Still 36,297 rows |
141
+ | `people` | All `person` columns plus `age_years` (0 to 120; 998/999 NULL), `measured_bac_g_dl` (`alc_res` 0 to 939 times 0.001), `bac_top_coded_at_094_or_more` (true for `alc_res`=940) and `fatal_injury_recorded` (true for 4; false for 0, 1, 2, 3, 6; NULL for 5 or 9) |
142
+ | `unambiguous_code_labels` | `code_labels` restricted to keys with exactly one source label; join on all five key columns |
143
+
144
+ Views are not counted in the row and table totals above.
145
+
146
+ ## Example Queries
147
+
148
+ Fatal injuries by recorded person role and age group; unknown age stays its own group:
149
+
150
+ ```sql
151
+ SELECT per_typ, per_typname,
152
+ CASE WHEN age_years IS NULL THEN 'Unknown/not reported'
153
+ WHEN age_years < 18 THEN '0-17'
154
+ WHEN age_years < 65 THEN '18-64' ELSE '65+' END AS age_group,
155
+ count(*) AS fatalities
156
+ FROM fars.people
157
+ WHERE inj_sev = 4
158
+ GROUP BY ALL ORDER BY per_typ, age_group;
159
+ ```
160
+
161
+ Alcohol test-result coverage among recorded drivers (test results, not imputed impairment):
162
+
163
+ ```sql
164
+ SELECT alc_status, alc_statusname, count(*) AS drivers,
165
+ count(measured_bac_g_dl) AS exact_numeric_test_results,
166
+ count(*) FILTER (WHERE bac_top_coded_at_094_or_more) AS top_coded_test_results
167
+ FROM fars.people
168
+ WHERE per_typ = 1
169
+ GROUP BY alc_status, alc_statusname ORDER BY alc_status;
170
+ ```
171
+
172
+ Coordinate availability for mapping (170 crashes lack usable coordinates):
173
+
174
+ ```sql
175
+ SELECT count(*) AS fatal_crashes,
176
+ count(*) FILTER (WHERE latitude_degrees IS NOT NULL AND longitude_degrees IS NOT NULL) AS coordinates_available,
177
+ count(*) FILTER (WHERE latitude_degrees IS NULL OR longitude_degrees IS NULL) AS coordinates_missing
178
+ FROM fars.crashes;
179
+ ```
180
+
181
+ The full set is in [examples.sql](https://github.com/ian-nason/fars-database/blob/main/examples.sql); saved results are bound to the artifact hash.
182
+
183
+ ## Researcher Caveats
184
+
185
+ 1. **Fatal crashes only, no denominator.** FARS records crashes on public trafficways with a death within 30 days. Counts are not risk rates; there is no population, vehicle-miles or trip denominator here. Uninjured occupants may be incompletely recorded.
186
+ 2. **Join people carefully.** An inner `person` to `vehicle` join drops the 9,020 nonoccupants (`veh_no=0`) and the 426 occupants of parked or working vehicles (`per_typ=3`), whose vehicles live in the omitted Parkwork file. Transport occupants (`per_typ` 1, 2, 9) always match a `vehicle` row. Joining `vehicle` and `person` directly by crash multiplies rows; use `crashes`.
187
+ 3. **Missing codes are field-specific.** Unknown and not-applicable values stay as source codes (998/999 age, 995 to 999 `alc_res`, coordinate codes above). Do not blanket-convert 9, 99, 999 or 0 to NULL. Only the 9,020 nonoccupant rows have numeric vehicle attributes as NULL; blank text stays empty.
188
+ 4. **BAC 940 is a top code.** `alc_res`=940 means 0.94 g/dL or greater, not 0.940; the `people` view keeps it separate. `alc_res` 995 to 999 are nonmeasurement categories and never zero. Police-reported `drinking` and measured tests are different variables, and missing tests are not random.
189
+ 5. **Imputed alcohol estimates are not here.** The three multiple-imputation files (`MIACC`, `MIDRVACC`, `MIPER`) are not loaded; this release cannot reproduce NHTSA's imputed impairment estimates. Per the [alcohol README](https://static.nhtsa.gov/nhtsa/downloads/FARS/README-BAC.pdf), such analyses compute an estimate in each of ten imputations and combine them.
190
+ 6. **Labels can conflict.** Four city codes carry more than one official label (state 4 code 428; 13/2190; 36/4170; 42/3950). `unambiguous_code_labels` omits them; never join `code_labels` on code alone. `mak_mod` is the combined make/model code; raw `model` is only meaningful with `make`.
191
+ 7. **Vintage and identity.** `st_case` identifies a crash within one year only; include year when pooling releases. The first ARF may be replaced by a final file with added or revised cases.
192
+ 8. **Scope of this MVP.** Only `accident`, `vehicle` and `person` are loaded. Parkwork, multiple-response factors, drug/race, vPIC decode and auxiliary files are omitted; their archived identities are pinned in the source lock.
193
+
194
+ ## Data Source and Version
195
+
196
+ National Highway Traffic Safety Administration, National Center for Statistics and Analysis, Fatality Analysis Reporting System, 2024 national Annual Report File, first release April 1, 2026, acquired October 18, 2026. Pinned source ZIP: 32,672,161 bytes, SHA-256 `5112727a8c0dc91ffee27ca05bddb073934f2d192ce4fae997da767dccdbe04f`. Definitions reference the [Analytical User's Manual](https://crashstats.nhtsa.dot.gov/Api/Public/ViewPublication/813794) (DOT HS 813 794, SHA-256 `210bc33d…04cc574`). No automatic refresh is promised.
197
+
198
+ Artifact: `fars.duckdb`, 26,488,832 bytes, SHA-256 `2bc31f9e9fdd973ddf728cc4e1e0811a7bacf9450dd80c7671c36fa6a1fc7442`, dataset commit `adb6da02a314c39d8b6caf776529bf4a373075da`.
199
+
200
+ ## License and Attribution
201
 
202
+ Redistribution rests on NHTSA's own [Ownership policy](https://www.nhtsa.gov/about-nhtsa/privacy-policy), which states that information on its website is public information and may be distributed or copied. This is the primary-source permission; no third-party Creative Commons compilation license is borrowed, and no NHTSA endorsement or trademark right is implied. Changes: CSV-to-DuckDB typing, lowercase names, numeric blank-to-NULL on nonoccupant rows, observed label dictionary, metadata and views; original codes and labels are retained. Cite the release vintage, acquisition date and artifact checksum.
203
 
204
+ ## GitHub, Dictionary and Website
205
 
206
+ [Detailed researcher guide](https://github.com/ian-nason/fars-database/blob/main/docs/RESEARCHER-GUIDE.md) · [Build and update instructions](https://github.com/ian-nason/fars-database/blob/main/docs/REPRODUCE.md) · [Verified publication](https://github.com/ian-nason/fars-database/blob/main/PUBLICATION.md)
207
 
208
+ - Source, build scripts, tests and evidence: [github.com/ian-nason/fars-database](https://github.com/ian-nason/fars-database)
209
+ - Column dictionary (all 413 columns with original headers, definitions and manual PDF pages): [DICTIONARY.md](https://github.com/ian-nason/fars-database/blob/main/DICTIONARY.md)
210
+ - Catalog: [datapond registry](https://github.com/datapond-db/registry); the entry for `fars` is a draft pull request and the database will appear on the [datapond website](https://datapond-db.github.io/website/) once it is merged.
211
 
212
+ ## Changelog
213
 
214
+ ### 2026-10-18 — Documentation refresh
215
 
216
+ - Added Python/R quick starts, table descriptions and column counts, view guidance, navigation, and clearer researcher caveats.
217
+ - Database bytes, schema, source locks and validated query results are unchanged. Catalog integration remains pending.
218
 
219
+ ### 2026-10-18 — Initial release
220
 
221
+ - FARS 2024 ARF (first release): 190,798 rows across 4 tables (413 columns) and 3 views; 36,297 crashes, 39,254 fatalities. Artifact 26,488,832 bytes, SHA-256 `2bc31f9e…fc7442`, commit `adb6da02`.
222
+ - Every typed cell verified against an independent read of the pinned source ZIP; per-crash count and fatality reconciliation; public immutable URL, HTTP range requests and the installed Python and R clients tested after upload.
223
+ - Registry entry opened as a draft pull request; catalog integration pending.