Nason commited on
Commit
c91fe33
·
verified ·
1 Parent(s): 0dbb991

Publish reviewed dataset guide, preserving later R examples

Browse files
Files changed (1) hide show
  1. README.md +80 -12
README.md CHANGED
@@ -18,27 +18,83 @@ size_categories:
18
 
19
  # CBP Border Enforcement Database
20
 
21
- Individual-level Customs and Border Protection records obtained by the Deportation
22
- Data Project through FOIA litigation: Border Patrol apprehensions (FY2008-Dec 2025),
23
- apprehensions with place of birth (FY2000-FY2022), encounters, Office of Field
24
- Operations inadmissibility events at ports of entry (CY2014-Jan 2026), Title 42
25
- expulsions and CBP One appointments. 121 release files harmonised into one schema
26
- per record type; overlapping release windows resolved into a non-overlapping base
27
- tiling (see `_files`).
28
- **51,345,742 rows across 8 tables.**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  | Table | Description | Row Count | Column Count |
31
  |---|---|---|---|
32
- | `apprehensions_origin` | Border Patrol apprehensions with place of birth (country/state/city), one row per apprehension, FY2000 - FY2022 | 16,719,589 | 16 |
33
- | `inadmissibles` | Office of Field Operations events where a person arriving at a port of entry was deemed inadmissible, one row per event, CY2014 - Jan 2026 | 11,591,432 | 35 |
34
  | `apprehensions` | Border Patrol apprehensions between ports of entry, one row per person apprehended (FOIA releases covering Oct 2007 - Dec 2025; monthly gaps where CBP has not yet released data) | 7,907,911 | 74 |
 
35
  | `encounters` | Border Patrol encounters (apprehensions with prior-encounter history and seizure fields), FY2010 - FY2018 and Oct 2022 - Sep 2024 | 7,164,459 | 38 |
36
- | `inadmissibles_superseded` | Rows from inadmissibles release files whose windows overlap the base tiling (see _files.superseded_reason); same schema as inadmissibles | 5,634,463 | 41 |
37
  | `title42_expulsions` | Title 42 expulsions by Border Patrol, one row per expulsion, FY2020 - FY2022 | 1,976,471 | 24 |
38
  | `cbp_one` | CBP One app appointments at ports of entry, individual-level extract, Jan 12 - Oct 31 2023 | 323,686 | 19 |
39
  | `cbp_one_monthly` | CBP One monthly appointment counts by port of entry and citizenship (five overlapping FOIA extracts; see source_file) | 27,731 | 19 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- ## Query it remotely
 
 
 
 
42
 
43
  ```sql
44
  INSTALL httpfs; LOAD httpfs;
@@ -49,6 +105,18 @@ FROM cbp.apprehensions WHERE event_datetime >= '2023-01-01'
49
  GROUP BY 1, 2 ORDER BY 3 DESC LIMIT 20;
50
  ```
51
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  ### R with DBI and duckdb
53
 
54
  Install the dependencies once with `install.packages(c("DBI", "duckdb"))`.
 
18
 
19
  # CBP Border Enforcement Database
20
 
21
+ U.S. Customs and Border Protection (CBP) enforcement records released through the Deportation Data Project (DDP) under the Freedom of Information Act (FOIA). They include Border Patrol apprehensions and encounters, Office of Field Operations (OFO) inadmissibility events at ports of entry, Title 42 expulsions and CBP One appointments. An inadmissibility event records a person arriving at a port of entry who was deemed inadmissible. Use the table guide to select a record type and its actual coverage before querying. The eight tables contain about 51.3 million stored rows across overlapping and superseded series, not that many distinct people or events. Some periods have substantial gaps, and no stable cross-release person linkage is supplied. Do not add overlapping series or treat missing months as zero activity.
22
+
23
+ <a id="quick-start"></a>
24
+
25
+ ## Start querying
26
+
27
+ Preview up to five apprehension records dated 2023 onward, showing the event timestamp (`event_datetime`) and recorded citizenship. These released records have coverage gaps and are not a complete count for the period.
28
+
29
+ Choose R or Python. Install the datapond package once: use `install.packages("datapond")` in R, or run `python -m pip install datapond` in a terminal.
30
+
31
+ ### R
32
+
33
+ ```r
34
+ library(datapond)
35
+ con <- dp_connect("cbp")
36
+ tryCatch({
37
+ DBI::dbExecute(con, "SET threads=1")
38
+ DBI::dbExecute(con, "SET memory_limit='128MiB'")
39
+ DBI::dbExecute(con, "SET max_temp_directory_size='0B'")
40
+ print(DBI::dbGetQuery(con, "SELECT event_datetime,citizenship FROM apprehensions WHERE event_datetime>=TIMESTAMP '2023-01-01' LIMIT 5"))
41
+ }, finally = dp_disconnect(con))
42
+ ```
43
+
44
+ ### Python
45
+
46
+ ```python
47
+ import datapond
48
+ con = datapond.connect('cbp')
49
+ try:
50
+ con.execute("SET threads=1")
51
+ con.execute("SET memory_limit='128MiB'")
52
+ con.execute("SET max_temp_directory_size='0B'")
53
+ print(con.execute("""SELECT event_datetime,citizenship FROM apprehensions WHERE event_datetime>=TIMESTAMP '2023-01-01' LIMIT 5""").fetchall())
54
+ finally:
55
+ con.close()
56
+ ```
57
+
58
+ Queries run on your computer and read the byte ranges they need. A small result can still require a large scan. These examples limit DuckDB to one thread and a 128 MiB buffer pool with disk spill disabled; that is not a limit on the entire R or Python process. Larger analyses may need more memory or a local download with enough disk space.
59
+
60
+ <a id="additional-dataset-notes"></a>
61
+
62
+ <a id="coverage-fields-and-sources"></a>
63
+
64
+ ## Tables and coverage
65
+
66
+ **51,345,742 stored rows across eight tables**, including overlapping and superseded records. FY means fiscal year; CY means calendar year. Apprehension coverage starts in October 2007 (FY2008).
67
 
