> ## Documentation Index
> Fetch the complete documentation index at: https://calendar-effects.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Calendar Effects

> Do retail stocks and their Wikipedia attention move abnormally around shopping events? A guided tour of the codebase, from start to finish.

Calendar Effects is the CMPT 732 (Big Data, SFU, Fall 2026) project of **Muhammad Mahad, Sanchi Kataria, Anushiya and Areej Siddiqui**. It asks one question: **around Black Friday, Cyber Monday, Prime Day, Halloween and Chinese New Year, do retail stocks move more than the market explains, and does Wikipedia attention move with them?**

It answers it twice, in two independent ways, and checks that the answers agree:

> [card] [As a live stream](https://calendar-effects.mintlify.site/tour/05-streaming.md)
>
> Ten years of daily prices and pageviews are replayed through **Kafka** into **Spark Structured Streaming**, which flags abnormal days and closes each event's window the moment its last day arrives.

> [card] [As a batch study](https://calendar-effects.mintlify.site/tour/06-batch-study.md)
>
> A classic **event study** computes the same numbers from whole arrays at once, then tests them for significance. It is the answer key the stream must match.

> [card] [With a model](https://calendar-effects.mintlify.site/tour/08-machine-learning.md)
>
> A **Spark MLlib** model, trained on the stream's own output, scores which retailers are likely to make a big move tomorrow, live.

> [card] [On screen](https://calendar-effects.mintlify.site/tour/09-dashboards-and-publishing.md)
>
> One **Streamlit** dashboard, on a laptop and hosted, showing live runs from a laptop or GitHub's servers; the dataset and model are on **Hugging Face**.

> [!TIP]
>
> See it running: [the dashboard](https://calendar-effects.streamlit.app) (live runs, the recorded stream, each event's history). The [results](https://calendar-effects.mintlify.site/results.md) have every number for the report. The [dataset](https://huggingface.co/datasets/calendar-effects/calendar-effects) and [model](https://huggingface.co/calendar-effects/big-move-model) are in the team's [Hugging Face organisation](https://huggingface.co/calendar-effects).

## How to read these docs

**1. Run it**

[Run it](https://calendar-effects.mintlify.site/run.md) has every command, in the order you would use them: setting up, reproducing the results, refreshing what is published, and the live demo.

**2. Take the tour**

The **Guide** tab has ten chapters in reading order. Each explains one stage in plain words, shows its diagram, lists its files in the order to read them, and ends with questions you should be able to answer and ideas to improve it.

**3. Open the code**

The **Code** tab has one page per file, in the same order: what the file does (its docstring), what is inside it with line numbers, what it uses and what uses it, and the full source.

**4. Look things up**

**Data and decisions** has every dataset's columns (the data contracts), every design decision with its reasons, and every architecture diagram. **Project log** has who is doing what, and a note for every piece of work done.

**5. Ask questions**

The site has a search box, and an MCP server so Claude, Cursor or ChatGPT can answer questions from it. See [Ask questions about the code](https://calendar-effects.mintlify.site/ask.md).

## One stock-day, start to finish

Follow a single row: **Walmart on Black Friday 2024**.

1. **Config** says Walmart is a store retailer, its Wikipedia article is `Walmart`, and Black Friday is the day after the fourth Thursday of November ([chapter 2](https://calendar-effects.mintlify.site/tour/02-shared-rules.md)).
2. **ETL** downloads Walmart's prices and pageviews, cleans them, and joins them into one row of `clean/master.parquet`: the return that day, the volume ratio, the views, and the event name ([chapter 3](https://calendar-effects.mintlify.site/tour/03-building-a-row.md)).
3. **The replay** sends that row to Kafka as JSON, one trading day at a time, as if 2024 were happening live, with a few rows deliberately late ([chapter 4](https://calendar-effects.mintlify.site/tour/04-replaying.md)).
4. **The streaming job** pairs it with the market's return that day, compares Walmart's move with what its market model expected (the **abnormal return**), compares its views with their recent level (an **attention spike**?), and opens Black Friday's event window. Five trading days later it closes the window and writes its **CAR**, the sum of the abnormal returns over days −5 to +5 ([chapter 5](https://calendar-effects.mintlify.site/tour/05-streaming.md)).
5. **The batch study** computes the same CAR another way, and the statistics say whether Black Friday CARs differ from zero across all retailers and years ([chapter 6](https://calendar-effects.mintlify.site/tour/06-batch-study.md)).
6. **The comparison** checks the two CARs are equal ([chapter 7](https://calendar-effects.mintlify.site/tour/07-comparing.md)).
7. **The model** scores how likely Walmart is to make a big move the next day ([chapter 8](https://calendar-effects.mintlify.site/tour/08-machine-learning.md)), and **the dashboard** shows all of it as it happens ([chapter 9](https://calendar-effects.mintlify.site/tour/09-dashboards-and-publishing.md)).
8. **The tests** guard every step above, before every commit ([chapter 10](https://calendar-effects.mintlify.site/tour/10-tests-and-tooling.md)).

> [!NOTE]
>
> These docs are built from the code by `scripts/build_docs.py`, and a test refuses any commit that leaves them out of date. Every page in the **Code** tab is therefore the code as it is now.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.