No description
  • Python 71.5%
  • JavaScript 15%
  • HTML 13.3%
  • Mako 0.2%
Find a file
Jimmy Berglund 67feae60b2
All checks were successful
CI / test (push) Successful in 52s
Add 'Mark all as completed' button for carousels
Adds a button to mark all checklist items in a carousel as completed
for the current day, with confirmation dialog and Swedish translations.
2026-05-15 11:01:13 +02:00
.forgejo/workflows Updated CI 2026-04-23 19:21:19 +02:00
app Add 'Mark all as completed' button for carousels 2026-05-15 11:01:13 +02:00
migrations Add picture upload feature with S3-compatible storage 2026-04-24 12:49:10 +02:00
tests Add 'Mark all as completed' button for carousels 2026-05-15 11:01:13 +02:00
.env.example Add picture upload feature with S3-compatible storage 2026-04-24 12:49:10 +02:00
.gitignore Add uploads/ to gitignore 2026-04-24 13:14:44 +02:00
AGENTS.md Update agents 2026-04-05 17:25:20 +02:00
babel.cfg Add i18n support with English and Swedish translations 2026-04-05 17:20:18 +02:00
config.py Add picture upload feature with S3-compatible storage 2026-04-24 12:49:10 +02:00
messages.pot Add i18n support with English and Swedish translations 2026-04-05 17:20:18 +02:00
pytest.ini Initial commit 2026-03-31 13:06:37 +02:00
README.md Update README with picture upload and theme features 2026-04-24 14:05:03 +02:00
requirements.txt Add picture upload feature with S3-compatible storage 2026-04-24 12:49:10 +02:00
run.py Initial commit 2026-03-31 13:06:37 +02:00
todo.md Updated todo 2026-04-24 14:02:39 +02:00

ParkInspect

A Flask application for daily safety inspections of equipment. Create carousels (groups of safety checks), add checklist items, and mark them complete with optional notes.

Features

  • Carousel Management: Create groups of related safety checks
  • Checklist Items: Add items with titles and descriptions
  • Completion Tracking: Mark items complete with timestamps and notes
  • Multiple Completions: Complete the same item multiple times per day
  • Completion History: View and retire completions with reasons
  • Picture Upload: Upload photos with completions (local or S3 storage)
  • Role-Based Access: Owner, admin, and editor roles
  • Dark/Light Mode: Toggle between light and dark themes
  • REST API: Full API for programmatic access

Quick Start

1. Clone and Setup

# Create virtual environment
python -m venv venv

# Activate virtual environment
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

2. Configure

Copy .env.example to .env and configure:

cp .env.example .env

Edit .env with your settings:

  • SECRET_KEY: A secure random key for sessions
  • OWNER_USERNAME, OWNER_PASSWORD, OWNER_NAME: Initial owner account
  • DATABASE_URL: Database connection (default: SQLite)

3. Initialize Database

# Initialize migrations
flask db init

# Create initial migration
flask db migrate -m "Initial migration"

# Apply migrations
flask db upgrade

4. Run

flask run

Visit http://localhost:5000 and login with your owner credentials.

User Roles

Role Permissions
Owner Full access, manage all users, assign any role
Admin Manage carousels, checklists, completions
Editor View and complete checklists only

Configuration

Variable Description Default
FLASK_CONFIG Config class DevelopmentConfig
SECRET_KEY Session secret key Required
DATABASE_URL Database connection SQLite file
OWNER_USERNAME Initial owner username Required
OWNER_PASSWORD Initial owner password Required
OWNER_NAME Initial owner display name Required
REGISTRATION_ENABLED Allow self-registration false
COMPLETION_RECORD_USER Track who completed items false
UPLOAD_STORAGE_TYPE Image storage backend local
UPLOAD_LOCAL_PATH Local upload directory uploads
S3_BUCKET S3 bucket name -
S3_ENDPOINT_URL S3-compatible endpoint -
S3_REGION_NAME S3 region us-east-1
S3_ACCESS_KEY S3 access key -
S3_SECRET_KEY S3 secret key -

REST API

Carousels

POST   /api/                              Create carousel
GET    /api/carousels                      List carousels
PATCH  /api/carousel/<id>/retire           Retire carousel

Checklists

POST   /api/carousel/<id>/checklist        Create checklist item
GET    /api/carousel/<id>/checklists       List checklists
GET    /api/carousel/<id>/completion-status Get today's status
GET    /api/carousel/<id>/calendar-dates   Get completion counts by day (admin)

Completions

POST   /api/checklist/<id>/complete        Add completion
GET    /api/checklist/<id>/completions      List completions
GET    /api/checklist/<id>/history         Get all completion history (admin)
PATCH  /api/completion/<id>/retire         Retire completion

Images

POST   /api/completion/<id>/images        Upload image
GET    /api/completion/<id>/images        List images
DELETE /api/image/<id>                    Delete image (admin)
GET    /api/image/<key>                   Serve image

Example

# Login (get session cookie)
curl -X POST http://localhost:5000/login \
  -d "username=admin&password=yourpassword"

# Create a carousel
curl -X POST http://localhost:5000/api/ \
  -H "Content-Type: application/json" \
  -d '{"name": "Ferris Wheel Morning Check"}'

# Add a checklist item
curl -X POST http://localhost:5000/api/carousel/1/checklist \
  -H "Content-Type: application/json" \
  -d '{"title": "Check bolt tightness", "description": "Inspect all main bolts"}'

# Mark as complete
curl -X POST http://localhost:5000/api/checklist/1/complete \
  -H "Content-Type: application/json" \
  -d '{"notes": "All bolts tightened, slight wear on bolt #3"}'

Development

Running Tests

pytest
pytest -v
pytest tests/test_api.py

Project Structure

app/
├── models.py        # Database models
├── routes/
│   ├── main.py      # Web UI routes
│   ├── api.py       # REST API
│   ├── auth.py      # Authentication
│   └── admin.py     # Admin panel
└── templates/       # HTML templates

License

MIT