68
  | Table | Description | Row Count | Column Count |
69
  |---|---|---|---|
 
 
70
  | `apprehensions` | Border Patrol apprehensions between ports of entry, one row per person apprehended (FOIA releases covering Oct 2007 - Dec 2025; monthly gaps where CBP has not yet released data) | 7,907,911 | 74 |
71
+ | `apprehensions_origin` | Border Patrol apprehensions with place of birth (country/state/city), one row per apprehension, FY2000 - FY2022 | 16,719,589 | 16 |
72
  | `encounters` | Border Patrol encounters (apprehensions with prior-encounter history and seizure fields), FY2010 - FY2018 and Oct 2022 - Sep 2024 | 7,164,459 | 38 |
73
+ | `inadmissibles` | Office of Field Operations events where a person arriving at a port of entry was deemed inadmissible, one row per event, CY2014 - Jan 2026 | 11,591,432 | 35 |
74
  | `title42_expulsions` | Title 42 expulsions by Border Patrol, one row per expulsion, FY2020 - FY2022 | 1,976,471 | 24 |
75
  | `cbp_one` | CBP One app appointments at ports of entry, individual-level extract, Jan 12 - Oct 31 2023 | 323,686 | 19 |
76
  | `cbp_one_monthly` | CBP One monthly appointment counts by port of entry and citizenship (five overlapping FOIA extracts; see source_file) | 27,731 | 19 |
77
+ | `inadmissibles_superseded` | Older overlapping inadmissibility release records retained for reference, not additional events to add to inadmissibles (see _files.superseded_reason) | 5,634,463 | 41 |
78
+
79
+ See the [data dictionary](https://github.com/ian-nason/cbp-database/blob/main/DICTIONARY.md) for column definitions.
80
+
81
+ ## Coverage gaps and interpretation
82
+
83
+ The `apprehensions` series has gaps in April–September 2014, October 2022–March 2024, July–November 2024 and August 2025. Missing months are not zero activity. `apprehensions_origin` is a separate, overlapping series with birthplace information; do not add it to `apprehensions`.
84
+
85
+ The main `inadmissibles` table uses 19 selected files covering non-overlapping periods; 23 older overlapping releases are retained in `inadmissibles_superseded` for comparison, not additional event counts. Choose one `source_file` when using the five overlapping `cbp_one_monthly` extracts. No stable cross-release person linkage is supplied.
86
+
87
+ ### Source-tracking reference table
88
+
89
+ `_files` describes the 121 source files, coverage windows, source row counts and URLs, plus `in_base_table` and `superseded_reason`. Use it to see which releases were selected. Coverage windows come from the project’s file names/pages; individual event dates can extend slightly beyond them.
90
+
91
+ <a id="advanced-access-query-it-remotely"></a>
92
 
93
+ Redaction markers such as `(b)(6)` are stored as `NULL`. A field absent from a release is also `NULL`; check column availability before comparing periods. Event dates are stored as timestamps.
94
+
95
+ ## More example queries
96
+
97
+ Count released apprehension records by year and recorded citizenship from 2023 onward. This direct DuckDB example is an alternative to the package connection above; the coverage gaps still apply to the result.
98
 
99
  ```sql
100
  INSTALL httpfs; LOAD httpfs;
 
105
  GROUP BY 1, 2 ORDER BY 3 DESC LIMIT 20;
106
  ```
107
 
108
+ ## Sources and maintenance
109
+
110
+ ### Sources and build documentation
111
+
112
+ Source: [Deportation Data Project (CBP FOIA releases)](https://deportationdata.org/data/cbp.html). License: CC-0.
113
+
114
+ The Deportation Data Project obtained the individual-level records through FOIA litigation. The 121 release files are harmonized into one schema per record type, using selected files covering non-overlapping periods for the main tables.
115
+
116
+ Build pipeline, header crosswalk, release-selection decisions and caveats: https://github.com/ian-nason/cbp-database
117
+ Source: https://deportationdata.org/data/cbp.html (CC0).
118
+
119
+
120
  ### R with DBI and duckdb
121
 
122
  Install the dependencies once with `install.packages(c("DBI", "duckdb"))`.