> ## 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.

# Hosting, publishing and the live demo

> docs/architecture/12-hosting-and-live-demo.mmd

```mermaid theme={null}
%% Calendar Effects · 12 · Hosting, publishing and the live demo · Mahad · decisions 0010, 0011, 0013, 0014, 0015.
%% Paste into Miro: Creation bar > Diagram > Build with code.
flowchart LR
  sfu[("github.sfu.ca · aba395/Calendar-Effects<br/>the team repository, the only source")]
  hook["git post-commit hook, on main<br/>scripts/install_git_hooks.sh, once per person<br/>needs gh auth login"]

  subgraph GH["github.com · the Calendar-Effects organisation"]
    docsrepo["docs · private<br/>docs-site/ only<br/>scripts/sync_docs_site.sh"]
    dashrepo["dashboard · public<br/>the app, the code it imports, config/,<br/>the recording · scripts/sync_dashboard_app.sh"]
    copy["live-stream · private · branch project<br/>what the demo needs, clean/master.parquet included<br/>scripts/sync_live_stream.sh"]
    cloud["live-stream · Actions · Live stream workflow<br/>Run workflow: start or resume · Cancel run stops<br/>stops by itself when the data runs out"]
    cache[("Actions cache<br/>checkpoint + outputs of the last run<br/>so resume carries the same run on")]
  end

  laptop["A laptop<br/>scripts/demo_live.sh<br/>Ctrl-C stops · --resume carries on"]
  job["src/streaming/job.py --publish-live<br/>a micro-batch every 5 s<br/>--stop-when-idle at the end"]
  live["src/hosting/live.py · LivePublisher<br/>every 15 s, one upload<br/>drops price columns: NOT_PUBLISHED<br/>a new run waits while another is live"]

  subgraph HF["Hugging Face · the calendar-effects organisation"]
    feed[("live-feed dataset<br/>current.json: run, by, batches, reached,<br/>finished, complete<br/>runs/run_id/batch_id=N")]
    data[("calendar-effects dataset<br/>big-move-model model<br/>publish_hf.py --upload")]
    space["dashboard Space · static page<br/>embeds the hosted app"]
  end

  snapshot[("hosting/snapshot/ · committed<br/>replay.json + replay_rows.parquet<br/>events.json · meta.json<br/>src/hosting/snapshot.py")]
  app["Hosted dashboard · Streamlit Community Cloud<br/>calendar-effects.streamlit.app<br/>mirror(): new files only, _SUCCESS last"]
  views["Live stream · Replay any years<br/>Event history & forecast · About"]
  mint["Mintlify<br/>calendar-effects.mintlify.app"]

  sfu --> hook
  hook --> docsrepo --> mint
  hook --> dashrepo --> app
  hook --> copy --> cloud
  cloud -.- cache
  snapshot --> dashrepo
  laptop --> job
  cloud --> job
  job --> live --> feed --> app
  app --> views
  space -.-> app
  sfu -.-> data

  classDef src fill:#E6F1FB,stroke:#185FA5,color:#0C447C
  classDef run fill:#E1F5EE,stroke:#0F6E56,color:#085041
  classDef pub fill:#EAF3DE,stroke:#3B6D11,color:#27500A
  classDef priv fill:#FAECE7,stroke:#993C1D,color:#712B13
  class sfu,hook,snapshot src
  class laptop,job,live,cloud run
  class dashrepo,feed,data,space,app,views,mint pub
  class docsrepo,copy,cache priv
```

## Guide

