Extraction finished (575/588 chunks; 6 content-filter-blocked, 7 await re-extraction). DB rebuilt and frozen at 9418 activities — content_keys are now stable for the enrichment overlay. Part A (plumbing + UI): - database.py: name_ro/description_ro/rules_ro/variations_ro, indoor_outdoor, space_needed, estimated_fields, source_id/source_ids/chunk_key columns; FTS5 indexes the 4 *_ro columns across CREATE + all 3 triggers; new equality filters + category counts for both axes. - activity.py: new fields + bilingual display helpers (get_display_*, is_estimated, axis displays). - config_taxonomy.py: INDOOR_OUTDOOR/SPACE_NEEDED enums + normalizers (None on unrecognised, no fabrication). - search.py / routes.py / config.py / templates / css: new dropdowns, RO-primary rendering with "(estimat)" markers and collapsible original text, and a /source/<id> download route shipped DARK behind SOURCE_DOWNLOAD_ENABLED (copyright opt-in). - build_database.py: source_id/chunk_key in dict_to_activity; merge_cluster unions source_ids without touching enrichment fields. Part B (enrichment pipeline, built not yet run): - build_database.py: load_enrichment + apply_enrichment (post-dedup, keyed on content_key) + --enrichment CLI + stated-vs-estimated QA. - run_enrichment.py (resumable, --source/--limit pilot scoping, --collect), ENRICHMENT_PROMPT.md. Repair: scripts/repair_extractions.py fixes the subagents' systematic unescaped-ASCII-quote bug with a faithful char-scanner (escapes, never truncates) + schema validation + a strictly-more-text guard. json_repair was tried first, truncated silently, and is NOT used. build_database has no repair dependency. Tests: tests/test_enrichment.py added; 99 pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""
|
|
Configuration settings for INDEX-SISTEM-JOCURI v2.0
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
class Config:
|
|
"""Base configuration"""
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
|
|
DATABASE_URL = os.environ.get('DATABASE_URL') or 'sqlite:///data/activities.db'
|
|
|
|
# Application settings
|
|
FLASK_ENV = os.environ.get('FLASK_ENV') or 'development'
|
|
DEBUG = os.environ.get('DEBUG', 'false').lower() == 'true'
|
|
|
|
# Data directories
|
|
BASE_DIR = Path(__file__).parent.parent
|
|
DATA_DIR = BASE_DIR / 'data'
|
|
INDEX_MASTER_FILE = DATA_DIR / 'INDEX_MASTER_JOCURI_ACTIVITATI.md'
|
|
|
|
# Search settings
|
|
SEARCH_RESULTS_LIMIT = int(os.environ.get('SEARCH_RESULTS_LIMIT', '100'))
|
|
FTS_ENABLED = True
|
|
|
|
# Source-file download (plan A6). Shipped DARK by default: serving the
|
|
# original PDFs/books carries a copyright exposure the user must opt into.
|
|
# The /source/<id> route 404s entirely while this is false; the UI hides
|
|
# the download link. Enable with SOURCE_DOWNLOAD_ENABLED=true.
|
|
SOURCE_DOWNLOAD_ENABLED = (
|
|
os.environ.get('SOURCE_DOWNLOAD_ENABLED', 'false').lower() == 'true'
|
|
)
|
|
# Root of the original corpus. source_file values are relative to this.
|
|
CORPUS_DIR = os.environ.get('CORPUS_DIR') or str(
|
|
Path(__file__).parent.parent / 'data' / 'carti-camp-jocuri'
|
|
)
|
|
|
|
@staticmethod
|
|
def ensure_directories():
|
|
"""Ensure required directories exist"""
|
|
Config.DATA_DIR.mkdir(exist_ok=True)
|
|
|
|
class ProductionConfig(Config):
|
|
"""Production configuration"""
|
|
DEBUG = False
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'default-production-key-change-me'
|
|
|
|
class DevelopmentConfig(Config):
|
|
"""Development configuration"""
|
|
DEBUG = True
|
|
|
|
class TestingConfig(Config):
|
|
"""Testing configuration"""
|
|
TESTING = True
|
|
DATABASE_URL = 'sqlite:///:memory:' |