Added Flask-based web application for reviewing and editing H&M product data across multiple languages. Includes inline editing, approval workflow, change logging, and multi-image support. Key components: - server.py: Flask API with thread-safe JSON read/write - html_generator.py: Standalone HTML generator with language utilities - static/index.html: Interactive review UI with dynamic column management - CLAUDE.md: Comprehensive development guide - Sample campaign data (1022A, 2023) with images - Updated .gitignore for Python projects Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.2 KiB
3.2 KiB
H&M EMS Product Review Tool
A web-based review tool for H&M EMS product data. Clients can review product names and prices across multiple languages, make edits, and approve changes — all saved directly back to the master JSON.
Features
- Campaign File Selector: Switch between different JSON campaign files from the
Master_Json/folder - Multi-Language Columns: Select up to 4 target languages side-by-side for comparison
- Inline Editing: Edit Product Name and Price fields for any target language
- Approve & Save: Click the tick button to approve — edits are saved to the master JSON and fields are locked
- Change Logging: Every approve/unapprove action is recorded in a changelog file
- Campaign Images: Product images with click-to-enlarge preview popup
- Multi-Image Support: Articles with multiple campaign images display all thumbnails
- English Reference Column: Fixed column showing the English (GB) product name
Folder Structure
deploy/
├── server.py # Flask web server
├── html_generator.py # Shared helpers (language names, image utils)
├── static/
│ └── index.html # Review UI (single-page app)
├── Master_Json/ # Campaign JSON files
│ ├── 1022A.json
│ └── 2023.json
├── campaign_images/ # Product images organised by year/campaign
│ ├── 2025/1022A/Automation_LR/
│ └── 2026/2023/Automation_LR/
├── requirements.txt
└── README.md
Setup
1. Install dependencies
pip install -r requirements.txt
2. Run locally
python3 server.py
3. Run with Gunicorn (production)
gunicorn server:app --bind 0.0.0.0:5000 --workers 4
Configuration
All paths are configurable via environment variables:
| Variable | Default | Description |
|---|---|---|
IMAGE_BASE_PATH |
./campaign_images |
Root folder containing {year}/{campaign}/Automation_LR/ images |
MASTER_JSON_DIR |
./Master_Json |
Folder containing campaign JSON files |
PORT |
5000 |
Server port (used by python3 server.py only) |
Example:
IMAGE_BASE_PATH=/mnt/data/images MASTER_JSON_DIR=/mnt/data/json PORT=8080 python3 server.py
Adding New Campaigns
- Place the campaign JSON file in
Master_Json/(e.g.3045A.json) - Place campaign images in
campaign_images/{year}/{campaign}/Automation_LR/- The year is derived from the Season field in the JSON (first 4 digits)
- The campaign prefix is derived from the filename before the first underscore
- Refresh the browser — the new campaign appears in the dropdown
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Review UI |
| GET | /api/files |
List available campaign JSON files |
| GET | /api/load/<filename> |
Load campaign data, images, languages, approvals |
| POST | /api/approve |
Approve/unapprove a record, save edits to master JSON |
| GET | /images/<year>/<campaign>/<file> |
Serve campaign images |
Requirements
- Python 3.6+
- flask
- gunicorn (for production deployment)