Monday, 25 September 2017

Parsing the NetApp Insight 2017 Berlin Event Catalog...

Cosonok (as per my About this blog page, I make no secret about this being an anagram of my real name) is going to the NetApp Insight 2017 conference in Berlin on 13th - 16th of November. I was planning my schedule from the Schedule Builder and had a need to parse all the breakout sessions so I could have a spreadsheet where I can filter by day and time (yes, I’m a bit an*l like that). The script is below and here’s the instructions to use it (I don’t really expect anyone to use it hence it’s not a very polished script, but it does the job.)

1) Login to the Schedule Builder
2) Click on the link for Event Catalog
3) Tick the box for ‘Breakouts’
4) And copy all the sessions (like in the image below) and paste this into say Notepad++

Image: NetApp Insight 2017 Berlin Schedule Builder

5) Save the text file as Berlin_Breakouts_2017.txt
6) Run the tool Breakouts.PS1 in the same folder as the txt file

Image: Running Breakouts.PS1

7) And - hey presto - you’ll have a CSV called Berlin_Breakouts_2017.CSV

Image: CSV edited to enable filtering and saved as .XLSX

The Script

Copy and paste the below into a text editor and save as Breakouts.PS1


[System.Array]$Breakouts = Get-Content "Berlin_Breakouts_2017.txt"

[System.Array]$Temp = @()
$Breakouts | Foreach{
  If($_.StartsWith("Add to My Interests")){}
  elseif($_.StartsWith("More Times")){}
  else{$Temp += $_}
}
$Breakouts = $Temp

[System.Object]$SavedLine = @{}
For($i=0;$i -le 10;$i++){
  [String]$SavedLine.$i = ""
}

[Boolean]$Days = $FALSE # Processing Days (or was)
[System.Array]$CSV = @()
[Int]$i = 0

$Breakouts | Foreach{
  [String]$Day = ""
  If($_.StartsWith("Monday")){$Day = "Monday";$Days=$TRUE}
  elseif($_.StartsWith("Tuesday")){$Day = "Tuesday";$Days=$TRUE}
  elseif($_.StartsWith("Wednesday")){$Day = "Wednesday";$Days=$TRUE}
  elseif($_.StartsWith("Thursday")){$Day = "Thursday";$Days=$TRUE}
  If($Day){
    [String]$Time = [String]($_.Split(" ")[3] + " - " + $_.Split(" ")[5])
    [Double]$Hour = [Int]($Time.Split(":")[0]) + [Double](($Time.Split(" ")[0].Split(":")[1])/60)
    $CSV +=  [PSCustomObject]@{
      "Day"  = $Day
      "Time" = $Time
      "Hour" = $Hour
      "Session" = $SavedLine.0
      "Description" = $SavedLine.1
      "Type" = $SavedLine.2
      "Speaker" = $SavedLine.3
    }
  }
  If(!$Day){
    If($Days){
      $i = 0
      For($j=0;$j -le 10;$j++){
        [String]$SavedLine.$j = ""
      }
    }
    $Days = $FALSE
    [String]$SavedLine.$i = $_
  }
  $i++
}

$Temp = @()
[System.Array]$D4 = "Monday","Tuesday","Wednesday","Thursday"
Foreach($D in $D4){
  $Temp += $CSV | Where{$_.Day -eq $D} | Sort-Object Hour
}
$CSV = $Temp
$CSV | Export-CSV "Berlin_Breakouts_2017.CSV" -NoTypeInformation


2 comments:

  1. Awesome thanks! I used this for the US version as well and seemed to work there also. Hopefully future insights they will post them as a spreadsheet and / or pdf ?

    ReplyDelete
    Replies
    1. Many thanks for the comment daVikes. Cool that it works for Las Vegas also :-)

      Delete