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 17CONFIG_DIR· line 20: Hand-edited registries, committed. Their columns are contracts (docs/data-contracts.md).EVENT_TYPES_CSV· line 21EVENT_DATES_CSV· line 22RETAILERS_CSV· line 23WIKI_ARTICLES_CSV· line 24RETAIL_SERIES_CSV· line 25RAW_DIR· line 27: downloads; gitignored, never edited by handCLEAN_DIR· line 28: cleaned tables; small, committed for the teamDATA_DIR· line 29: made by runs; gitignoredREPLAY_DIR· line 30: JSON files for running the streaming job without KafkaSRC_DIR· line 31: the project’s Python packagesDEMO_STREAM_DIR· line 32: where scripts/demo_live.sh writes its runSTREAM_DIR· line 33: streaming job output, one subfolder per dataset:STREAM_SUBDIRS· line 34RESULTS_DIR· line 36: batch event study and model outputMODEL_DIR· line 37: trained models (src/ml/train.py); remade by a runBIG_MOVE_MODEL· line 38: the Spark MLlib PipelineModel the streaming job loadsBIG_MOVE_MODEL_INFO· line 39: its features, alert cut-off and test scoresCHECKPOINT_DIR· line 40: Spark streaming checkpoints, one folder per query; gitignoredDOCS_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 45HOSTING_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 templatesAPP_BUNDLE_DIR· line 53: what the hosted dashboard’s repository adds to the codePUBLISH_DIR· line 54: the dataset, model and Space folders, staged before uploadHF_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 59GITHUB_ORG· line 60DOCS_URL· line 61DASHBOARD_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 66LIVE_CACHE_DIR· line 67: the dashboard’s local copy of the live feedSTREAMER_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 71LINKS· line 72: where everything is, for pages and cardsclean_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