# ShiftOps Scoring System

**Last Updated:** 2026-01-09

Complete documentation of the ShiftOps scoring system, including all 5 pillar calculations, formulas, customer boost logic, and worked examples.

## Overview

The ShiftOps scoring system evaluates businesses across 5 pillars (0-20 points each) to produce a total score (0-100) and grade (A+ through F). The system uses industry-specific baselines, data completeness multipliers, and customer boost adjustments to ensure accurate and fair scoring.

### Score Ranges

- **Total Score:** 0-100 (integer)
- **Pillar Scores:** 0-20 (integer, per pillar)
- **Grade:** A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, F

## Calculation Flow

```mermaid
flowchart TD
    Start[Business Data Input] --> Baseline[Select Industry Baseline]
    Baseline --> Pillar1[Calculate Scheduling Efficiency]
    Baseline --> Pillar2[Calculate Absence Stability]
    Baseline --> Pillar3[Calculate Time Tracking Hygiene]
    Baseline --> Pillar4[Calculate Compliance Docs]
    Baseline --> Pillar5[Calculate Payroll Readiness]
    Pillar1 --> Customer{Customer?}
    Pillar2 --> Customer
    Pillar3 --> Customer
    Pillar4 --> Customer
    Pillar5 --> Customer
    Customer -->|Yes| Boost[Apply Customer Boost]
    Customer -->|No| Sum[Sum Raw Scores]
    Boost --> Sum
    Sum --> Multiplier[Apply Data Completeness Multiplier]
    Multiplier --> Cap{Customer?}
    Cap -->|Yes| Cap95[Cap at 95]
    Cap -->|No| Round[Round Total Score]
    Cap95 --> Round
    Round --> Adjust[Adjust Pillar Scores Proportionally]
    Adjust --> Grade[Assign Grade]
    Grade --> End[Final Scores + Grade]
```

## Pillar 1: Scheduling Efficiency (0-20)

**Purpose:** Measures how efficiently a business manages shift scheduling and workforce planning.

**Industry Baselines:**

- Healthcare (hospital, pharmacy, doctor): 5 points
- Hospitality (restaurant, cafe, bar): 6 points
- Retail (store, shopping_mall): 7 points
- General: 6 points

**Scoring Factors:**

1. **Digital Maturity (0-5 points)**

   - Website exists: +2 points
   - Website with online features (booking, ordering, payment): +1 point
   - Active Google Business (photos >10 AND reviews >50): +2 points (restaurants: +1)
   - Moderate Google Business (photos >5 OR reviews >25): +1 point (restaurants: +0.5)

2. **Operational Complexity (0-7 points)**

   - Weekly hours >= 80: +6 points (restaurants: +4)
   - Weekly hours >= 60: +4 points (restaurants: +2)
   - Weekly hours >= 40: +2 points (restaurants: +1)
   - Multiple service types (>=3): +1 point
   - Multi-location business: +1 point

3. **Team Scale Indicators (0-3 points)**
   - Review count >500: +1 point (restaurants: +0.5)
   - Review count >100: +1 point (restaurants: +0.5)

**Customer Boost:**

- Baseline bonus: +3 points
- Percentage boost: +25-30%
- Maximum score: 18 points
- Minimum score: 14 points (floor)

**Code Location:** `v2/api/shiftops.php` lines 3837-3981

## Pillar 2: Absence Stability (0-20)

**Purpose:** Evaluates how well a business manages employee absences and maintains stable operations.

**Industry Baselines:**

- Healthcare (hospital, pharmacy, doctor): 6 points
- Hospitality (restaurant, cafe, bar): 7 points
- Retail (store, shopping_mall): 8 points
- General: 7 points

**Scoring Factors:**

1. **Rating-Based Scoring (0-4 points)**

   - Rating >=4.5: +4 points
   - Rating >=4.0: +3 points
   - Rating >=3.5: +2 points
   - Rating >=3.0: +1 point

2. **Review Sentiment Analysis (0-2 points)**

   - Positive mentions > negative mentions: +2 points
   - Negative mentions > positive mentions: -2 points

3. **Seasonal Factors (0-3 points)**

   - Healthcare: +3 points (always)
   - Hospitality (high season: Jun, Jul, Aug, Dec): +1 point
   - Hospitality (other months): +2 points
   - Retail (high season: Nov, Dec): +1 point
   - Retail (other months): +2 points
   - General: +2 points

4. **Holiday Impact (-3 to 0 points)**

   - Upcoming holidays >=3: -3 points
   - Upcoming holidays >=2: -2 points
   - Upcoming holidays >=1: -1 point

5. **Weather Risk (-1 point)**

   - Weather risk detected: -1 point