```mermaid theme={null}
%% Calendar Effects · Guide 12 · Hosting, publishing and the live demo · goes next to diagram 12-hosting-and-live-demo.mmd
%% Miro: paste onto a board, or Creation bar > Diagram > Build with code. Read top to bottom.
flowchart TB
  T["GUIDE 12 · HOSTING, PUBLISHING AND THE LIVE DEMO<br/>src/hosting/ · hosting/ · scripts/ · decisions 0010, 0011, 0013, 0014, 0015"]

  subgraph S1["1 · THE PROBLEMS"]
    direction TB
    p1["A HOSTED APP CANNOT SEE A LAPTOP<br/>the job writes to data/stream/<br/>on one computer"]
    p2["A DEMO SHOULD NOT NEED A LAPTOP<br/>no Java, no Spark, no open terminal"]
    p3["FREE HOSTS READ GITHUB.COM ONLY<br/>Streamlit Cloud and Mintlify cannot<br/>read github.sfu.ca"]
    p4["PRICES ARE NOT OURS TO PUBLISH<br/>Yahoo's terms"]
  end

  subgraph S2["2 · WORDS"]
    direction TB
    w1["LIVE FEED<br/>the micro-batches a running job<br/>publishes online, as it goes"]
    w2["RUN<br/>one streaming job's output<br/>run_id, who started it, how far it got"]
    w3["GITHUB ACTIONS WORKFLOW<br/>a script GitHub runs on a fresh machine<br/>started with a button"]
    w4["ACTIONS CACHE<br/>files a workflow saves<br/>for its next run"]
  end

  subgraph S3["3 · A LIVE RUN"]
    direction TB
    r1["START<br/>scripts/demo_live.sh on a laptop<br/>or Run workflow on GitHub"]
    r2["PUBLISH<br/>job.py --publish-live: every 15 s<br/>the finished batches go to the live feed"]
    r3["ONE AT A TIME<br/>a new run waits while another is live<br/>takes_over() in live.py"]
    r4["END<br/>Ctrl-C or Cancel run: stopped, can resume<br/>data ran out: complete<br/>quiet for 2 minutes: went quiet"]
  end

  subgraph S4["4 · COPIES ON GITHUB.COM"]
    direction TB
    c1["THE HOOK MAKES THEM<br/>after each commit on main:<br/>docs, dashboard, live-stream"]
    c2["ONLY WHAT EACH NEEDS<br/>docs-site/ · the app and its code<br/>· the demo and its data"]
    c3["A WEBSITE MERGE WAITS<br/>a pull request merged on github.sfu.ca<br/>arrives with the next local commit"]
  end

  subgraph S5["5 · WHAT IS NEVER PUBLIC"]
    direction TB
    n1["PRICE COLUMNS<br/>ret · mkt_ret · vol_ratio · timestamp_utc<br/>dropped before any upload"]
    n2["THE DEMO'S DATA<br/>clean/master.parquet and the cache<br/>only in the private live-stream repo"]
    n3["THE RECORDING IS STATISTICS<br/>abnormal returns, z-scores, CARs, views"]
  end

  subgraph S6["6 · SAY IT CAREFULLY"]
    direction TB
    k1["LIVE PROCESSING, OLD DATA<br/>a replay of 2016–2025<br/>not today's market"]
    k2["THE LAST DAY IS 17 DEC 2025<br/>the 7-day watermark holds the last days:<br/>nothing newer arrives to release them"]
    k3["FREE PLANS<br/>the app sleeps after 12 h without visitors<br/>private Actions: 2,000 minutes a month"]
  end

  T --> S1 --> S2 --> S3 --> S4 --> S5 --> S6

  classDef head fill:#2C2C2A,stroke:#2C2C2A,color:#FFFFFF
  classDef idea fill:#E6F1FB,stroke:#185FA5,color:#0C447C
  classDef step fill:#E1F5EE,stroke:#0F6E56,color:#085041
  classDef warn fill:#FAECE7,stroke:#993C1D,color:#712B13
  classDef ask fill:#EEEDFE,stroke:#534AB7,color:#3C3489
  class T head
  class p1,p2,p3,p4 ask
  class w1,w2,w3,w4 idea
  class r1,r2,r3,r4 step
  class c1,c2,c3 step
  class n1,n2,n3 warn
  class k1,k2,k3 warn
  style S1 fill:#FFFFFF,stroke:#B4B2A9
  style S2 fill:#FFFFFF,stroke:#B4B2A9
  style S3 fill:#FFFFFF,stroke:#B4B2A9
  style S4 fill:#FFFFFF,stroke:#B4B2A9
  style S5 fill:#FFFFFF,stroke:#B4B2A9
  style S6 fill:#FFFFFF,stroke:#B4B2A9
```


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