← All solutions

The Pizza Index - Solution

1. Review the Incident Brief

The Pentagon Pizza Index has spiked 10x with no corresponding real-world events. Intelligence analysts have ruled out military exercises or crisis responses. The spike started 6 hours ago and continues.

2. Open PizzaWatch Dashboard

Navigate to the PizzaWatch Dashboard to visualize the Pentagon Pizza Index over time.

3. Identify the Spike

The bar chart shows a dramatic increase from ~20 orders/hour to ~200 orders/hour. The source breakdown table reveals that DoorDash is contributing approximately 180 of these orders, while other sources (Dominos, UberEats, GrubHub) remain normal.

4. Open SQL Console

Let's investigate the data sources configuration. Open the SQL console to query the database.

5. Query Data Source Configurations

Run the following query to examine how each data source is configured:

SELECT * FROM data_source_configs;

Notice that DoorDash has coordinate_field = 'restaurant_location' while all other sources use 'delivery_location'.

6. Examine DoorDash Orders

Query DoorDash orders to understand what's being classified:

SELECT 
  order_id,
  restaurant_name,
  restaurant_lat,
  restaurant_lng,
  delivery_lat,
  delivery_lng,
  classified_fence_id
FROM order_events 
WHERE source_id = 'doordash'
LIMIT 20;

Key findings:

7. Check Pentagon Geo-Fence

Verify the Pentagon geo-fence configuration:

SELECT * FROM geo_fences WHERE fence_id = 'pentagon';

The Pentagon fence center is at (38.8711, -77.0559) with a 500m radius. Tony's Famous is approximately 167m from the Pentagon center - inside the fence.

8. Compare with Working Data Source

Query Dominos orders to see correct behavior:

SELECT 
  order_id,
  restaurant_lat,
  restaurant_lng,
  delivery_lat,
  delivery_lng,
  classified_fence_id
FROM order_events 
WHERE source_id = 'dominos'
LIMIT 20;

Result shows mixed classifications (pentagon, cia, whitehouse, NULL) - correct behavior based on delivery locations.

9. Review Architecture Documentation

Navigate to the documentation panel and read the Pipeline Architecture document to understand how geo-classification works.

Key insight: The geo-classifier reads coordinate_field from data_source_configs to determine which coordinates to use for classification.

10. Review DoorDash Integration Documentation

Open the DoorDash Integration document in the docs panel.

Find the critical detail: Initial setup used restaurant_location as a temporary workaround when API v1 was the only option. A TODO was left to update to delivery_location when API v2 became available - but it was never completed.

11. Understand the Root Cause

The bug is now clear:

12. Apply the Fix

Return to the SQL console and update the DoorDash configuration:

UPDATE data_source_configs 
SET coordinate_field = 'delivery_location' 
WHERE source_id = 'doordash';

13. Verify the Configuration

Confirm the update was successful:

SELECT source_id, coordinate_field 
FROM data_source_configs 
WHERE source_id = 'doordash';

Should return: doordash | delivery_location

14. Deploy the Changes

Click the 'Deploy' button to apply the configuration change and restart the affected services.

15. Challenge Completed

The validation system confirms:

The temporary workaround from the initial integration has finally been fixed.