6. **Multi-location Bonus (+1 point)**

   - Multi-location business: +1 point

7. **Seasonal Multiplier Bonus (+2 points)**
   - If seasonal multiplier <1.0 (low season): +2 points

**Customer Boost:**

- Baseline bonus: +3 points
- Percentage boost: +25%
- Maximum score: 20 points
- Minimum score: 15 points (floor)

**Code Location:** `v2/api/shiftops.php` lines 4014-4113

## Pillar 3: Time Tracking Hygiene (0-20)

**Purpose:** Assesses the quality and consistency of time tracking practices.

**Industry Baselines:**

- Healthcare (hospital, pharmacy, doctor): 5 points
- Hospitality (restaurant, cafe, bar): 5 points
- Retail (store, shopping_mall): 6 points
- General: 6 points

**Scoring Factors:**

1. **Website Presence (+2 points)**

   - Website exists: +2 points

2. **Digital Presence Indicators (0-2 points)**

   - Active presence (photos >10 AND reviews >50): +2 points
   - Moderate presence (photos >5 OR reviews >25): +1 point

3. **Schedule Complexity (0-5 points)**

   - Very high complexity: +5 points
   - High complexity: +3 points
   - Medium complexity: +1 point

4. **Multi-location Bonus (+2 points)**

   - Multi-location business: +2 points

5. **Rating and Review Bonuses (0-3 points)**
   - Rating >=4.0: +2 points
   - Review count >100: +1 point
   - Review count >200 AND rating >3.5: +1 point

**Customer Boost:**

- Baseline bonus: +2 points
- Percentage boost: +20-30%
- Maximum score: 18 points
- Minimum score: 14 points (floor)

**Code Location:** `v2/api/shiftops.php` lines 4237-4317

## Pillar 4: Compliance Docs (0-20)

**Purpose:** Measures compliance documentation quality and regulatory adherence.

**Industry Baselines:**

- Healthcare (hospital, pharmacy, doctor): 5 points (base) + 9 points (compliance) = 14 total baseline
- Hospitality (restaurant, cafe, bar): 3 points (base) + 4 points (compliance) = 7 total baseline
- Retail (store, shopping_mall): 4 points (base) + 4 points (compliance) = 8 total baseline
- General: 4 points (base) + 5 points (compliance) = 9 total baseline

**Scoring Factors:**

1. **Industry Compliance Requirements (0-9 points)**

   - Healthcare: +9 points (strict compliance requirements)
   - Hospitality/Food: +4 points (HACCP requirements)
   - Retail: +4 points
   - General: +5 points
   - Wheelchair accessible entrance: +2 points

2. **Documentation Indicators (0-4 points)**

   - Required fields complete (>=4): +2 points
   - Required fields complete (>=3): +1 point
   - Active presence (photos >5 AND reviews >25): +2 points
   - Moderate presence (photos >2 OR reviews >10): +1 point

3. **Regional Compliance Factors (0-3 points)**

   - Germany (DE): +2 points
   - Austria (AT): +1 point
   - Switzerland (CH): +1 point
   - Review count >100: +1 point

4. **Risk Assessment (0-2 points)**
   - No negative compliance mentions AND reviews >10: +1 point
   - Review count >200 AND rating >3.5: +1 point

**Customer Boost:**

- Baseline bonus: +3 points
- Percentage boost: +30%
- Maximum score: 19 points
- Minimum score: 15 points (floor)

**Code Location:** `v2/api/shiftops.php` lines 4401-4499

## Pillar 5: Payroll Readiness (0-20)

**Purpose:** Evaluates readiness for payroll processing and DATEV integration.

**Industry Baselines:**

- Healthcare (hospital, pharmacy, doctor): 6 points
- Hospitality (restaurant, cafe, bar): 6 points
- Retail (store, shopping_mall): 7 points
- General: 7 points

**Scoring Factors:**

1. **Website and Payment Features (0-4 points)**

   - Website exists: +2 points
   - Payment features detected: +2 points

2. **Digital Services (0-2 points)**

   - Digital services >=2: +2 points
   - Digital services >=1: +1 point

3. **Review Count Bonuses (0-3 points)**

   - Review count >500: +2 points
   - Review count >200: +1 point
   - Review count >100: +1 point

4. **Rating and Review Combinations (0-2 points)**

   - Review count >150 AND rating >3.8: +2 points
   - Review count >50 AND rating >3.5: +1 point

5. **Multi-location Bonus (+1 point)**

   - Multi-location business: +1 point

6. **Price Level Bonus (+2 points)**

   - Price level >0: +2 points

7. **Rating and Volume Combination (0-2 points)**

   - Rating >=4.0 AND reviews >100: +2 points
   - Rating >=3.5 AND reviews >50: +1 point

8. **Regional Factors (0-2 points)**

   - Germany (DE): +2 points
   - Austria/Switzerland (AT/CH): +1 point

9. **Standard Hours Bonus (+1 point)**

   - Standard business hours detected: +1 point

10. **Schedule Complexity Bonus (+1 point)**
    - Low or medium complexity: +1 point

**Customer Boost:**

- Baseline bonus: +3 points
- Percentage boost: +30%
- Maximum score: 18 points
- Minimum score: 14 points (floor)

**Code Location:** `v2/api/shiftops.php` lines 4517-4630

## Total Score Calculation

### Step-by-Step Process

#### Step 1: Calculate Raw Pillar Scores

Each pillar score is calculated independently as a float (0.00-20.00):

```php
$rawScores = [
    'scheduling_efficiency' => calculateSchedulingScoreRaw($businessData, $isOrdioCustomer),
    'absence_stability' => calculateAbsenceScoreRaw($businessData, $isOrdioCustomer),
    'time_tracking_hygiene' => calculateTimeTrackingScoreRaw($businessData, $isOrdioCustomer),
    'compliance_docs' => calculateComplianceScoreRaw($businessData, $isOrdioCustomer),
    'payroll_readiness' => calculatePayrollScoreRaw($businessData, $isOrdioCustomer)
];
```

#### Step 2: Sum Raw Scores

```php
$rawTotalScore = array_sum($rawScores);
```

#### Step 3: Apply Data Completeness Multiplier

**Fields Checked:**

- Website (exists)
- Opening hours (exists)
- Reviews (exists and count >0)
- Photos (exists and count >0)

**Multiplier Table:**

| Complete Fields | Percentage | Multiplier | Confidence | Impact |
| --------------- | ---------- | ---------- | ---------- | ------ |
| 4 fields        | 100%       | 1.0        | High       | None   |
| 3 fields        | 75%        | 0.90       | Medium     | Low    |
| 2 fields        | 50%        | 0.75       | Medium     | Medium |
| 1 field         | 25%        | 0.65       | Low        | High   |
| 0 fields        | 0%         | 0.60       | Low        | High   |

**Customer Adjustment:**

- If website missing AND multiplier <1.0: Use 0.94 multiplier
- If website exists OR other digital indicators: Use max(0.98, multiplier)

#### Step 4: Apply Customer Cap

Ordio customers are capped at 95 points maximum:

```php
if ($isOrdioCustomer) {
    $adjustedScore = min(95, $adjustedScore);
}
```

#### Step 5: Round Total Score

- **Customers:** `round()` (rounds up)
- **Non-customers:** `floor()` (rounds down)

#### Step 6: Adjust Pillar Scores Proportionally

Pillar scores are adjusted so their rounded sum equals the total score using `adjustPillarScoresToMatchTotal()`.

**Algorithm:**

1. Calculate ratio: `$ratio = $targetTotal / $rawSum`
2. Apply ratio to each pillar score
3. Floor all scores initially
4. Calculate difference: `$difference = $targetTotal - $sumOfAdjusted`
5. Adjust pillars with highest/lowest fractional parts
6. Final verification: Adjust largest/smallest pillar if needed

#### Step 7: Assign Grade

| Score Range | Grade |
| ----------- | ----- |
| 90-100      | A+    |
| 85-89       | A     |
| 80-84       | A-    |
| 75-79       | B+    |
| 70-74       | B     |
| 65-69       | B-    |
| 60-64       | C+    |
| 55-59       | C     |
| 50-54       | C-    |
| 45-49       | D+    |
| 40-44       | D     |
| 35-39       | D-    |
| 0-34        | F     |

## Customer Boost Logic

### Boost Application

For Ordio customers, each pillar receives:

1. **Baseline Bonus:** +2-3 points (varies by pillar)
2. **Percentage Boost:** +20-35% (varies by pillar)
3. **Minimum Floor:** Ensures customers meet minimum standards
4. **Maximum Cap:** Prevents unrealistic scores

### Boost by Pillar

| Pillar                | Baseline Bonus | Percentage Boost | Max Score | Min Score |
| --------------------- | -------------- | ---------------- | --------- | --------- |
| Scheduling Efficiency | +3             | +25-30%          | 18        | 14        |
| Absence Stability     | +3             | +25%             | 20        | 15        |
| Time Tracking Hygiene | +2             | +20-30%          | 18        | 14        |
| Compliance Docs       | +3             | +30%             | 19        | 15        |
| Payroll Readiness     | +3             | +30%             | 18        | 14        |

