Category Archives: C#

London Drug Map

A look into open data about crime and policing in England.
londondrugs banner
Found at I downloaded a date range from 2011 through 2016, ~5 years. The uncompressed filesize for all select-able policing forces was approximately 5.45 GB. A quick C# script was written to filter out only the “Drug” crime type category, and it’s long/lat degree coordinates.

The output was used to make the map below. Click map for larger size.


1more londonmap

The downloadable data comes in a multi-directory/multi-file structure. Below is a c# console application which was created to parse the root folder, and export the specific crime type’s coordinates throughout out all the files.
Continue reading

Chicago Police Gun Related Incident Visualizations 2008 – 2016

A look into Chicago Police Department’s gun related incident reports from January 2008 through February 2016. The data is from

Stacked bar chart of monthly incidents by primary type.
Click chart image to expand
Chicago Police Department Monthly Gun Related Incident Reports
Line chart of monthly incidents by primary type.
Click chart image to expand
Chicago Police Department Monthly Gun Related Incident Reports Line Chart

Static Map
Chicago Police Department Gun Related Incident Reports Jan 2008 - Feb 2016 Heat Map


Animated Map

Continue reading

Comcast’s Monetary Influence Over Illinois Political Candidates

I found an interesting dataset on political contributions in the state of Illinois.. The downloadable .zip contains multiple tab delimited database files which contain the relationships between Donations, Committees, and Candidates.

Out of curiosity in seeing Comcast’s political influence in Illinois over time, I parsed the 650,775mb file called Receipts.txt. Below is a bar chart of yearly recorded donation totals from 2000 through 2015-08.


Not being very politically oriented, I wanted to somehow relate the donations to candidates. But in the form of the available data, it appears Donors make contributions to Committees, and Committees support a Candidate. But I do not know if Candidates and Committees are a One to One relationship at the time of typing this.

Parsing the text file called CmteCandidateLinks.txt, I related the Committee Id with the candidate Id. Parsing the text file called Candidates.txt I relate the Candidate Id to the Candidate name.

Lots of candidate duplicates per donation entry. Majority of Committees represent the same candidate under different ids, while some committees represent multiple candidates. Example here:


So I decided to distribute each donation amount between a potential multitude of candidates. I did this by dividing each donation by the number of candidates which belong to the committee recipient. From that, I got this list of Comcast’s Top Illinois Candidates.


Continue reading

Vietnam conflict charts and graphs

In this post I will be exploring some data I found about the Vietnam War.
The data is from The National Archives Catalog


The downloaded data file DCAS.VN.EXT08.DAT contains 58,220 records. Each row appears to be an individual involved in the war. I couldn’t make immediate sense of the cookbook documents, so I proceeded straight to parsing it raw. By eyeballing the values of each column I was able to determine the following attributes per row:

Name, Branch, Rank, Assigned Position, Gender, Hometown, Country, State, Relationship Status, Religion, Race, Mortility Status, and Reason of Death.

C# Console:

Console.BufferHeight = 4000;
Console.WriteLine("Charlie in the Trees");
System.IO.StreamReader myFile =
    new System.IO.StreamReader(@"C:\VIETNAM\DCAS.VN.EXT08.DAT");
string vietnamData = myFile.ReadToEnd();
string[] lines = vietnamData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
int count = 0;
foreach( string line in lines )
    string[] parts = line.Split('|');
    Console.WriteLine("name        : " + parts[4]);
    Console.WriteLine("branch      : " + parts[6]);
    Console.WriteLine("rank        : " + parts[7]);
    /* ... */
    count += 1;
Console.WriteLine("total " + count);


Alright, now that we’ve parsed the data, I typically ask myself these questions:
what is interesting?
what do I want to see?
what might be controversial?
what could invoke the attention of others?


Dictionary<string, int> dictConcepts = new Dictionary<string, int>();
foreach( string line in lines )
    string[] parts = line.Split('|');
    if (parts[43] == "DECEASED")
        if (dictConcepts.ContainsKey(parts[45]))
            int cur_count = dictConcepts[parts[45]];
            cur_count += 1;
            dictConcepts[parts[45]] = cur_count;
            dictConcepts.Add(parts[45], 1);