PowerShell, Visualize the Peanut Butter Recall Data

by Doug Finke on January 26, 2009

 

image

Snack Bar is the category pointing to the Recalling Firm which points to the Brand Name

Over on The Crabby Office Lady site is a post on Excel viewer aids peanut butter recall awareness. The FDA published the Peanut Butter Recall information in Excel.

I downloaded it, saved it as a CSV and used the PowerShell code from Social Networks and Pork Barrel Spending? that wrapped the NetMap (now called NodeXL) visualization control from Microsoft Research.

. .\Show-NetMap
 
$d = Import-Csv .\PeanutButterProducts2009.csv | ? {$_.Category -eq 'Snack Bar'}
 
$firstSet = $d |
    Select @{
        Name="Source"
        Expression={$_."Category"}
    }, @{
        Name="Target"
        Expression={$_."Recalling Firm"}
    }
 
$secondSet = $d |
    Select @{
        Name="Source"
        Expression={$_."Recalling Firm"}
    }, @{
        Name="Target"
        Expression={$_."Brand Name"}
    }
 
$firstSet+$secondSet | Show-NetMap F

Here is the breakdown of food categories. The above visualization is only the Snack Bars.

Import-Csv .\PeanutButterProducts2009.csv | group -NoElement Category | sort count
 
Count Name
----- ----
    1 Pet Food Peanut Paste
    3 Pre-Packaged Meals
    3 Peanut Paste
    8 Fruit and Vegetable
    9 Cake
   10 Brownie
   19 Pet Food
   22 Cracker
   31 Ice Cream
   34 Peanut Butter
   50 Candy
   73 Snack Bar
  125 Cookie

 

Download

{ 8 trackbacks }

Peanut tainted product and producer networks, as seen in NodeXL
02.02.09 at 4:43 pm
Check out your peanut butter here | All about MICROSOFT
02.11.09 at 7:09 pm
Check out your peanut butter here | Blogging Hope
02.11.09 at 7:20 pm
Chad Miller
11.02.09 at 7:40 am
Stored Procedure Call Tree | Sev17
03.21.10 at 10:47 am
Build Your Own SQL Server 2008 Object Dependency Viewer | Sev17
03.21.10 at 11:33 am
SQL Server Object Dependency Viewer Revisited | Sev17
08.07.10 at 3:59 pm
SQL Server Object Dependency Viewer Revisited | SQLServerPedia
08.09.10 at 3:44 am

{ 2 comments… read them below or add one }

christine morton 02.02.09 at 3:53 pm

this is great! what a great tool.

Chad Miller 03.14.09 at 6:56 pm

This is too cool, I used your Show-NetMap function to http://ping.fm/hp9Fn.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>