Skip to content
Atharva309Public

About

Mix Marketing Model Helper for Stakeholders

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Meridian

Meridian is a Marketing Mix Modeling (MMM) workspace: upload marketing and outcome data, configure channel mapping and model settings, inspect contributions and ROI on a dashboard, run budget optimization with diminishing-returns curves, and chat with Meridian AI grounded in your current model run.


Try it live

👉 Open Meridian (live app)

Direct link (copy/paste):

https://meridian-26kiwy8sz-atharva309s-projects.vercel.app/

Examples after it loads:

  • Configure & upload data: /configure
  • Dashboard: /dashboard
  • Budget optimizer: /optimize
  • Meridian AI: /agent

(If you attach a production domain on Vercel, replace this URL with your main domain.)


Live app & deployments

What Link
GitHub repository github.com/Atharva309/Meridian
Production / preview frontend (example) Optimize page on Vercel
Vercel project · deployment overview vercel.com — meridian deployment
Hugging Face Space (FastAPI backend) Spaces · atharva9/meridian-api
HF Space · settings (secrets, repo, hardware) Space settings

Your main Vercel URL may also be https://meridian-<team>.vercel.app from the Domains panel; preview deployments use URLs like meridian-<hash>-<team>.vercel.app.

Backend API base (hosted on Hugging Face):

https://atharva9-meridian-api.hf.space/api

Swagger docs (when enabled): https://atharva9-meridian-api.hf.space/docs


Architecture

┌─────────────────┐      HTTPS JSON / multipart       ┌──────────────────────────┐
│  Vercel (Vite + │  ─────────────────────────────►  │  Hugging Face Space       │
│  React SPA)      │       VITE_API_BASE_URL=/api      │  FastAPI + uvicorn       │
└─────────────────┘                                   │  pandas / sklearn / scipy │
                                                      └──────────────────────────┘
                                                                     │
                                                                     ▼
                                                            OPENAI_API_KEY (secret)
                                                            for Meridian AI agent
                                                            & optional optimize copy
  • Frontend: React 18, TypeScript, Vite, Tailwind-style shell, Chart.js / Recharts, Zustand.
  • Backend: FastAPI; routes mounted under /api; statistical MMM utilities, SciPy optimizer for budget allocation.
  • Hosting: Frontend on Vercel; backend Docker image built from repo root Dockerfile on Hugging Face Spaces.

Repository layout

Meridian/
├── Dockerfile              # HF Space: builds backend (port 7860)
├── .dockerignore
├── README.md
├── backend/
│   ├── app/
│   │   ├── main.py         # FastAPI app, CORS, router prefix /api
│   │   ├── routes/api.py   # REST endpoints
│   │   └── services/       # MMM, optimizer, agent, insights
│   ├── requirements.txt
│   └── tests/
├── data/                   # Bundled sample CSVs for demos
└── frontend/
    ├── src/
    │   ├── pages/          # Configure, Dashboard, Optimize, Agent
    │   ├── api/client.ts   # API base URL + fetch helpers
    │   └── …
    ├── vercel.json         # SPA rewrite → index.html
    └── package.json

Features (high level)

  1. Configure — Upload CSV (or sample datasets), map columns, set priors / saturation / adstock, run the model, save named runs.
  2. Dashboard — Explore spend vs contribution, ROI, rankings, filters, and windowing.
  3. Optimize — Fixed weekly budget; recommends channel spend split using concave ROI curves and min/max share caps; compares “current” vs “recommended.”
  4. Meridian AI — Chat agent that calls backend tools over your saved run context (requires OPENAI_API_KEY on the server).

Local development

Backend

cd backend
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
export OPENAI_API_KEY="sk-..."   # optional: agent + LLM insights
uvicorn app.main:app --reload --reload-dir app --host 127.0.0.1 --port 8000

API lives at http://127.0.0.1:8000/api.

Frontend

cd frontend
npm install

Create frontend/.env.local:

VITE_API_BASE_URL=http://127.0.0.1:8000/api
npm run dev

App defaults to port 5173 (see vite.config.ts).


Deploying

Vercel (frontend)

  1. Import this repo; set Root Directory to frontend.
  2. Build: npm run build · Output: dist.
  3. Environment variable VITE_API_BASE_URL = your hosted API base including /api, e.g.
    https://atharva9-meridian-api.hf.space/api
    The client normalizes a missing /api suffix, but setting it explicitly avoids confusion.
  4. Redeploy after env changes (Vite inlines VITE_* at build time).

Hugging Face Spaces (backend)

  1. Space uses Docker with root Dockerfile (copies backend/).
  2. In Space settings, add OPENAI_API_KEY under variables/secrets for Meridian AI.
  3. Connect GitHub if you want automatic rebuilds on push.

Environment variables

Variable Where Purpose
VITE_API_BASE_URL Vercel (Production + Preview) Browser → FastAPI base URL (…/api).
OPENAI_API_KEY Hugging Face Space (secret) OpenAI calls for Meridian AI (and optional text insight).

Never commit real API keys; never expose OPENAI_API_KEY in Vercel public env for a static SPA.


License

Specify a license in the repo if you open-source the project beyond private use.


Author

Deployed by Atharva309 / atharva9 — see links in the table at the top for the live Stack (Vercel + Hugging Face).

About

Mix Marketing Model Helper for Stakeholders

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages