Skip to content

OrcaCollective/iapro-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IAPro Viewer

A simple, Dockerized web application for viewing and searching police accountability data from IAPro CSV files.

Features

  • Search by Officer Name: Type an officer's name to see all related cases, allegations, and outcomes
  • Filter by Allegation: Filter records by allegation type
  • Filter by Incident Type: Filter records by incident type/department
  • Combined Filtering: Use multiple filters together for precise searches
  • Responsive Interface: Works on desktop and mobile devices
  • Real-time Search: Search results update as you type (with HTMX)

Quick Start with Docker

  1. Clone the repository:

    git clone <repository-url>
    cd iapro-viewer
  2. Build and run with Docker Compose:

    docker-compose up -d
  3. Access the application: Open your browser and navigate to: http://localhost:8000

  4. Stop the application:

    docker-compose down

Local Development Setup

Prerequisites

  • Python 3.11+
  • pip

Installation

  1. Install dependencies:

    pip install -r requirements.txt
  2. Run the development server:

    uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload
  3. Access the application: Open your browser and navigate to: http://127.0.0.1:8000

Usage Examples

Search by Officer Name

  1. Enter an officer's name in the search box (e.g., "Smith")
  2. Results will appear automatically as you type
  3. View all cases, allegations, and outcomes for that officer

Filter by Allegation

  1. Select an allegation type from the dropdown (e.g., "Professionalism")
  2. Click "Search" or let it auto-update
  3. View all records matching that allegation

Combined Search

  1. Enter an officer name
  2. Select an allegation type
  3. Select an incident type
  4. View records matching all criteria

Clear Filters

  • Click the "Clear" button to reset all search criteria

Data Schema

The application displays the following fields from the IAPro CSV:

Field Description
File Number Unique case identifier
Officer Name Name of the officer involved
Allegation Type of allegation
Finding Investigation finding
Discipline Disciplinary action taken
Occurred Date Date the incident occurred
Incident Type Type/category of incident

Technology Stack

  • Backend: FastAPI (Python)
  • Data Processing: pandas
  • Frontend: HTMX for interactivity
  • Styling: Custom CSS
  • Deployment: Docker + Docker Compose

Project Structure

iapro-viewer/
├── app/
│   ├── main.py              # FastAPI application
│   ├── data_loader.py       # CSV data loader and filter logic
│   ├── templates/           # Jinja2 HTML templates
│   │   ├── index.html       # Main search interface
│   │   └── partials/        # HTMX partial responses
│   │       └── results.html # Search results table
│   └── static/              # CSS and static assets
│       └── style.css
├── data/
│   └── iapro-data.csv       # Police accountability data (21,723 records)
├── Dockerfile               # Docker image configuration
├── docker-compose.yml       # Docker orchestration
├── requirements.txt         # Python dependencies
└── README.md

Updating Data

To update the CSV data:

  1. Replace data/iapro-data.csv with your new CSV file
  2. Ensure the CSV has the same column names
  3. Restart the application:
    • Docker: docker-compose restart
    • Local: Restart the uvicorn server

The application will automatically reload the new data.

Health Check

Check if the application is running and data is loaded:

curl http://localhost:8000/health

Response:

{
    "status": "healthy",
    "records_loaded": 21723
}

License

See LICENSE file for details.

About

Web app for searching through IAPro files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors