a451060c1bc5941cf04789d5c4fe4247dc3ba651
Takes in a file, process it and output a new file with additional columns.
Warner-Vistex-Automater
Stage 1 of a Bootstrap-based PHP app that uploads an Excel workbook, processes the rows, stores the imported data in PostgreSQL, and previews the imported rows in a paginated table.
Features
- Upload
.xlsor.xlsxfiles. - Validate required spreadsheet headers before import.
- Wipe previous imported rows before each new import.
- Compute the stage 1 derived fields during import.
- Store normalized imported data plus calculated data in PostgreSQL using
jsonb. - Process large imports in short chunks to avoid request timeouts.
- Review imported rows in a Bootstrap table with pagination.
- Show upload progress and import status in the browser.
Requirements
- PHP 8.3 or newer
- Composer
- PostgreSQL
Setup
-
Edit
config.phpand update the database settings if your host names differ from the defaults.- Or set
DATABASE_URL, for example:
DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/devdb?sslmode=prefer- The default host is
localhostfor CLI scripts andpostgres_dbfor the web app. - If your setup differs,
DATABASE_URLis the easiest override. - Set
APP_URLif the app will run from a different folder or base URL thanhttp://localhost/warner/.
- Or set
-
Install dependencies:
composer install
- Run the database migration:
composer run migrate
- Start the app:
php -S 127.0.0.1:8000 -t public
- Open http://127.0.0.1:8000.
Import flow
- The app validates that a file was uploaded.
- The file must be an Excel workbook.
- Required columns are checked by header name.
- Existing imported rows are deleted in a transaction.
- The workbook rows are normalized and derived fields are calculated.
- The new rows are inserted and then displayed in the preview table.
Data model
The schema uses two tables:
import_batchesstores metadata for each import run.import_rowsstores the row payloads usingjsonbfor original, normalized, and calculated data.
This keeps the model flexible for later import stages and additional derived fields.
Languages
PHP
94.2%
JavaScript
4.7%
CSS
1.1%