> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openfinance-hackathon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hackathon Data Mashups

> High-impact combinations of Open Finance APIs with UAE government data for winning solutions

# Hackathon Data Mashup Ideas

Combine Open Finance APIs with UAE government datasets to create innovative, locally-relevant solutions that impress judges.

<Warning>
  **Aspirational Examples - Not Hackathon Requirements**

  These mashup concepts demonstrate the **potential** of combining Open Finance with government data. They are:

  **Inspirational, Not Required:**

  * Show what's possible with data combinations
  * NOT expected deliverables for a hackathon
  * Production-scale applications, not 48-hour MVPs

  **Complexity Considerations:**

  * Each example is far more complex than needed for a hackathon demo
  * Requires multiple external APIs that may be unavailable or unreliable
  * Budget claims (e.g., "20% reduction") are **illustrative/hypothetical**, not verified

  **Hackathon Strategy:**

  * **Pick ONE feature** from ONE mashup concept
  * **Build a simple MVP** demonstrating the core value
  * **Focus on demo-able functionality**, not complete production systems
  * **Have backup plans** if external data sources are unavailable

  **Best Practice**: Start simple, focus on demonstrating value, and use these as inspiration rather than blueprints. Judges reward working demos over ambitious ideas.
</Warning>

<Info>
  **🏆 Winning Formula**: Open Finance APIs + Government Data + Smart Implementation = Hackathon Success
</Info>

## Featured Mashup Concepts

These six high-impact combinations have been proven to win hackathons by addressing real UAE market needs.

## 1. 🌿 ESG PFM Coach

**Personalized sustainability advisor using spending patterns and environmental data**

### Data Sources

* **Open Finance**: Card transactions, merchant categories, spending patterns
* **Government Data**:
  * EAD air quality indices
  * DEWA energy consumption statistics
  * RTA public transport data

### Implementation

