# PROBLEM STATEMENT
## AstraZeneca Cash Flow Forecasting Challenge - Datathon 2025

---

## 🎯 **THE CHALLENGE**

AstraZeneca operates multiple legal entities across regions with:
- **Subscription revenues** (recurring income)
- **Routine vendor payments** (operational expenses)
- **Variable cash timing** due to:
  - Billing cycles
  - Customer payment behavior
  - Periodic operational events

**The Problem:** Finance teams need better visibility and predictability of cash flow to manage liquidity and plan operations.

---

## 📋 **REQUIRED DELIVERABLES**

### 1. **Data Understanding & Transformation**
- Clear explanation of dataset
- Document any transformation steps applied
- Explain data quality issues and how they were handled

### 2. **Dashboard Presentation**
- Visualize cash **inflow** and **outflow**
- Use **AstraZeneca color theme** (highly encouraged)
- Must be **accessible and clearly labeled**
- Use Python for visualization

### 3. **Pattern Analysis**
- Visualize both **actual and forecasted** data
- Identify **trends and patterns** in cash flow
- Explain what drives cash flow variations

### 4. **Forecasting** ⭐ **CORE REQUIREMENT**
**Required:**
- ✅ Predict **weekly net cash flow** for next **6 months** (26 weeks)
- ✅ Predict **weekly ending cash balance** for next **6 months** (26 weeks)
- ✅ Compare forecasted results with actual cash flow

**Suggested Approach:**
- Build **1-month-ahead weekly forecast** first
- Select **at least 2 cash flow categories** to explain:
  - Model choice
  - Model assumptions
  - Key drivers
- Extend to **6-month-ahead weekly forecast**
- Evaluate using appropriate metrics (MAE, RMSE, MAPE, etc.)

### 5. **Anomaly Detection**
Identify irregularities requiring business review:
- **Duplicate transactions**
- **Unusual spikes/drops** in weekly flows
- **Out-of-pattern transactions**

### 6. **Cash Flow Analysis**
Analyze and explain cash flow patterns by category:
- Operating vs Investing vs Financing activities
- **Category-level trends** (use Category Linkage table)
- **Entity-level** and **consolidated views**
- **Short-term liquidity risks**
- **Long-term sustainability patterns**

---

## 🎯 **BUSINESS OBJECTIVES**

The goal is to provide finance teams with:

1. **Reliable short-term visibility** of:
   - Net cash flow
   - Ending cash balances

2. **Simple flags** for irregular transactions requiring investigation

3. **Forecasting models** for cash flow planning

4. **Dashboards** for monitoring cash flow patterns

---

## 📊 **DATA CONTEXT**

### Entities (8 total):
- **TW10** (Taiwan)
- **MY10** (Malaysia)
- **ID10** (Indonesia)
- **KR10** (Korea)
- **PH10** (Philippines)
- **SS10** (Malaysia)
- **TH10** (Thailand)
- **VN20** (Vietnam)

### Historical Data:
- **44 weeks** of historical cash flow (Dec 2024 - Oct 2025)
- **~84,000 transactions** across all entities
- Multiple currencies (converted to USD)
- **25 categories** (AP, AR, Payroll, Tax, Loans, Netting, etc.)

### Forecast Period:
- **26 weeks** (Nov 2025 - Apr 2026)
- **Weekly granularity** required

---

## 🏆 **JUDGING CRITERIA**

| Criterion | Weight | Focus |
|-----------|--------|-------|
| **Data Storytelling** | 30% | Clear problem understanding, effective visualization, originality |
| **Technical** | 40% | Complexity, data handling, analysis depth and accuracy |
| **Recommendation** | 20% | Impact, value, relevance to business objectives |
| **Presentation** | 10% | Professional quality, clear articulation of insights |

**Key Insight:** Judges prefer **VISUALIZATION-FIRST** approach (40% of effort should go to dashboards)

---

## ✅ **WHAT WE'VE DELIVERED**

### ✅ **Data Understanding & Transformation**
- Cleaned 84,529 transactions
- Weekly aggregation (44 weeks)
- Anomaly detection (18,368 flagged)
- Currency conversion to USD
- Entity and category mapping

### ✅ **Forecasting** ⭐
- **Model Selection:** Prophet (best performer)
- **Validation:** Triple-validated (Options A, B1, B2)
- **6-Month Forecast:** `FORECAST_OUTPUT_FINAL.csv` ✅
- **Accuracy:** 60% direction, $1.84M MAE
- **Category Deep-Dive:** AR & AP analysis ✅

### ✅ **Pattern Analysis**
- Time series decomposition
- Autocorrelation analysis
- Category-level trends
- Entity-level patterns

### ✅ **Anomaly Detection**
- Duplicate transaction detection
- Unusual spike/drop identification
- Out-of-pattern flagging

### ✅ **Cash Flow Analysis**
- Category breakdown (AR, AP, Payroll, Tax, etc.)
- Entity-level analysis
- Liquidity risk assessment
- Trend identification

### ✅ **Dashboards** (Visualization-First)
- Model comparison dashboard
- Validation dashboards (Options A, B1, B2)
- Production forecast dashboard
- Category deep-dive dashboards
- Accuracy analysis dashboards
- All using AstraZeneca color theme ✅

---

## 📝 **KEY INSIGHTS FROM OUR SOLUTION**

1. **AR (Accounts Receivable)** drives **85% of inflows**
2. **Netting AP** drives **52% of outflows**
3. **Prophet model** achieves:
   - 60% direction accuracy (better than random 50%)
   - $1.84M average error
   - 30.7% Threshold MAPE (when |actual| > $1M)
4. **6-Month Forecast:**
   - Net Cash Flow: +$5.45M (most likely)
   - Ending Balance: $11.19M (from $9.65M starting)
   - No liquidity risk detected

---

## 🎯 **PROBLEM STATEMENT SUMMARY**

**Challenge:** Predict cash flow for AstraZeneca's multi-entity operations with variable timing due to billing cycles and payment behavior.

**Solution:** Build a Prophet-based forecasting model that:
- Predicts weekly net cash flow and ending balances for 6 months
- Provides confidence intervals and risk assessment
- Analyzes category-level drivers (AR/AP)
- Detects anomalies
- Visualizes patterns and forecasts

**Success Metrics:**
- ✅ 6-month weekly forecast delivered
- ✅ 60% direction accuracy
- ✅ $1.84M average error
- ✅ Comprehensive dashboards
- ✅ Category analysis (AR/AP)

---

**Status:** ✅ **ALL CORE DELIVERABLES COMPLETE**

