An open API service indexing awesome lists of open source software.

https://github.com/kzndotsh/gang.guide

Evidence backed mapping of criminal organizations across the US β€” alliances, rivalries, history, and culture.
https://github.com/kzndotsh/gang.guide

ai crime data-analysis data-science data-visualization dataset gangs konva konvajs llm organized-crime python svelte tailwind typescript

Last synced: about 5 hours ago
JSON representation

Evidence backed mapping of criminal organizations across the US β€” alliances, rivalries, history, and culture.

Awesome Lists containing this project

README

          




CI


Coverage


Release


SvelteKit


Cloudflare Workers


Konva.js


Python


gang.guide


gang.guide


Evidence backed mapping of criminal organizations across the US β€” alliances, rivalries, history, and culture.



🌐 Live Site β€’
πŸš€ Quick Start β€’
πŸ—οΈ Architecture β€’
βš™οΈ Pipeline β€’
βœ… Standards β€’
πŸ—ΊοΈ Roadmap


---

## Quick Start

```bash
# Clone and setup
git clone https://github.com/kzndotsh/gang.guide.git
cd gang.guide
just setup

# Or manually:
npm install
cd apps/web && npm install
python3 build.py

# Run the dev server
just dev
```

## How It Works

```
Scrape β†’ Clean β†’ Extract (sonnet 4.5 Γ— 3 temps) β†’ Adjudicate (opus 4.6) β†’ Merge β†’ Apply β†’ Build β†’ Serve
```

1. **Scrape** raw HTML from sources into `data/raw/`
2. **Extract** structured JSON via sonnet 4.5 at 3 temperatures β€” edges require verbatim evidence quotes
3. **Adjudicate** with opus 4.6 β€” validates evidence, rejects co-mentions, resolves conflicts
4. **Merge** via algorithmic consensus (2/3 agreement) or adjudicated result
5. **Apply** conservative upgrade to `data/orgs/*.json` + `data/edges.json` β€” lint gates the result
6. **Build** compiles flat files into `graph.json` + `details.json`
7. **Serve** on Cloudflare Workers via SvelteKit + Konva.js canvas

## Data

Stats are computed at build time by `build.py` and embedded in `graph.json`. All relationships are evidence-backed with verbatim quotes from source material. Data quality is enforced by [lint rules](docs/STANDARDS.md) that run in CI and gate every pipeline application.

**Sources:**

| | | |
|---|---|---|
| [Wikipedia](https://en.wikipedia.org) | [StreetGangs.com](https://www.streetgangs.com) | [UnitedGangs.com](https://unitedgangs.com) |
| [Chicago Gang History](https://chicagoganghistory.com) | [DetroitStreetGangs](https://detroitstreetgangs.com) | [NGCRC](https://www.ngcrc.com) |
| [NewYorkCityGangs](https://newyorkcitygangs.com) | [StoneGreasers](https://www.stonegreasers.com) | [DOJ / FBI](https://www.justice.gov) |
| [BlackPast.org](https://www.blackpast.org) | [CourtListener](https://www.courtlistener.com) | |

Data Stats

## Tech Stack

| Component | Technology |
|-----------|------------|
| **Data** | Flat JSON files, Python build script |
| **Frontend** | SvelteKit 5, Konva.js, Tailwind CSS, shadcn-svelte |
| **Rendering** | Raw Konva Canvas API (persistent nodes, edge-index, directional arrows) |
| **Deployment** | Cloudflare Workers via Alchemy IaC |
| **Pipeline** | Python, sonnet 4.5 + opus 4.6 (LLM extraction) |
| **Linting** | Ruff (Python), svelte-check (frontend) |
| **Testing** | pytest + vitest, codecov coverage |
| **CI/CD** | GitHub Actions, conventional commits, lefthook |

## Project Structure

```
β”œβ”€β”€ build.py # Builds graph.json + details.json from flat data
β”œβ”€β”€ data/
β”‚ β”œβ”€β”€ orgs/ # One JSON per org (source of truth)
β”‚ β”œβ”€β”€ edges.json # Edge list (alliances, rivalries, affiliations)
β”‚ └── lanes.json # Lane taxonomy + org anchors
β”œβ”€β”€ apps/
β”‚ β”œβ”€β”€ web/ # SvelteKit + Konva.js Canvas map viewer
β”‚ β”‚ β”œβ”€β”€ src/routes/ # +page.svelte (main map), sitemap.xml
β”‚ β”‚ β”œβ”€β”€ src/lib/map/ # KonvaMap.svelte, visibility.ts, scale.ts
β”‚ β”‚ β”œβ”€β”€ src/lib/inspector/ # Inspector panel components
β”‚ β”‚ └── alchemy.run.ts # Deployment config (Cloudflare Workers)
β”‚ └── pipeline/ # Python LLM extraction pipeline
β”‚ β”œβ”€β”€ extract.py # Multi-temp extraction (sonnet 4.5)
β”‚ β”œβ”€β”€ adjudicate.py # Conflict resolution (opus 4.6)
β”‚ β”œβ”€β”€ merge.py # Consensus filtering
β”‚ β”œβ”€β”€ apply.py # Conservative data upgrade
β”‚ β”œβ”€β”€ lint.py # Data validation (runs in CI)
β”‚ └── tests/ # Unit tests + e2e + fixtures
β”œβ”€β”€ .ruler/ # AI agent instructions (source of truth)
β”œβ”€β”€ .github/workflows/ # CI + release + PR title validation
β”œβ”€β”€ justfile # Task runner (just dev, just ci, just pipeline)
β”œβ”€β”€ pytest.ini # Test config (strict markers, coverage)
β”œβ”€β”€ lefthook.yml # Git hooks (ruff pre-commit, svelte-check pre-push)
β”œβ”€β”€ flake.nix # Nix dev shell
β”œβ”€β”€ TODO.md # Roadmap
└── docs/ # Documentation
β”œβ”€β”€ ARCHITECTURE.md # System design
β”œβ”€β”€ PIPELINE.md # LLM extraction pipeline
β”œβ”€β”€ SCHEMA.md # Data schema reference
β”œβ”€β”€ STANDARDS.md # Data quality rules & lint checks
β”œβ”€β”€ TERMINOLOGY.md # Glossary
β”œβ”€β”€ USER.md # User guide
└── CONTRIBUTING.md # Contributor guide
```

## Commands

```bash
just # list all tasks
just setup # bootstrap after cloning
just dev # start dev server
just build-data # rebuild graph.json from org files
just lint # lint data integrity
just check # type-check frontend
just deploy # deploy to production
just ruler # regenerate AI agent configs
```

## Adding a New Org

1. Create `data/orgs/my-new-org.json`:
```json
{
"id": "org:my-new-org",
"name": "My New Org",
"aliases": [],
"type": "street_gang",
"lane": "california-latino-other",
"metro": "Los Angeles",
"founded_year": 1985,
"founded_year_precision": "circa",
"description": "Factual 1-3 sentence description with founding context.",
"colors": ["blue"],
"nation_affiliation": null,
"status": "active",
"sources": [{"url": "https://...", "title": "Source Name"}]
}
```
2. Add relationships to `data/edges.json` if needed
3. Run `just build-data`

## Deployment

Deployed to Cloudflare Workers via [Alchemy](https://github.com/alchemy-run/alchemy).

```bash
just deploy # production
just deploy-preview # personal stage
```

Requires `apps/web/.env` with `ALCHEMY_PASSWORD`, `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`.

## AI Agent Setup

Instructions managed via [Ruler](https://github.com/intellectronica/ruler). After cloning:

```bash
just ruler
```

This generates config files for Claude, Copilot, Cursor, and Kiro from `.ruler/AGENTS.md`.

## License

TBD

## Contributors

![Contributors](https://contrib.rocks/image?repo=kzndotsh/gang.guide)

Created by [@kzndotsh](https://github.com/kzndotsh)

## Project Stats

![Project Stats](https://repobeats.axiom.co/api/embed/9da041285ec9bd9c7a612bc4443dba787c3d595b.svg)