feat(pipeline): implement parliamentary embedding pipeline MVP
- Add 4 migration files: mp_votes, mp_metadata, svd_vectors, fused_embeddings - Extend database.py with 5 new helper methods and table init - Add pipeline/ package: extract_mp_votes, fetch_mp_metadata, text_pipeline, svd_pipeline (with Procrustes alignment), fusion - Add full test suite (17 tests) covering all pipeline modules and migrations - Fix Procrustes alignment bug: scipy scale is a norm value, not a multiplier - Fix DuckDB date type handling in test assertions (datetime.date vs string) - Remove duckdb.py shim; tests now run against real duckdb + scipy via uv Ref: thoughts/shared/plans/2026-03-21-parliamentary-embedding-pipeline-plan.md
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Install minimal system deps
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential curl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create non-root user for running the app
|
||||
RUN useradd -m -s /bin/bash app
|
||||
|
||||
WORKDIR /home/app/app
|
||||
|
||||
# Copy project files
|
||||
COPY . /home/app/app
|
||||
|
||||
# Upgrade pip and install either pinned requirements or runtime defaults
|
||||
RUN python -m pip install --upgrade pip
|
||||
RUN if [ -f requirements.txt ]; then \
|
||||
pip install -r requirements.txt; \
|
||||
else \
|
||||
pip install uv streamlit duckdb; \
|
||||
fi
|
||||
|
||||
# Fix permissions
|
||||
RUN chown -R app:app /home/app
|
||||
|
||||
USER app
|
||||
ENV PYTHONPATH=/home/app/app
|
||||
|
||||
EXPOSE 8501
|
||||
|
||||
# Simple healthcheck that queries the Streamlit root
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s CMD curl -f http://localhost:8501/ || exit 1
|
||||
|
||||
# Run the Streamlit app via uv as preferred in this project
|
||||
CMD ["uv", "run", "streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
||||
Reference in New Issue
Block a user