Verified each finding against the code (+ profiled the 31k-row CSV sample); implemented only the genuinely valid fixes: - import_tickets.py: fold _record_meta into the upsert transaction so rows + snapshot meta commit atomically (BUG 2); guard _ts_from_key against regex-matching-but-invalid dates so the sort can't crash (BUG 11); extract_place now splits glued NW prefixes (~1.7k rows, e.g. NWKIAMBU→KIAMBU) and only drops a trailing '-<seg>' when it's a unit/instruction code, keeping real-word tails like '-MALL' (BUG 14). Scoped glued-split to NW only — CO/NE/SE begin real words (COAST/NEW/SEASONS) per the data. - Dockerfile + pyproject.toml: install from pyproject (single source of truth) instead of mirroring deps; add build-system + py-modules so `pip install .` works for the flat-module layout (BUG 9). - migrations/03_inc_columns.sql: document the eat_ts IMMUTABLE/tzdata footgun and the manual-recompute path (BUG 6). - .gitignore: narrow *.json → *.local.json so real fixtures can be versioned; ignore build/ and *.egg-info/ (BUG 10). Reclassified/skipped as invalid or by-design: BUG 1, 3, 4, 5, 7, 8, 12, 13. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
892 B
Docker
24 lines
892 B
Docker
# fleettickets — INC ingestion image (Coolify-deployable).
|
|
# A small batch/cron worker: it has no web server. Coolify keeps the container
|
|
# running (CMD below) and fires the ingest via a Scheduled Task:
|
|
# python import_tickets.py --from-bucket --apply (cron: 15 7-19 * * *)
|
|
# Env (set in Coolify): DATABASE_URL, RUSTFS_*, GEOCODER_*. S3 is via boto3 — no
|
|
# aws CLI needed. psycopg2-binary ships its own libpq, so no build toolchain.
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
TZ=Africa/Nairobi
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Install from pyproject.toml (single source of truth for deps — no manual mirror).
|
|
COPY . .
|
|
RUN pip install .
|
|
|
|
# Keep the container alive so Coolify Scheduled Tasks can exec into it.
|
|
CMD ["tail", "-f", "/dev/null"]
|