**Code Location:** `v2/api/shiftops.php` lines 3679-3771 (boost functions)

## Worked Example

### Input Data

- **Business:** Restaurant "Bella Italia München"
- **Rating:** 4.2
- **Reviews:** 150
- **Opening Hours:** 80 hours/week
- **Website:** Exists
- **Photos:** 25 photos
- **Types:** ['restaurant', 'food', 'point_of_interest']
- **Not an Ordio customer**

### Calculation

**1. Scheduling Efficiency:**

- Industry baseline (restaurant): 6 points
- Website exists: +2 points
- Weekly hours >= 80: +4 points (restaurant reduction)
- Reviews >100: +0.5 points (restaurant reduction)
- Raw score: 6 + 2 + 4 + 0.5 = 12.5

**2. Absence Stability:**

- Industry baseline (restaurant): 7 points
- Rating >=4.0: +3 points
- Seasonal factors (current month): +2 points
- Raw score: 7 + 3 + 2 = 12.0

**3. Time Tracking Hygiene:**

- Industry baseline (restaurant): 5 points
- Website exists: +2 points
- Active presence (photos >10 AND reviews >50): +2 points
- Schedule complexity (very high): +5 points
- Rating >=4.0: +2 points
- Review count >100: +1 point
- Raw score: 5 + 2 + 2 + 5 + 2 + 1 = 17.0

**4. Compliance Docs:**

- Industry baseline (restaurant): 3 + 4 = 7 points
- Required fields complete (>=4): +2 points
- Active presence (photos >5 AND reviews >25): +2 points
- Germany (DE): +2 points
- Review count >100: +1 point
- Raw score: 7 + 2 + 2 + 2 + 1 = 14.0

**5. Payroll Readiness:**

- Industry baseline (restaurant): 6 points
- Website exists: +2 points
- Review count >100: +1 point
- Review count >150 AND rating >3.8: +2 points
- Rating >=4.0 AND reviews >100: +2 points
- Germany (DE): +2 points
- Raw score: 6 + 2 + 1 + 2 + 2 + 2 = 15.0

**6. Sum Raw Scores:**

- Total: 12.5 + 12.0 + 17.0 + 14.0 + 15.0 = 70.5

**7. Data Completeness:**

- 4 fields complete (website, opening hours, reviews, photos): 100% → multiplier 1.0
- Adjusted: 70.5 × 1.0 = 70.5

**8. Not a customer, so no cap applied**

**9. Round Total:**

- floor(70.5) = 70

**10. Adjust Pillar Scores:**

- Ratio: 70 / 70.5 = 0.9929
- Adjusted: [12, 12, 17, 14, 15] = 70 ✓

**11. Assign Grade:**

- Score 70 → Grade B

### Expected Result

- **Total Score:** 70/100
- **Grade:** B
- **Pillar Scores:** [12, 12, 17, 14, 15]

## Scoring Calculation Flow

```mermaid
flowchart TD
    Input[Business Data Input] --> Baseline[Select Industry Baseline]
    Baseline --> P1[Calculate Scheduling Efficiency<br/>Raw Score: 0-20 float]
    Baseline --> P2[Calculate Absence Stability<br/>Raw Score: 0-20 float]
    Baseline --> P3[Calculate Time Tracking Hygiene<br/>Raw Score: 0-20 float]
    Baseline --> P4[Calculate Compliance Docs<br/>Raw Score: 0-20 float]
    Baseline --> P5[Calculate Payroll Readiness<br/>Raw Score: 0-20 float]
    P1 --> Customer{Customer?}
    P2 --> Customer
    P3 --> Customer
    P4 --> Customer
    P5 --> Customer
    Customer -->|Yes| Boost[Apply Customer Boost<br/>+2-3 baseline + 20-35%]
    Customer -->|No| Sum[Sum Raw Scores]
    Boost --> Sum
    Sum --> Multiplier[Apply Data Completeness<br/>Multiplier: 0.60-1.0]
    Multiplier --> Cap{Customer?}
    Cap -->|Yes| Cap95[Cap at 95]
    Cap -->|No| Round[Round Total Score<br/>Customers: round up<br/>Non-customers: floor]
    Cap95 --> Round
    Round --> Adjust[Adjust Pillar Scores<br/>Proportionally]
    Adjust --> Grade[Assign Grade<br/>A+ through F]
    Grade --> End[Final Scores + Grade]
```

## Related Documentation

- [Technical Implementation](03-technical-implementation.md) - Code structure
- [API Endpoints](05-api-endpoints.md) - API reference
- [System Scoring Documentation](../../../systems/shiftops/SHIFTOPS_SCORING_SYSTEM.md) - Detailed system documentation
