Nason commited on
Commit
6147752
·
verified ·
1 Parent(s): 301dc3e

Publish reviewed dataset guide, preserving later R examples

Browse files
Files changed (1) hide show
  1. README.md +182 -115
README.md CHANGED
@@ -1,115 +1,182 @@
1
- ---
2
- license: cc0-1.0
3
- pretty_name: ICE facility, office and jurisdiction references
4
- ---
5
-
6
- # ICE facility, office and jurisdiction references
7
-
8
- Frozen Datapond snapshot: 4 data tables, 4,410 stored source rows,
9
- 26,226,688 bytes. The catalog identifier requires separate registry integration.
10
- Row totals mix table units and are not unique people, events or places.
11
-
12
- | Table | Rows | Unit | Time semantics |
13
- |---|---:|---|---|
14
- | `facilities` | 878 | One detention-facility directory record; not a detention event or historical facility panel | reference snapshot, not historical panel |
15
- | `offices` | 275 | One office directory record across ERO, HSI and other listed agencies; not an ERO-only jurisdiction | reference snapshot, not historical panel |
16
- | `aor` | 26 | One ERO area-of-responsibility record; 25 geographic areas plus one nongeographic HQ placeholder | reference snapshot, not historical panel |
17
- | `county_aor` | 3,231 | One county-to-ERO-area assignment record; 3,230 county records plus one nongeographic HQ placeholder | reference snapshot, not historical panel |
18
-
19
- ## Source, scope and limitations
20
-
21
- Facility scope starts with locations used since January 2025 plus newly listed sites; it is not a complete historical directory. Source observation vintages vary. The facility repository commit is October 20, 2026, and the office repository commit is April 21, 2026. Neither is a universal observation date.
22
-
23
- The facility table preserves one NULL detention_facility_code and 75 missing coordinate pairs. Use _source_row as a pinned-file row reference, not a cross-release entity key. Preserve leading zeros in ZIP/FIPS/GEOID. Office fields are office_type, latitude and longitude; six obsolete population-summary fields from older facility documentation are absent from this payload.
24
-
25
- AOR and county-AOR geometry is retained as WKB with NAD83 EPSG:4269 metadata, despite older codebook prose naming EPSG:4326. No coordinates are transformed or relabelled. Each geography table retains its nongeographic HQ placeholder; exclude it explicitly when analyzing geographic coverage. Do not silently drop source rows merely because a county or office name is NULL.
26
-
27
- The office directory includes ERO, HSI and other agencies. Its AOR geography tables describe ERO responsibility only, not HSI territories or a historical boundary panel. The source office lists are described as September 2025 and county geometry derives from Census 2024 boundaries. Harlingen's FY2022 split and other source boundary caveats matter for time-specific joins. Facility codes need release/year coverage checks before LEFT JOINs to detention events. Office-name variants require an explicit reviewed crosswalk; no fuzzy link or legal-venue inference is supplied.
28
-
29
- Every source byte hash, immutable URL and repository commit is in
30
- [source-lock.json](source-lock.json). Every row is retained; `_source_row` is added
31
- as an ordinal within the pinned member. Geometry, when present, is stored as WKB
32
- in `geometry_wkb`, with all original metadata in `_geometry_metadata`. `_provenance`,
33
- `_metadata` and `_columns` document the build. [DICTIONARY.md](DICTIONARY.md) records
34
- types, exact NULL counts, units and time semantics. Original source flags and text
35
- are not coerced into new numeric categories.
36
-
37
- Publisher: [Deportation Data Project](https://deportationdata.org/data/processed/ice.html).
38
- Data license: CC0-1.0, as labelled by the publisher; see the retained license notes.
39
- Cite government data collated by the Deportation Data Project and the pinned source
40
- commit. Repository commit dates do not promise current observations or automatic refreshes.
41
-
42
- ## Local queries
43
-
44
- ```python
45
- import duckdb
46
- con = duckdb.connect('ice-reference.duckdb', read_only=True,
47
- config={'memory_limit':'128MiB','threads':'1'})
48
- try:
49
- print(con.sql('SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5').fetchall())
50
- finally:
51
- con.close()
52
- ```
53
-
54
- ```r
55
- library(DBI)
56
- con <- dbConnect(duckdb::duckdb(), dbdir='ice-reference.duckdb', read_only=TRUE)
57
- tryCatch({
58
- dbExecute(con, "SET memory_limit='128MiB'")
59
- dbExecute(con, 'SET threads=1')
60
- print(dbGetQuery(con, "SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5"))
61
- }, finally=dbDisconnect(con, shutdown=TRUE))
62
- ```
63
-
64
- Public datapond identifier `ice-reference` requires a future approved catalog release.
65
- The smoke scripts use an isolated localhost registry, never a global registry edit.
66
-
67
- ## Reproduce and refresh
68
-
69
- Use Python 3.11 or newer in a dedicated environment. Install the exact tested dependencies with `python -m pip install -r requirements.txt` (or use the pinned uv source in pyproject.toml), then:
70
-
71
- ```sh
72
- python acquire_sources.py
73
- python build_database.py --validate-only --report fresh-validation.json
74
- python build_database.py --output fresh-ice-reference.duckdb
75
- ```
76
-
77
- Downloads are pinned, bounded and SHA-verified; existing source files are checked
78
- and reused. The importer preserves all source fields and compares every stored
79
- row with the input using symmetric EXCEPT ALL. It uses one thread, 128 MiB DuckDB
80
- memory, no spill, a 128 MiB working-file cap
81
- and a 512 MiB physical free-space reserve. A watchdog interrupts work when a budget
82
- is crossed. Builds are private until complete; hard-link publication refuses an
83
- existing final database, manifest or orphan WAL path. Synchronous checks enforce the working-file cap and physical reserve after close and before publication; hash checks remain enabled under optimized Python. Failed/private files remain for inspection, with no cleanup
84
- of unrelated work. Peak process memory can exceed DuckDB's buffer limit.
85
-
86
- To refresh, review the publisher's changed files and definitions, update pins and
87
- expected schemas/counts, run full source checks and Python/R smoke tests, and audit
88
- both data and documentation. No scheduled or unattended refresh is configured.
89
-
90
- Source documentation: [facilities](https://deportationdata.org/docs/ice/codebook-facilities.html) and [offices/AORs](https://deportationdata.org/docs/ice/codebook-offices.html). Actual pinned schemas and CRS override the older codebook discrepancies described above. Office names alone are not unique; the current `(agency, office_type, office_name, address_full)` combination is unique. Each geography table has one empty MULTIPOLYGON for HQ and no SQL-NULL geometry.
91
-
92
- Validation commands: `python -m unittest -v test_safety.py` and `python run_smoke.py --python /path/to/python --rscript /path/to/Rscript --r-library /path/to/R/library`. The latter needs the released Python and R datapond packages and an already installed HTTPFS extension. It uses only localhost and this database. See VALIDATION.md for the executed versions and results.
93
-
94
- ## Snapshot files
95
-
96
- [Download the database](https://huggingface.co/datasets/Nason/ice-reference-database/resolve/main/ice-reference.duckdb), [browse its files](https://huggingface.co/datasets/Nason/ice-reference-database/tree/main), or inspect the [reproducible source](https://github.com/ian-nason/ice-reference-database). Verify the snapshot SHA-256 `c0c6f79bea8ad54e84c29103a7d854b68a381d931e104e2a3ccc03c1c80d70a5` (26,226,688 bytes). The registry PR pins immutable Hugging Face revisions; a later `main` may refer to a newer snapshot.
97
-
98
- Once the separate catalog entry is merged, use the released clients:
99
-
100
- ```python
101
- import datapond
102
- con = datapond.connect("ice-reference")
103
- try:
104
- print(con.sql("SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5").fetchall())
105
- finally:
106
- con.close()
107
- ```
108
-
109
- ```r
110
- library(datapond)
111
- con <- dp_connect("ice-reference")
112
- tryCatch(print(DBI::dbGetQuery(con, "SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5")), finally=DBI::dbDisconnect(con, shutdown=TRUE))
113
- ```
114
-
115
- Until catalog integration, the local Python/R examples above work with the downloaded snapshot. The smoke scripts exercise both released clients with an isolated registry and this same database.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc0-1.0
3
+ pretty_name: ICE facility, office and jurisdiction references
4
+ ---
5
+
6
+ # ICE facility, office and jurisdiction references
7
+
8
+ Directories of detention facilities and immigration-enforcement offices, plus ERO areas of responsibility (AORs) and county assignments, assembled by the Deportation Data Project. Use them to locate listed facilities and offices or attach documented ERO jurisdictions to county data. The four tables contain 878 facility records, 275 office records, 26 AOR records and 3,231 county assignments. They combine source vintages and are not a historical panel; the geography tables include a nongeographic headquarters placeholder.
9
+
10
+ ## Start querying
11
+
12
+ Count facility directory records by state. These are directory records, not people detained or a historical facility panel.
13
+
14
+ Choose R or Python. Install datapond once: use `install.packages("datapond")` in R, or run `python -m pip install datapond` in a terminal.
15
+
16
+ ### R
17
+
18
+ ```r
19
+ library(datapond)
20
+ con <- dp_connect("ice-reference")
21
+ tryCatch({
22
+ DBI::dbExecute(con, "SET threads=1")
23
+ DBI::dbExecute(con, "SET memory_limit='128MiB'")
24
+ DBI::dbExecute(con, "SET max_temp_directory_size='0B'")
25
+ print(DBI::dbGetQuery(con, "SELECT state,count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC,state LIMIT 5"))
26
+ }, finally = dp_disconnect(con))
27
+ ```
28
+
29
+ ### Python
30
+
31
+ ```python
32
+ import datapond
33
+ con = datapond.connect('ice-reference')
34
+ try:
35
+ con.execute("SET threads=1")
36
+ con.execute("SET memory_limit='128MiB'")
37
+ con.execute("SET max_temp_directory_size='0B'")
38
+ print(con.execute("""SELECT state,count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC,state LIMIT 5""").fetchall())
39
+ finally:
40
+ con.close()
41
+ ```
42
+
43
+ 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.
44
+
45
+ <a id="coverage-fields-and-sources"></a>
46
+ <a id="additional-dataset-notes"></a>
47
+
48
+ ## Tables, fields and joins
49
+
50
+ Frozen Datapond snapshot: 4 data tables, 4,410 stored source rows.
51
+ The dataset identifier is available in the live Datapond catalog.
52
+ Row totals mix table units and are not unique people, events or places.
53
+
54
+ | Table | Rows | Unit | What the dates mean |
55
+ |---|---:|---|---|
56
+ | `facilities` | 878 | One detention-facility directory record; not a detention event or historical facility panel | reference snapshot, not historical panel |
57
+ | `offices` | 275 | One office directory record across ERO, HSI and other listed agencies; not an ERO-only jurisdiction | reference snapshot, not historical panel |
58
+ | `aor` | 26 | One ERO area-of-responsibility record; 25 geographic areas plus one nongeographic HQ placeholder | reference snapshot, not historical panel |
59
+ | `county_aor` | 3,231 | One county-to-ERO-area assignment record; 3,230 county records plus one nongeographic HQ placeholder | reference snapshot, not historical panel |
60
+
61
+ See the [data dictionary](https://huggingface.co/datasets/Nason/ice-reference-database/resolve/301dc3e65fb5115afaf633121fe8ea56cddf56e4/DICTIONARY.md) for column definitions.
62
+
63
+ The facility table preserves one NULL detention_facility_code and 75 missing coordinate pairs. Use _source_row as a pinned-file row reference, not a cross-release entity key. Preserve leading zeros in ZIP/FIPS/GEOID. Office fields are office_type, latitude and longitude; six obsolete population-summary fields from older facility documentation are absent from this payload.
64
+
65
+ Office names alone are not unique; the current `(agency, office_type, office_name, address_full)` combination is unique. Each geography table has one empty MULTIPOLYGON for HQ and no SQL-NULL geometry.
66
+
67
+ `aor` means area of responsibility. The office directory includes multiple agency labels (ERO, HSI and others); only the AOR and county-AOR tables describe ERO jurisdictions.
68
+
69
+ [DICTIONARY.md](DICTIONARY.md) records types, exact NULL counts, units and what the dates mean.
70
+
71
+ Original source flags and text are not coerced into new numeric categories.
72
+
73
+ <a id="source-scope-and-limitations"></a>
74
+
75
+ ## Scope and interpretation
76
+
77
+ Facility scope starts with locations used since January 2025 plus newly listed sites; it is not a complete historical directory. Source observation vintages vary. The facility repository commit is October 20, 2026, and the office repository commit is April 21, 2026. Neither is a universal observation date.
78
+
79
+ AOR and county-AOR geometry is retained as WKB with NAD83 EPSG:4269 metadata, despite older codebook prose naming EPSG:4326. No coordinates are transformed or relabelled. Each geography table retains its nongeographic HQ placeholder; exclude it explicitly when analyzing geographic coverage. Do not silently drop source rows merely because a county or office name is NULL.
80
+
81
+ The office directory includes ERO, HSI and other agencies. Its AOR geography tables describe ERO responsibility only, not HSI territories or a historical boundary panel. The source office lists are described as September 2025 and county geometry derives from Census 2024 boundaries. Harlingen's FY2022 split and other source boundary caveats matter for time-specific joins. Facility codes need release/year coverage checks before LEFT JOINs to detention events. Office-name variants require an explicit reviewed crosswalk; no fuzzy link or legal-venue inference is supplied.
82
+
83
+ <a id="advanced-access-local-queries"></a>
84
+ <a id="snapshot-files"></a>
85
+
86
+ ## Other ways to connect
87
+
88
+ [Download the database](https://huggingface.co/datasets/Nason/ice-reference-database/resolve/main/ice-reference.duckdb), [browse its files](https://huggingface.co/datasets/Nason/ice-reference-database/tree/main), or inspect the [reproducible source](https://github.com/ian-nason/ice-reference-database).
89
+
90
+ The first-use examples above use the live catalog. Local examples work with the downloaded snapshot.
91
+
92
+ ### Local DuckDB queries
93
+
94
+ ```python
95
+ import duckdb
96
+ con = duckdb.connect('ice-reference.duckdb', read_only=True,
97
+ config={'memory_limit':'128MiB','threads':'1'})
98
+ try:
99
+ print(con.sql('SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5').fetchall())
100
+ finally:
101
+ con.close()
102
+ ```
103
+
104
+ ```r
105
+ library(DBI)
106
+ con <- dbConnect(duckdb::duckdb(), dbdir='ice-reference.duckdb', read_only=TRUE)
107
+ tryCatch({
108
+ dbExecute(con, "SET memory_limit='128MiB'")
109
+ dbExecute(con, 'SET threads=1')
110
+ print(dbGetQuery(con, "SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5"))
111
+ }, finally=dbDisconnect(con, shutdown=TRUE))
112
+ ```
113
+
114
+ ### Additional catalog connection examples
115
+
116
+ The first query above is the recommended package start. These retained alternatives run the same question through the live catalog.
117
+
118
+ ```python
119
+ import datapond
120
+ con = datapond.connect("ice-reference")
121
+ try:
122
+ print(con.sql("SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5").fetchall())
123
+ finally:
124
+ con.close()
125
+ ```
126
+
127
+ ```r
128
+ library(datapond)
129
+ con <- dp_connect("ice-reference")
130
+ tryCatch(print(DBI::dbGetQuery(con, "SELECT state, count(*) AS facilities FROM facilities GROUP BY state ORDER BY facilities DESC, state LIMIT 5")), finally=DBI::dbDisconnect(con, shutdown=TRUE))
131
+ ```
132
+
133
+ ## Sources and maintenance
134
+
135
+ ### Sources, license and provenance
136
+
137
+ Source: [Deportation Data Project (public records and FOIA)](https://deportationdata.org/data/processed/ice.html). License: CC0-1.0 data.
138
+
139
+ Every source byte hash, immutable URL and repository commit is in
140
+ [source-lock.json](source-lock.json). Every row is retained; `_source_row` is added
141
+ as an ordinal within the pinned member. Geometry, when present, is stored as WKB
142
+ in `geometry_wkb`, with all original metadata in `_geometry_metadata`. `_provenance`,
143
+ `_metadata` and `_columns` document the build.
144
+
145
+ Publisher: [Deportation Data Project](https://deportationdata.org/data/processed/ice.html).
146
+ Data license: CC0-1.0, as labelled by the publisher; see the retained license notes.
147
+ Cite government data collated by the Deportation Data Project and the pinned source
148
+ commit. Repository commit dates do not promise current observations or automatic refreshes.
149
+
150
+ Source documentation: [facilities](https://deportationdata.org/docs/ice/codebook-facilities.html) and [offices/AORs](https://deportationdata.org/docs/ice/codebook-offices.html). Actual pinned schemas and CRS override the older codebook discrepancies described above.
151
+
152
+ Snapshot SHA-256 `c0c6f79bea8ad54e84c29103a7d854b68a381d931e104e2a3ccc03c1c80d70a5` (26,226,688 bytes). The registry PR pins immutable Hugging Face revisions; a later `main` may refer to a newer snapshot.
153
+
154
+ ### Reproduce and refresh
155
+
156
+ Use Python 3.11 or newer in a dedicated environment. Install the exact tested dependencies with `python -m pip install -r requirements.txt` (or use the pinned uv source in pyproject.toml), then:
157
+
158
+ ```sh
159
+ python acquire_sources.py
160
+ python build_database.py --validate-only --report fresh-validation.json
161
+ python build_database.py --output fresh-ice-reference.duckdb
162
+ ```
163
+
164
+ Downloads are pinned, bounded and SHA-verified; existing source files are checked
165
+ and reused. The importer preserves all source fields and compares every stored
166
+ row with the input using symmetric EXCEPT ALL. It uses one thread, 128 MiB DuckDB
167
+ memory, no spill, a 128 MiB working-file cap
168
+ and a 512 MiB physical free-space reserve. A watchdog interrupts work when a budget
169
+ is crossed. Builds are private until complete; hard-link publication refuses an
170
+ existing final database, manifest or orphan WAL path. Synchronous checks enforce the working-file cap and physical reserve after close and before publication; hash checks remain enabled under optimized Python. Failed/private files remain for inspection, with no cleanup
171
+ of unrelated work. Peak process memory can exceed DuckDB's buffer limit.
172
+
173
+ To refresh, review the publisher's changed files and definitions, update pins and
174
+ expected schemas/counts, run full source checks and Python/R smoke tests, and audit
175
+ both data and documentation. No scheduled or unattended refresh is configured.
176
+
177
+ Validation commands: `python -m unittest -v test_safety.py` and `python run_smoke.py --python /path/to/python --rscript /path/to/Rscript --r-library /path/to/R/library`. The latter needs the released Python and R datapond packages and an already installed HTTPFS extension. It uses only localhost and this database. See VALIDATION.md for the executed versions and results.
178
+
179
+ Public Datapond identifier `ice-reference` is available in the live catalog.
180
+ The smoke scripts use an isolated localhost registry, never a global registry edit.
181
+
182
+ The retained build smoke scripts use an isolated registry with the same database.