Skip to main content
src/common/settings.py · chapter Shared rules, file 3 · 90 lines · open in the repository

What it does

Where the project’s files live, and how to reach Kafka. Scripts take every path from here, so they work from any folder and a file name is typed once. What is studied lives in config/ (events, retailers, Wikipedia articles, retail series) and how it is studied (years, windows, market index) in common.study. Usage:

What is inside

  • REPO_ROOT · line 17
  • CONFIG_DIR · line 20: Hand-edited registries, committed. Their columns are contracts (docs/data-contracts.md).
  • EVENT_TYPES_CSV · line 21
  • EVENT_DATES_CSV · line 22
  • RETAILERS_CSV · line 23
  • WIKI_ARTICLES_CSV · line 24
  • RETAIL_SERIES_CSV · line 25
  • RAW_DIR · line 27: downloads; gitignored, never edited by hand
  • CLEAN_DIR · line 28: cleaned tables; small, committed for the team
  • DATA_DIR · line 29: made by runs; gitignored
  • REPLAY_DIR · line 30: JSON files for running the streaming job without Kafka
  • SRC_DIR · line 31: the project’s Python packages
  • DEMO_STREAM_DIR · line 32: where scripts/demo_live.sh writes its run
  • STREAM_DIR · line 33: streaming job output, one subfolder per dataset:
  • STREAM_SUBDIRS · line 34
  • RESULTS_DIR · line 36: batch event study and model output
  • MODEL_DIR · line 37: trained models (src/ml/train.py); remade by a run
  • BIG_MOVE_MODEL · line 38: the Spark MLlib PipelineModel the streaming job loads
  • BIG_MOVE_MODEL_INFO · line 39: its features, alert cut-off and test scores
  • CHECKPOINT_DIR · line 40: Spark streaming checkpoints, one folder per query; gitignored
  • DOCS_DIR · line 44: Documentation. docs/ is written by hand; docs-site/ is the Mintlify site that scripts/build_docs.py builds from the code and docs/ (decision 0011).
  • DOCS_SITE_DIR · line 45
  • HOSTING_DIR · line 48: What is published (src/hosting/, decisions 0010 and 0013).
  • SNAPSHOT_DIR · line 49: the recorded replay and event history the dashboard shows;
  • SITE_DIR · line 51: made by src/hosting/snapshot.py, committed (derived data only)
  • CARDS_DIR · line 52: dataset, model and Space card templates
  • APP_BUNDLE_DIR · line 53: what the hosted dashboard’s repository adds to the code
  • PUBLISH_DIR · line 54: the dataset, model and Space folders, staged before upload
  • HF_OWNER · line 58: The team’s public homes: the Hugging Face organisation (dataset, model, Space, live feed) and the github.com organisation (the docs site’s and the hosted dashboard’s repositories).
  • HF_REPOS · line 59
  • GITHUB_ORG · line 60
  • DOCS_URL · line 61
  • DASHBOARD_URL · line 65: The hosted dashboard (Streamlit Community Cloud) and its live feed: during a demo the streaming job publishes each micro-batch to a public Hugging Face dataset (src/hosting/live.py).
  • LIVE_REPO · line 66
  • LIVE_CACHE_DIR · line 67: the dashboard’s local copy of the live feed
  • STREAMER_REPO · line 70: The cloud streamer (decision 0015): a private github.com repository whose “Live stream” workflow runs scripts/demo_live.sh on GitHub’s servers, so a live run needs no team member’s computer.
  • STREAMER_URL · line 71
  • LINKS · line 72: where everything is, for pages and cards
  • clean_path(dataset) · line 84: The committed Parquet file of a clean dataset, e.g. clean_path(“prices”).
  • KAFKA_BOOTSTRAP · line 90: The course cluster’s Kafka servers. Set KAFKA_BOOTSTRAP=localhost:9092 for a local Kafka.

Connections

Used by: src/common/contracts.py, etl/prices_download.py, etl/prices_clean.py, etl/pageviews_download.py, etl/pageviews_clean.py, etl/retail_clean.py, etl/build_events.py, etl/join_master.py, src/producers/replay_to_files.py, scripts/create_topics.py, src/producers/replay_master.py, scripts/peek_topic.py, src/streaming/job.py, scripts/check_streaming.py, src/eventstudy/car.py, src/eventstudy/stats.py, src/eventstudy/charts.py, scripts/export_results.py, scripts/compare_stream_batch.py, src/ml/train.py, src/dashboard/app.py, src/hosting/snapshot.py, src/hosting/live.py, src/hosting/publish_hf.py, tests/test_clean_files.py, tests/test_dashboard.py, tests/test_hosting.py, tests/test_ai_usage.py, scripts/build_docs.py

Source

src/common/settings.py