A Python-based dashboard for ICE detention statistics. This project downloads and renders publically available detention data from the ICE Detention Management page.
This project consists of three Python scripts:
ice_detention_scraper.py- Downloads ICE detention Excel files and parses the facilities data, outputting a JSON filegeocode_facilities.py- Geocodes the facilities data using the JSON file from the previous steprender_facilties_map.py- Simple script that renders a single page static site
- Install using pip
pip install git+https://github.com/lockdown-systems/icewatch.git@mainDownload the latest detention statistics (this should auto-find the latest link):
icewatch scrapeThen, extract the data about facilities to a JSON file (you can also do this in one step, see options below):
icewatch scrape --extract-from-file data/YOUR_FILE_HERE.xlsxThe script supports the following options:
--url: Direct URL to the Excel file (optional, auto-finds by default)--output-dir: Directory to save the downloaded file (default: data)--verify: Verify the downloaded file by attempting to read it--no-auto-find: Disable auto-finding the latest link (use default URL instead)--extract-json: Extract facilities data to JSON file after downloading--extract-from-file: Extract facilities data to JSON from an existing Excel file
# Download to a custom directory
icewatch scrape --output-dir ./data
# Download and verify the file
icewatch scrape --verify
# Use a specific URL instead of auto-finding
icewatch scrape --url "https://custom-url.xlsx"
# Download to current directory
icewatch scrape --output-dir .
# Disable auto-find and use default URL
icewatch scrape --no-auto-find
# Download and extract facilities data to JSON
icewatch scrape --extract-json
# Extract JSON from an existing Excel file
icewatch scrape --extract-from-file "path/to/existing/file.xlsx"You can geocode the facilities in your JSON file using OpenStreetMap Nominatim API. This will add latitude and longitude to each facility and stores address lookups in a cache file to avoid unnecessary API requests. If the OpenStreetMap API doesn't provide a result for a specific facility, you can enter it in the cache file manually once you locate the latitude and longitude.
icewatch geocode --input data/ice_facilities_YYYYMMDD.json- By default, this will create a new file like
data/facilities_geocoded_YYYYMMDD_HHMMSS.jsonand update (or create)data/geocode_cache.jsonin the same directory. - You can specify custom output or cache files with
--outputand--cache. - You can adjust the delay between API requests (default: 2 seconds) with
--delay.
icewatch geocode --input data/ice_facilities_YYYYMMDD.json --output data/facilities_geocoded_YYYYMMDD.json --cache data/geocode_cache.jsonYou must set a valid User-Agent string in the script before running it.
Edit the USER_AGENT variable in geocode_facilities.py:
USER_AGENT = "icewatch/1.0 (your_email@example.com)"Replace your_email@example.com with your actual email or project contact. This is required by the Nominatim Usage Policy.
You can create a static interactive map of all geocoded facilities using the provided script. The map will show each facility as a marker, with popups displaying the name, address, and rounded counts of criminal and non-criminal detainees.
icewatch render --input data/facilities_geocoded_YYYYMMDD.json- By default, this will create
docs/index.html(and thedocsdirectory if it doesn't exist). - You can specify a custom output path with
--outputif desired.
icewatch uses uv as its project manager.
Follow the installation instructions from the official docs.
Verify your installation by running:
uv --versionClone the icewatch repo:
git clone https://github.com/lockdown-systems/icewatch.git
cd icewatchIf you have the gh command line tool installed, clone the repo with the following command:
gh repo clone lockdown-systems/icewatch
cd icewatchIn your cloned repository,set up your Python virtual environment with all development dependencies:
# Create project virtual environment with all dependencies
uv sync --dev
# Source the newly created virtual environment
source .venv/bin/activateVerify that your environment was set up correctly by running icewatch with uv:
uv run icewatch --helpThis step is optional and runs the same checks on your local codebase that run on every PR.
Install pre-commit:
# Install pre-commit globally using pre-commit
uv tool install pre-commit
# Install git hooks for your local repository
pre-commit installVerify that pre-commit git hooks were set up correctly by running them manually:
pre-commit run --all-filesThis tool is for educational and research purposes. Please ensure compliance with the ICE website's terms of service and respect rate limiting.