<Tabs>
  <Tab title="Architecture">
    ```mermaid theme={null}
    graph LR
      A[Card Transactions] --> B[Category Analysis]
      C[Air Quality API] --> D[Environmental Score]
      E[DEWA Energy Data] --> D
      B --> F[ESG Dashboard]
      D --> F
      F --> G[Personalized Recommendations]
    ```
  </Tab>

  <Tab title="Core Code">
    ```javascript theme={null}
    class ESGCoach {
      constructor(openFinanceAPI, governmentAPIs) {
        this.finance = openFinanceAPI;
        this.airQuality = governmentAPIs.ead;
        this.energy = governmentAPIs.dewa;
      }

      async calculateESGScore(userId, period = 30) {
        // Get user's transactions
        const transactions = await this.finance.getTransactions(userId, period);

        // Analyze carbon footprint
        const carbonScore = await this.analyzeCarbonFootprint(transactions);

        // Get local environmental data
        const airQuality = await this.airQuality.getCurrentAQI();
        const energyTrends = await this.energy.getConsumptionTrends();

        // Calculate comprehensive ESG score
        return {
          overall: this.calculateOverallScore(carbonScore, airQuality),
          breakdown: {
            transport: this.analyzeTransportSpending(transactions),
            energy: this.analyzeEnergyUsage(transactions, energyTrends),
            consumption: this.analyzeConsumptionPatterns(transactions)
          },
          recommendations: this.generateRecommendations(carbonScore)
        };
      }

      async analyzeCarbonFootprint(transactions) {
        const categories = {
          'FUEL': { carbon: 2.3, weight: 0.3 }, // kg CO2 per AED
          'AIRLINES': { carbon: 1.8, weight: 0.2 },
          'RESTAURANTS': { carbon: 0.5, weight: 0.1 },
          'GROCERIES': { carbon: 0.3, weight: 0.1 },
          'PUBLIC_TRANSPORT': { carbon: -0.5, weight: 0.2 } // Negative = good
        };

        let totalCarbon = 0;
        let totalSpend = 0;

        transactions.forEach(tx => {
          const category = categories[tx.merchantCategory];
          if (category) {
            totalCarbon += tx.amount * category.carbon;
            totalSpend += tx.amount;
          }
        });

        return {
          totalCarbon,
          carbonPerAED: totalCarbon / totalSpend,
          rating: this.getCarbonRating(totalCarbon)
        };
      }

      generateRecommendations(carbonScore) {
        const recommendations = [];

        if (carbonScore.totalCarbon > 100) {
          recommendations.push({
            priority: 'HIGH',
            action: 'Switch to public transport 2 days per week',
            impact: 'Save 20kg CO2/month and AED 200',
            incentive: 'Earn 2% cashback on RTA payments'
          });
        }

        if (carbonScore.categories.energy > 50) {
          recommendations.push({
            priority: 'MEDIUM',
            action: 'Enroll in DEWA green tariff program',
            impact: 'Support renewable energy',
            incentive: 'Fixed rate protection for 12 months'
          });
        }

        return recommendations;
      }
    }

    // Usage
    const coach = new ESGCoach(openFinanceAPI, { ead, dewa });
    const esgReport = await coach.calculateESGScore('user123', 30);
    ```
  </Tab>

  <Tab title="UI Components">
    ```jsx theme={null}
    function ESGDashboard({ esgData }) {
      return (
        <div className="esg-dashboard">
          <ScoreCard
            score={esgData.overall}
            trend={esgData.trend}
            benchmark="UAE Average"
          />

          <CarbonFootprint
            data={esgData.breakdown}
            comparison={nationalAverage}
          />

          <AirQualityMap
            currentAQI={esgData.airQuality}
            userLocation={esgData.location}
          />

          <Recommendations
            items={esgData.recommendations}
            onAccept={handleAcceptRecommendation}
          />

          <ImpactTracker
            savedCarbon={esgData.savedCarbon}
            savedMoney={esgData.savedMoney}
          />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Expected Outcomes

* Help users **reduce their carbon footprint** through informed spending choices
* Encourage **energy-conscious decisions** that can lower spending
* **Gamified experience** with rewards for sustainable choices
* **Social sharing** of achievements and green scores

***

## 2. 🏠 Rent-to-Income & Move Advisor

**Smart housing affordability analyzer with commute optimization**

### Data Sources

* **Open Finance**: Income data, current expenses, savings patterns
* **Government Data**:
  * DLD property transactions and rental data
  * RTA commute times and costs
  * DEWA utility averages by area

### Implementation

<Tabs>
  <Tab title="Core Algorithm">
    ```javascript theme={null}
    class MoveAdvisor {
      constructor(apis) {
        this.finance = apis.openFinance;
        this.property = apis.dld;
        this.transport = apis.rta;
        this.utilities = apis.dewa;
      }

      async findOptimalHousing(userId, workLocation) {
        // Get user's financial profile
        const profile = await this.getFinancialProfile(userId);

        // Calculate affordable rent (30% rule)
        const maxRent = profile.monthlyIncome * 0.3;

        // Get available properties
        const properties = await this.property.searchRentals({
          maxPrice: maxRent * 12,
          bedrooms: profile.familySize > 2 ? 2 : 1
        });

        // Score each property
        const scoredProperties = await Promise.all(
          properties.map(async (property) => {
            const score = await this.scoreProperty(
              property,
              profile,
              workLocation
            );
            return { ...property, score };
          })
        );

        return scoredProperties
          .sort((a, b) => b.score.total - a.score.total)
          .slice(0, 10);
      }

      async scoreProperty(property, profile, workLocation) {
        // Calculate commute score
        const commute = await this.transport.getCommute(
          property.location,
          workLocation
        );

        const commuteScore = this.calculateCommuteScore(
          commute.time,
          commute.cost,
          profile.monthlyIncome
        );

        // Calculate affordability score
        const totalMonthlyCost =
          property.monthlyRent +
          commute.cost * 22 + // Working days
          (await this.utilities.getAverageBill(property.area, property.size));

        const affordabilityScore =
          100 - (totalMonthlyCost / profile.monthlyIncome) * 100;

        // Calculate lifestyle score
        const amenities = await this.getAreaAmenities(property.area);
        const lifestyleScore = this.calculateLifestyleScore(
          amenities,
          profile.preferences
        );

        return {
          total: (commuteScore + affordabilityScore + lifestyleScore) / 3,
          breakdown: {
            commute: commuteScore,
            affordability: affordabilityScore,
            lifestyle: lifestyleScore
          },
          monthlyCost: totalMonthlyCost,
          savings: profile.currentRent - property.monthlyRent
        };
      }

      calculateCommuteScore(time, cost, income) {
        // Ideal: < 30 min, < 5% of income
        const timeScore = Math.max(0, 100 - (time - 30) * 2);
        const costScore = Math.max(0, 100 - (cost / income) * 2000);
        return (timeScore + costScore) / 2;
      }

      async getAreaAmenities(area) {
        // Get nearby facilities from government data
        const [schools, healthcare, retail, parks] = await Promise.all([
          this.getSchools(area),
          this.getHealthcare(area),
          this.getRetail(area),
          this.getParks(area)
        ]);

        return { schools, healthcare, retail, parks };
      }
    }

    // Usage
    const advisor = new MoveAdvisor({ openFinance, dld, rta, dewa });
    const recommendations = await advisor.findOptimalHousing(
      'user123',
      'DIFC'
    );
    ```
  </Tab>

  <Tab title="Visualization">
    ```jsx theme={null}
    function HousingMap({ properties, userProfile }) {
      const mapRef = useRef(null);

      useEffect(() => {
        const map = new mapboxgl.Map({
          container: mapRef.current,
          style: 'mapbox://styles/mapbox/light-v10',
          center: [55.2708, 25.2048], // Dubai
          zoom: 11
        });

        // Add property markers
        properties.forEach(property => {
          const el = document.createElement('div');
          el.className = 'property-marker';
          el.style.backgroundColor = getScoreColor(property.score.total);

          new mapboxgl.Marker(el)
            .setLngLat([property.lng, property.lat])
            .setPopup(createPropertyPopup(property))
            .addTo(map);
        });

        // Add commute lines
        properties.slice(0, 3).forEach(property => {
          map.addLayer({
            id: `route-${property.id}`,
            type: 'line',
            source: {
              type: 'geojson',
              data: {
                type: 'Feature',
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [property.lng, property.lat],
                    [userProfile.workLng, userProfile.workLat]
                  ]
                }
              }
            },
            paint: {
              'line-color': getScoreColor(property.score.commute),
              'line-width': 3,
              'line-opacity': 0.7
            }
          });
        });
      }, [properties]);

      return <div ref={mapRef} className="housing-map" />;
    }
    ```
  </Tab>

  <Tab title="Decision Matrix">
    ```javascript theme={null}
    class DecisionMatrix {
      generateReport(properties, profile) {
        return {
          recommendations: properties.map(p => ({
            address: p.address,
            area: p.area,
            rent: p.monthlyRent,
            totalMonthlyCost: p.score.monthlyCost,
            savingsVsCurrent: p.score.savings,
            commuteTime: p.commute.time,
            walkScore: p.amenities.walkScore,
            pros: this.generatePros(p, profile),
            cons: this.generateCons(p, profile),
            verdict: this.generateVerdict(p, profile)
          })),
          insights: {
            optimalBudget: this.calculateOptimalBudget(profile),
            bestAreas: this.identifyBestAreas(properties),
            tradeoffs: this.analyzeTradeoffs(properties, profile)
          }
        };
      }

      generatePros(property, profile) {
        const pros = [];

        if (property.score.affordability > 80) {
          pros.push(`Saves AED ${property.score.savings}/month vs current`);
        }

        if (property.commute.time < 20) {
          pros.push(`Only ${property.commute.time} min to work`);
        }

        if (property.amenities.schools?.length > 3) {
          pros.push(`${property.amenities.schools.length} schools nearby`);
        }

        return pros;
      }

      analyzeTradeoffs(properties, profile) {
        // Find properties that optimize different factors
        const cheapest = properties.sort((a, b) => a.rent - b.rent)[0];
        const closest = properties.sort(
          (a, b) => a.commute.time - b.commute.time
        )[0];
        const bestValue = properties.sort(
          (a, b) => b.score.total - a.score.total
        )[0];

        return {
          saveMoney: {
            property: cheapest,
            monthlySavings: profile.currentRent - cheapest.monthlyRent,
            tradeoff: `${closest.commute.time - cheapest.commute.time} min longer commute`
          },
          saveTime: {
            property: closest,
            timeSaved: `${profile.currentCommute - closest.commute.time} min/day`,
            tradeoff: `AED ${closest.monthlyRent - cheapest.monthlyRent} more/month`
          },
          balanced: {
            property: bestValue,
            reasoning: 'Best combination of price, location, and amenities'
          }
        };
      }
    }
    ```
  </Tab>
</Tabs>

### Expected Outcomes

* **Smart recommendations** based on total cost of living
* **Commute optimization** saving 10+ hours per month
* **Lifestyle matching** using amenity data
* **Financial projections** for each housing option

***

## 3. 📊 SME Risk & Growth Radar

**Intelligent business analytics combining financial and market data**

### Data Sources

* **Open Finance**: Business accounts, cash flow, transaction patterns
* **Government Data**:
  * DED business licenses and sector data
  * DET tourism demand by segment
  * FCSC economic indicators
  * DLD commercial property data

### Implementation

<Tabs>
  <Tab title="Risk Engine">
    ```javascript theme={null}
    class SMERiskEngine {
      constructor(apis) {
        this.finance = apis.openFinance;
        this.ded = apis.dedBusinessData;
        this.tourism = apis.detTourism;
        this.economy = apis.fcscEconomy;
      }

      async analyzeBusinessRisk(businessId) {
        // Get financial health
        const financials = await this.getFinancialMetrics(businessId);

        // Get market context
        const market = await this.getMarketContext(
          financials.sector,
          financials.location
        );

        // Calculate risk scores
        const riskScores = {
          financial: this.calculateFinancialRisk(financials),
          market: this.calculateMarketRisk(market),
          operational: this.calculateOperationalRisk(financials, market),
          external: this.calculateExternalRisk(market)
        };

        // Generate insights and recommendations
        const insights = this.generateInsights(riskScores, financials, market);
        const opportunities = await this.identifyOpportunities(
          financials,
          market
        );

        return {
          overallRisk: this.calculateOverallRisk(riskScores),
          breakdown: riskScores,
          insights,
          opportunities,
          alerts: this.generateAlerts(riskScores)
        };
      }

      async getFinancialMetrics(businessId) {
        const account = await this.finance.getBusinessAccount(businessId);
        const transactions = await this.finance.getTransactions(
          businessId,
          90
        );

        // Calculate key metrics
        const metrics = {
          monthlyRevenue: this.calculateMonthlyRevenue(transactions),
          monthlyExpenses: this.calculateMonthlyExpenses(transactions),
          cashFlow: this.analyzeCashFlow(transactions),
          burnRate: this.calculateBurnRate(account.balance, transactions),
          runway: this.calculateRunway(account.balance, transactions),
          customerConcentration: this.analyzeCustomerConcentration(
            transactions
          ),
          paymentDelays: this.analyzePaymentDelays(transactions),
          seasonality: this.detectSeasonality(transactions)
        };

        return {
          ...metrics,
          sector: account.sector,
          location: account.location,
          accountAge: account.age
        };
      }

      async getMarketContext(sector, location) {
        // Get competitor density
        const competitors = await this.ded.searchBusinesses({
          sector,
          area: location,
          status: 'active'
        });

        // Get tourism impact if relevant
        const tourismData =
          this.isTourismRelated(sector)
            ? await this.tourism.getVisitorStats()
            : null;

        // Get economic indicators
        const economy = await this.economy.getIndicators();

        // Get commercial property trends
        const propertyData = await this.getPropertyTrends(location);

        return {
          competitorCount: competitors.length,
          marketSaturation: competitors.length / 1000, // per 1000 population
          tourismTrend: tourismData?.trend || 'stable',
          economicOutlook: economy.gdpGrowth > 2 ? 'positive' : 'cautious',
          rentTrend: propertyData.trend,
          demandIndicators: this.calculateDemandIndicators(
            sector,
            tourismData,
            economy
          )
        };
      }

      calculateFinancialRisk(financials) {
        let score = 100; // Start with perfect score

        // Cash flow issues
        if (financials.cashFlow.trend === 'negative') score -= 25;
        if (financials.runway < 6) score -= 20; // Less than 6 months runway

        // Customer concentration risk
        if (financials.customerConcentration > 0.5) score -= 15; // 50%+ from one customer

        // Payment delays
        if (financials.paymentDelays.average > 45) score -= 10; // 45+ days average

        // High burn rate
        if (financials.burnRate > financials.monthlyRevenue * 0.8) score -= 15;

        return Math.max(0, score);
      }

      async identifyOpportunities(financials, market) {
        const opportunities = [];

        // Working capital opportunity
        if (financials.paymentDelays.average > 30) {
          opportunities.push({
            type: 'WORKING_CAPITAL',
            title: 'Invoice Financing Available',
            description: `Convert your AED ${financials.paymentDelays.outstanding} outstanding invoices to immediate cash`,
            value: financials.paymentDelays.outstanding * 0.9,
            action: 'Apply for invoice financing'
          });
        }

        // Growth opportunity
        if (market.tourismTrend === 'growing' && financials.cashFlow.trend === 'positive') {
          opportunities.push({
            type: 'EXPANSION',
            title: 'Tourism Sector Growth Detected',
            description: 'Tourist arrivals up 15% YoY - perfect time to expand',
            value: financials.monthlyRevenue * 0.2, // Potential 20% growth
            action: 'Apply for growth capital'
          });
        }

        // Cost optimization
        if (financials.monthlyExpenses > market.sectorAverage * 1.2) {
          opportunities.push({
            type: 'OPTIMIZATION',
            title: 'Cost Reduction Opportunity',
            description: 'Your expenses are 20% above sector average',
            value: financials.monthlyExpenses * 0.15,
            action: 'View cost optimization report'
          });
        }

        return opportunities;
      }

      generateAlerts(riskScores) {
        const alerts = [];

        if (riskScores.financial < 50) {
          alerts.push({
            severity: 'HIGH',
            message: 'Cash flow requires immediate attention',
            action: 'Review financial health report'
          });
        }

        if (riskScores.market < 60) {
          alerts.push({
            severity: 'MEDIUM',
            message: 'Market conditions changing',
            action: 'Adjust business strategy'
          });
        }

        return alerts;
      }
    }
    ```
  </Tab>

  <Tab title="Predictive Models">
    ```javascript theme={null}
    class SMEPredictiveAnalytics {
      constructor(historicalData) {
        this.data = historicalData;
        this.models = this.trainModels();
      }

      trainModels() {
        return {
          revenue: this.trainRevenueModel(),
          churn: this.trainChurnModel(),
          default: this.trainDefaultModel()
        };
      }

      async predictNextQuarter(businessId) {
        const features = await this.extractFeatures(businessId);

        return {
          revenue: {
            forecast: this.models.revenue.predict(features),
            confidence: this.models.revenue.confidence,
            factors: this.identifyKeyFactors(features, 'revenue')
          },
          churnRisk: {
            probability: this.models.churn.predict(features),
            riskLevel: this.getRiskLevel(this.models.churn.predict(features)),
            preventionActions: this.getChurnPrevention(features)
          },
          defaultRisk: {
            probability: this.models.default.predict(features),
            earlyWarnings: this.identifyEarlyWarnings(features)
          }
        };
      }

      async extractFeatures(businessId) {
        // Combine multiple data sources for feature engineering
        const [financial, market, seasonal, external] = await Promise.all([
          this.getFinancialFeatures(businessId),
          this.getMarketFeatures(businessId),
          this.getSeasonalFeatures(businessId),
          this.getExternalFeatures(businessId)
        ]);

        return {
          ...financial,
          ...market,
          ...seasonal,
          ...external,
          interactionFeatures: this.createInteractionFeatures(
            financial,
            market
          )
        };
      }

      identifyKeyFactors(features, target) {
        // Use feature importance from model
        const importance = this.models[target].featureImportance;

        return Object.entries(importance)
          .sort(([, a], [, b]) => b - a)
          .slice(0, 5)
          .map(([feature, score]) => ({
            factor: this.humanizeFeatureName(feature),
            impact: score,
            currentValue: features[feature],
            recommendation: this.getFeatureRecommendation(feature, features[feature])
          }));
      }

      getChurnPrevention(features) {
        const actions = [];

        if (features.daysSinceLastTransaction > 30) {
          actions.push({
            priority: 'HIGH',
            action: 'Engagement campaign',
            expectedImpact: 'Reduce churn risk by 25%'
          });
        }

        if (features.supportTickets > 3) {
          actions.push({
            priority: 'HIGH',
            action: 'Priority support intervention',
            expectedImpact: 'Improve satisfaction by 40%'
          });
        }

        if (features.utilizationRate < 0.3) {
          actions.push({
            priority: 'MEDIUM',
            action: 'Feature education program',
            expectedImpact: 'Increase usage by 50%'
          });
        }

        return actions;
      }
    }
    ```
  </Tab>

  <Tab title="Dashboard UI">
    ```jsx theme={null}
    function SMERiskDashboard({ businessId }) {
      const [riskData, setRiskData] = useState(null);
      const [predictions, setPredictions] = useState(null);

      useEffect(() => {
        async function loadData() {
          const [risk, forecast] = await Promise.all([
            riskEngine.analyzeBusinessRisk(businessId),
            predictiveAnalytics.predictNextQuarter(businessId)
          ]);
          setRiskData(risk);
          setPredictions(forecast);
        }
        loadData();
      }, [businessId]);

      return (
        <div className="sme-dashboard">
          <RiskGauge
            score={riskData?.overallRisk}
            breakdown={riskData?.breakdown}
          />

          <AlertBanner alerts={riskData?.alerts} />

          <div className="metrics-grid">
            <RevenueChart
              historical={riskData?.financials}
              forecast={predictions?.revenue}
            />

            <CashFlowProjection
              current={riskData?.financials?.cashFlow}
              runway={riskData?.financials?.runway}
            />

            <MarketInsights
              competitors={riskData?.market?.competitorCount}
              tourismTrend={riskData?.market?.tourismTrend}
            />

            <OpportunityCards
              opportunities={riskData?.opportunities}
              onAction={handleOpportunityAction}
            />
          </div>

          <PredictiveInsights predictions={predictions} />

          <ActionPlan
            risks={riskData}
            predictions={predictions}
            onImplement={handleActionImplementation}
          />
        </div>
      );
    }

    function RiskGauge({ score, breakdown }) {
      const getColor = (score) => {
        if (score >= 80) return '#10b981'; // Green
        if (score >= 60) return '#f59e0b'; // Orange
        return '#ef4444'; // Red
      };

      return (
        <div className="risk-gauge">
          <CircularProgress
            value={score}
            color={getColor(score)}
            size={200}
            strokeWidth={15}
          >
            <div className="score-label">
              <span className="score">{score}</span>
              <span className="label">Risk Score</span>
            </div>
          </CircularProgress>

          <div className="breakdown">
            {Object.entries(breakdown).map(([category, value]) => (
              <div key={category} className="risk-category">
                <span>{category}</span>
                <ProgressBar value={value} color={getColor(value)} />
              </div>
            ))}
          </div>
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Expected Outcomes

* **Early warning system** for cash flow issues
* **Growth opportunities** identified from market data
* **Risk-adjusted lending** recommendations
* **Automated alerts** for critical business events

***

## 4. 🚗 Safe-Drive Insurance Discounts

**Dynamic insurance pricing based on driving behavior and risk factors**

### Data Sources

* **Open Finance**: Fuel spending, auto maintenance, parking payments
* **Government Data**:
  * Dubai Police traffic incident hotspots
  * NCM weather data
  * RTA traffic flow data

### Implementation

<Tabs>
  <Tab title="Risk Scoring">
    ```javascript theme={null}
    class DrivingRiskAnalyzer {
      constructor(apis) {
        this.finance = apis.openFinance;
        this.traffic = apis.dubaiPolice;
        this.weather = apis.ncm;
        this.transport = apis.rta;
      }

      async calculateDrivingRisk(userId, vehicleId) {
        // Analyze driving patterns from financial data
        const drivingProfile = await this.analyzeDrivingPatterns(userId);

        // Get contextual risk factors
        const riskFactors = await this.getRiskFactors(drivingProfile);

        // Calculate comprehensive risk score
        const riskScore = this.computeRiskScore(drivingProfile, riskFactors);

        // Generate insurance recommendations
        const insurance = this.generateInsuranceOptions(riskScore);

        return {
          riskScore,
          profile: drivingProfile,
          factors: riskFactors,
          insurance,
          savings: this.calculatePotentialSavings(riskScore)
        };
      }

      async analyzeDrivingPatterns(userId) {
        const transactions = await this.finance.getTransactions(userId, 180);

        // Extract driving-related spending
        const fuelSpending = transactions.filter(t =>
          t.category === 'FUEL'
        );

        const parkingPayments = transactions.filter(t =>
          t.merchant.includes('RTA') || t.category === 'PARKING'
        );

        const maintenance = transactions.filter(t =>
          t.category === 'AUTO_MAINTENANCE'
        );

        // Analyze patterns
        return {
          monthlyMileage: this.estimateMileage(fuelSpending),
          drivingFrequency: this.analyzeDrivingFrequency(fuelSpending),
          preferredTimes: this.analyzePreferredTimes(parkingPayments),
          maintenanceScore: this.scoreMaintenanceHabits(maintenance),
          areas: this.identifyFrequentAreas(parkingPayments)
        };
      }

      async getRiskFactors(profile) {
        // Get incident data for frequent areas
        const incidentRisk = await this.calculateAreaRisk(profile.areas);

        // Get weather risk factors
        const weatherRisk = await this.calculateWeatherRisk(
          profile.preferredTimes
        );

        // Get traffic congestion risk
        const congestionRisk = await this.calculateCongestionRisk(
          profile.areas,
          profile.preferredTimes
        );

        return {
          areaRisk: incidentRisk,
          weatherRisk,
          congestionRisk,
          timeRisk: this.calculateTimeRisk(profile.preferredTimes)
        };
      }

      async calculateAreaRisk(areas) {
        const risks = await Promise.all(
          areas.map(async (area) => {
            const incidents = await this.traffic.getIncidents({
              area: area.name,
              period: 'last_year'
            });

            return {
              area: area.name,
              frequency: area.frequency,
              incidentRate: incidents.length / 365,
              severity: this.calculateAverageSeverity(incidents),
              risk: this.computeAreaRisk(incidents, area.frequency)
            };
          })
        );

        return {
          overall: this.aggregateAreaRisk(risks),
          breakdown: risks
        };
      }

      computeRiskScore(profile, factors) {
        const weights = {
          mileage: 0.2,
          areas: 0.3,
          time: 0.15,
          weather: 0.1,
          maintenance: 0.15,
          congestion: 0.1
        };

        // Normalize factors to 0-100 scale
        const normalized = {
          mileage: this.normalizeMileageRisk(profile.monthlyMileage),
          areas: factors.areaRisk.overall,
          time: factors.timeRisk,
          weather: factors.weatherRisk,
          maintenance: 100 - profile.maintenanceScore, // Inverse
          congestion: factors.congestionRisk
        };

        // Calculate weighted score
        const score = Object.entries(weights).reduce((total, [key, weight]) => {
          return total + normalized[key] * weight;
        }, 0);

        return {
          overall: Math.round(100 - score), // Higher score = lower risk
          components: normalized
        };
      }

      generateInsuranceOptions(riskScore) {
        const baseRate = 3000; // Base annual premium in AED

        // Calculate discount based on risk score
        const discount = Math.max(0, (riskScore.overall - 50) * 0.01); // 1% per point above 50

        const options = [
          {
            type: 'COMPREHENSIVE',
            baseRate,
            discount: discount * baseRate,
            finalRate: baseRate * (1 - discount),
            features: ['Full coverage', 'Zero depreciation', 'Roadside assistance']
          },
          {
            type: 'THIRD_PARTY_PLUS',
            baseRate: baseRate * 0.6,
            discount: discount * baseRate * 0.6,
            finalRate: baseRate * 0.6 * (1 - discount),
            features: ['Third party', 'Fire & theft', 'Personal accident']
          },
          {
            type: 'PAY_AS_YOU_DRIVE',
            baseRate: baseRate * 0.4,
            perKm: 0.5,
            estimatedAnnual: this.calculatePayAsYouDrive(
              baseRate * 0.4,
              riskScore,
              12000 // Average annual km
            ),
            features: ['Usage-based', 'Real-time tracking', 'Behavior rewards']
          }
        ];

        return options.map(option => ({
          ...option,
          monthlyPremium: option.finalRate ? option.finalRate / 12 : option.estimatedAnnual / 12,
          savingsVsMarket: this.calculateMarketSavings(option.finalRate || option.estimatedAnnual)
        }));
      }
    }
    ```
  </Tab>

  <Tab title="Real-time Monitoring">
    ```javascript theme={null}
    class RealTimeDrivingMonitor {
      constructor(userId) {
        this.userId = userId;
        this.session = null;
        this.alerts = [];
      }

      startMonitoring() {
        this.session = {
          startTime: new Date(),
          alerts: [],
          score: 100
        };

        // Monitor real-time conditions
        this.monitorWeather();
        this.monitorTraffic();
        this.monitorDrivingTime();

        return this.session;
      }

      async monitorWeather() {
        const weather = await this.getWeatherConditions();

        if (weather.visibility < 1000) {
          this.addAlert({
            type: 'WEATHER',
            severity: 'HIGH',
            message: 'Low visibility detected - reduce speed',
            impact: -5
          });
        }

        if (weather.rainfall > 10) {
          this.addAlert({
            type: 'WEATHER',
            severity: 'MEDIUM',
            message: 'Heavy rain - increase following distance',
            impact: -3
          });
        }
      }

      async monitorTraffic() {
        const location = await this.getCurrentLocation();
        const incidents = await this.getNearbyIncidents(location);

        incidents.forEach(incident => {
          if (this.calculateDistance(location, incident) < 1) {
            this.addAlert({
              type: 'TRAFFIC',
              severity: 'HIGH',
              message: `Accident ahead on ${incident.road}`,
              impact: -10,
              action: 'Consider alternative route'
            });
          }
        });
      }

      monitorDrivingTime() {
        const hour = new Date().getHours();

        if (hour >= 22 || hour < 6) {
          this.addAlert({
            type: 'TIME',
            severity: 'LOW',
            message: 'Night driving detected',
            impact: -2,
            tip: 'Ensure headlights are clean'
          });
        }

        if ([7, 8, 17, 18, 19].includes(hour)) {
          this.addAlert({
            type: 'TIME',
            severity: 'MEDIUM',
            message: 'Peak hour traffic',
            impact: -3,
            tip: 'Allow extra time for journey'
          });
        }
      }

      addAlert(alert) {
        this.alerts.push({
          ...alert,
          timestamp: new Date()
        });

        this.session.score += alert.impact;

        // Send push notification for high severity
        if (alert.severity === 'HIGH') {
          this.sendPushNotification(alert);
        }
      }

      async endSession() {
        const duration = (new Date() - this.session.startTime) / 1000 / 60; // minutes

        return {
          duration,
          finalScore: Math.max(0, this.session.score),
          alerts: this.alerts,
          rewards: this.calculateRewards(this.session.score),
          tips: this.generateDrivingTips(this.alerts)
        };
      }

      calculateRewards(score) {
        const rewards = [];

        if (score >= 95) {
          rewards.push({
            type: 'DISCOUNT',
            value: '5% off next month premium',
            code: 'SAFE95'
          });
        }

        if (score >= 90) {
          rewards.push({
            type: 'POINTS',
            value: 100,
            description: 'Safe driving points'
          });
        }

        return rewards;
      }
    }
    ```
  </Tab>

  <Tab title="Insurance Dashboard">
    ```jsx theme={null}
    function InsuranceDashboard({ userId }) {
      const [riskData, setRiskData] = useState(null);
      const [monitoring, setMonitoring] = useState(false);
      const [currentSession, setCurrentSession] = useState(null);

      return (
        <div className="insurance-dashboard">
          <SafetyScore score={riskData?.riskScore?.overall} />

          <div className="risk-factors">
            <RiskFactorCard
              title="Driving Areas"
              score={riskData?.factors?.areaRisk?.overall}
              details={riskData?.factors?.areaRisk?.breakdown}
            />

            <RiskFactorCard
              title="Time Patterns"
              score={riskData?.factors?.timeRisk}
              recommendation="Avoid peak hours when possible"
            />

            <RiskFactorCard
              title="Maintenance"
              score={riskData?.profile?.maintenanceScore}
              nextService={riskData?.profile?.nextServiceDue}
            />
          </div>

          <InsuranceOptions options={riskData?.insurance} />

          <DrivingMonitor
            active={monitoring}
            session={currentSession}
            onStart={() => startMonitoring()}
            onEnd={() => endMonitoring()}
          />

          <SafetyTips
            based on={riskData?.factors}
            personalized={true}
          />

          <ClaimsHistory userId={userId} />

          <RewardsTracker
            points={riskData?.rewards?.points}
            badges={riskData?.rewards?.badges}
            discounts={riskData?.rewards?.discounts}
          />
        </div>
      );
    }

    function InsuranceOptions({ options }) {
      return (
        <div className="insurance-options">
          {options?.map(option => (
            <div key={option.type} className="option-card">
              <h3>{option.type}</h3>
              <div className="pricing">
                <span className="original">
                  AED {option.baseRate}/year
                </span>
                <span className="discounted">
                  AED {option.finalRate}/year
                </span>
                <span className="savings">
                  Save AED {option.discount}
                </span>
              </div>
              <ul className="features">
                {option.features.map(feature => (
                  <li key={feature}>{feature}</li>
                ))}
              </ul>
              <button className="select-plan">
                Select Plan
              </button>
            </div>
          ))}
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Expected Outcomes

* Potential **insurance premium discounts** for safe driving behavior
* **Real-time safety alerts** during driving
* **Gamified safe driving** with rewards
* **Predictive maintenance** reminders

***

## 5. ✈️ Travel FX & Rewards Optimizer

**Smart travel spending advisor with FX optimization**

### Data Sources

* **Open Finance**: Card transaction history, spending patterns
* **Government Data**:
  * DET visitor origin statistics
  * CBUAE exchange rates
  * Tourism events calendar

### Implementation

```javascript theme={null}
class TravelOptimizer {
  async optimizeTravelSpending(userId, destination, dates) {
    // Analyze historical spending
    const spendingPatterns = await this.analyzeUserSpending(userId);

    // Get destination insights
    const destinationData = await this.getDestinationInsights(destination);

    // FX optimization
    const fxStrategy = await this.optimizeFXStrategy(
      destination.currency,
      dates,
      spendingPatterns.averageSpend
    );

    // Card recommendations
    const cards = await this.recommendCards(destination, spendingPatterns);

    return {
      budget: this.calculateBudget(spendingPatterns, destinationData),
      fxStrategy,
      cards,
      savings: this.estimateSavings(fxStrategy, cards)
    };
  }

  async optimizeFXStrategy(currency, dates, amount) {
    // Get historical rates
    const rates = await this.cbuae.getExchangeRates(currency, 90);

    // Predict optimal exchange timing
    const prediction = this.predictRates(rates, dates);

    return {
      currentRate: rates[rates.length - 1],
      predictedRate: prediction.rate,
      recommendation: prediction.rate < rates[rates.length - 1]
        ? 'Exchange now'
        : `Wait until ${prediction.optimalDate}`,
      savingsEstimate: Math.abs(prediction.rate - rates[rates.length - 1]) * amount
    };
  }
}
```

### Expected Outcomes

* **FX savings** of 3-5% through timing optimization
* **Card reward maximization** worth 2-4% of spend
* **Personalized budgets** based on destination data
* **Real-time spending tracking** abroad

***

## 6. ⚡ Utility-Stress Early Warning

**Predictive alerts for SME utility cost pressures**

### Data Sources

* **Open Finance**: Business cash flow, expense patterns
* **Government Data**:
  * DEWA consumption trends
  * MOEI energy statistics
  * DED business sector data

### Implementation

```javascript theme={null}
class UtilityStressDetector {
  async detectUtilityStress(businessId) {
    // Get business financial data
    const financials = await this.getBusinessFinancials(businessId);

    // Get utility consumption patterns
    const utilityData = await this.getUtilityData(businessId);

    // Sector benchmarks
    const benchmarks = await this.getSectorBenchmarks(
      financials.sector,
      financials.size
    );

    // Detect stress signals
    const stressSignals = this.analyzeStressSignals(
      financials,
      utilityData,
      benchmarks
    );

    // Generate alerts and solutions
    return {
      stressLevel: stressSignals.level,
      alerts: stressSignals.alerts,
      solutions: this.generateSolutions(stressSignals),
      forecast: this.forecastUtilityCosts(utilityData)
    };
  }

  analyzeStressSignals(financials, utility, benchmarks) {
    const signals = [];

    // Check if utility costs are rising faster than revenue
    if (utility.growthRate > financials.revenueGrowth * 1.5) {
      signals.push({
        type: 'COST_PRESSURE',
        severity: 'HIGH',
        message: 'Utility costs growing 50% faster than revenue'
      });
    }

    // Compare to sector benchmarks
    if (utility.perSquareMeter > benchmarks.avgPerSqm * 1.2) {
      signals.push({
        type: 'ABOVE_BENCHMARK',
        severity: 'MEDIUM',
        message: '20% above sector average consumption'
      });
    }

    return {
      level: this.calculateStressLevel(signals),
      alerts: signals
    };
  }

  generateSolutions(stressSignals) {
    const solutions = [];

    if (stressSignals.level === 'HIGH') {
      solutions.push({
        type: 'INVOICE_FINANCING',
        description: 'Convert outstanding invoices to immediate cash',
        value: 'Up to AED 50,000',
        action: 'Apply for financing'
      });
    }

    solutions.push({
      type: 'ENERGY_AUDIT',
      description: 'Free DEWA energy audit for businesses',
      savings: 'Potential cost reduction opportunities',
      action: 'Schedule audit'
    });

    return solutions;
  }
}
```

### Expected Outcomes

* **Early warning system** for potential cash flow issues
* **Energy optimization** recommendations to help reduce costs
* **Automated financing** offers when needed
* **Sector benchmarking** for efficiency insights

***

## 🛠️ Implementation Resources

### API Integration Template

```javascript theme={null}
// Base class for all mashup implementations
class DataMashup {
  constructor(config) {
    this.openFinance = new OpenFinanceAPI(config.openFinance);
    this.govData = new GovernmentDataAPI(config.govData);
    this.cache = new CacheService();
  }

  async fetchWithCache(source, endpoint, params) {
    const cacheKey = `${source}:${endpoint}:${JSON.stringify(params)}`;

    const cached = await this.cache.get(cacheKey);
    if (cached) return cached;

    const data = await this[source].fetch(endpoint, params);
    await this.cache.set(cacheKey, data, 300); // 5 min cache

    return data;
  }

  async batchFetch(requests) {
    return Promise.all(
      requests.map(req =>
        this.fetchWithCache(req.source, req.endpoint, req.params)
      )
    );
  }
}
```

### Error Handling

```javascript theme={null}
class ResilientDataFetcher {
  async fetchWithFallback(primary, fallback) {
    try {
      return await primary();
    } catch (error) {
      console.warn('Primary source failed, using fallback', error);
      return await fallback();
    }
  }

  async fetchWithRetry(fn, retries = 3) {
    for (let i = 0; i < retries; i++) {
      try {
        return await fn();
      } catch (error) {
        if (i === retries - 1) throw error;
        await new Promise(r => setTimeout(r, 1000 * Math.pow(2, i)));
      }
    }
  }
}
```

## 🎯 Judging Criteria Alignment

Each mashup addresses key hackathon judging criteria:

| Criteria                 | How Mashups Excel                                   |
| ------------------------ | --------------------------------------------------- |
| **Innovation**           | Novel combinations of financial and government data |
| **Local Relevance**      | UAE-specific data solving real market problems      |
| **Technical Excellence** | Sophisticated data integration and analysis         |
| **User Experience**      | Intuitive dashboards with actionable insights       |
| **Business Viability**   | Clear monetization through fees or commissions      |
| **Scalability**          | Cloud-native architecture handling growth           |

## Next Steps

<CardGroup cols={3}>
  <Card title="View Categories" icon="folder" href="/additional-info/datasets-categories">
    Explore all available datasets
  </Card>

  <Card title="API Reference" icon="code" href="/additional-info/datasets-apis">
    Get implementation code
  </Card>

  <Card title="Start Building" icon="rocket" href="/quickstart">
    Begin your integration
  </Card>
</CardGroup>

<Tip>
  **Hackathon Strategy**: Start with one core mashup and execute it well. Judges prefer a polished implementation of one idea over multiple half-finished features.
</Tip>
