anchor.diff:    let csv = Traffic.Load(blob.OpenRead())
   
     do! Cloud.Logf "Reading and parsing measurements"  
  +
  +  let regions = System.Collections.Generic.Dictionary<_, _>()
  +  let locations = System.Collections.Generic.Dictionary<_, _>()
  +  let getLocation loc = 
  +    if not (locations.ContainsKey(loc)) then 
  +      locations.Add(loc, { Location.ID = locations.Count; Location = loc })    
  +    locations.[loc]
  +  let getRegion reg = 
  +    if not (regions.ContainsKey(reg)) then 
  +      regions.Add(reg, { Region.ID = regions.Count; Region = reg })    
  +    regions.[reg]
  +
     let measurements = 
       csv.Rows
       |> Seq.chunkWhile (fun r1 r2 -> r1.CP = r2.CP)
  
positive.code:     |> Array.ofSeq
  
    do! Cloud.Logf "Calculating daily measurements"  
    let daily = measurements |> Array.mapi (fun idx (loc, date, group) ->
      { DailyMeasurement.ID = idx; Location = loc; Day = date.Day; Month = date.Month; Year = date.Year
        PedalCycles = group |> Seq.sumBy (fun r -> defaultArg r.PC 0)
        MotorVehicles = group |> Seq.sumBy (fun r -> defaultArg r.AMV 0) })
    
  
negative.code: // Count how many records have we inserted already...
  "SELECT Count(*) FROM [gb-road-traffic-counts-daily-measurement]" |> Database.executeScalarCommand
  "SELECT Count(*) FROM [gb-road-traffic-counts-location]" |> Database.executeScalarCommand
  "SELECT Count(*) FROM [gb-road-traffic-counts-road]" |> Database.executeScalarCommand
  "SELECT Count(*) FROM [gb-road-traffic-counts-region]" |> Database.executeScalarCommand
  
  // Create some indices over the table to make filtering by time, station & pollutant faster
  "CREATE NONCLUSTERED INDEX IX_YearMonthDay ON [gb-road-traffic-counts-daily-measurement] (Year,Month,Day)" 
  |> Database.executeCommandWithTimeout (60 * 15)
  "CREATE NONCLUSTERED INDEX IX_LocationID ON [gb-road-traffic-counts-daily-measurement] (LocationID)" 
  |> Database.executeCommandWithTimeout (60 * 15)
  "CREATE NONCLUSTERED INDEX IX_RegionID ON [gb-road-traffic-counts-daily-measurement] (RegionID)" 
  |> Database.executeCommandWithTimeout (60 * 15)
  "CREATE NONCLUSTERED INDEX IX_RoadID ON [gb-road-traffic-counts-daily-measurement] (RoadID)" 
  |> Database.executeCommandWithTimeout (60 * 15)
  
  // This is how to drop some index in case we do not actually want it!
  "DROP INDEX IX_YearMonthDay ON [gb-road-traffic-counts-daily-measurement]" 
  |> Database.executeCommand