No description
- Python 71.5%
- JavaScript 15%
- HTML 13.3%
- Mako 0.2%
|
All checks were successful
CI / test (push) Successful in 52s
Adds a button to mark all checklist items in a carousel as completed for the current day, with confirmation dialog and Swedish translations. |
||
|---|---|---|
| .forgejo/workflows | ||
| app | ||
| migrations | ||
| tests | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| babel.cfg | ||
| config.py | ||
| messages.pot | ||
| pytest.ini | ||
| README.md | ||
| requirements.txt | ||
| run.py | ||
| todo.md | ||
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 sessionsOWNER_USERNAME,OWNER_PASSWORD,OWNER_NAME: Initial owner accountDATABASE_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