Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

Locust Career Relocation Data Mining App

5.00/5 (2 votes)
15 Aug 2013CPOL6 min read 12K  
An application that helps relocating professionals

This article is an entry in our DnB Developer Challenge. Articles in this sub-section are not required to be full articles so care should be taken when voting.

Introduction 

Dun and Bradstreet is an American company with headquarters in Short Hills NJ USA and one of the worlds leading source of commercial information.They maintain a database of over 213 million companies globally.

The challenge that D & B have put forth is based on Sandboxed data of 10,000 companies made available on Windows Azure data market.Developers were asked to dig into the data and come up with mashup or standalone ideas (for a potential $100 prize) or finished Application (for a potential of up to $15,000).The key phrase in this contest is "just have a look around and see what’s there" which entails what is not out there is most important  and how can your application fill the void.After a lot of Brainstorming, the current situation of a couple of friends in the United State inspired me with an application idea which I could implement in a jiffy.  

The application is called Locust, and it helps to assist professionals on deciding if a companies immediate environment is suitable for them. The use case diagram shows the main functional requirements  of Locust.

 

In order to understand the usefulness of these functionality we will explores a use case and an important scenario that was my inspiration for the creation of Locust.

 

Use case Name

Obtain Company Info, Income estimate and Environmental Factors

Participating actors       

Relocating User

Flow of events

User

1-User selects the State he/she would like to relocate to.

 

 

 

 

 

 

3-User can compare trends and values within this chart for each state. (example: salary disbursement and state population comparison)

 

4-User decides to find out more information about a specific firm

And clicks the “show location” button.

Locust System

 

 

 

2-System displays all the business firms present in that state, state population and a chart that represents the trend in salary disbursement in that state.

 

 

 

 

 

 

 

 

 

5-System displays the location of the firm on Google maps, the city it is present in, the crime rate in that city and the main facts about the firm.

 

Entry Condition

User clicks on “GO!” button for a specific State

Exit Condition

The web page is closed

Exception

D&B Sandbox data unavailable

Includes

None

Quality Requirement

System response time should be </= 3 secs

  The Economic decline in the United states and the collapse of the auto industry  led to some States having a better standard of living than other.As you would expect , lots of professionals (including those who had never lived outside their states in their lifetime) started moving to other states that were inclined to providing easy access to jobs.Some of these people do not really have any ties to these states and would want to know what is out there. Lets take a look at this brief scenario about Amanda a single mom of 3 whom was laid off from General Motors Detroit in 2008.Amanda had worked at GM for 15 years and lived in Detroit all her life.A friend of Amanda's  has referred her for a position at GM in Atlanta and  she knows that her chances of getting a job at GM in Atlanta is currently high but also, she wants to know if the environment is conducive for her kids, the prospects of getting a similar high tech job if she unfortunately gets laid off again, and an idea of the employment rate and income around Georgia.She does not want to have to relocate frequently as it will create an unstable environment for her kids.

 

Scenario name 

Amanda needs to move out of Detroit  to continue her Career

 

Participating actor

Amanda: General Motors Layoff

Flow of events

 

 

 

1.     Amanda starts the Locust Application

2.     She chooses Georgia and views the state population and GDP compensation estimate.

3.     She searches for the names of some other car manufacturing companies around Georgia.

4.     She views the crime rate in the cities that these companies are located and the information provided.

5.     Amanda decides on if she would like to relocate to that area.

 

Using the sandboxed data

I created Locust using ASP.NET and Javascript  with  Visual Studio 2010 IDE . All that was need for accessing the data was to create a service references.Please take a look at How to Create a Flexible Query Application .It is very straigtht forward and does not require  too many lines of codes to execute.

I used 3 data sources:

  1. GDP By States Estimates of Compensation  published by Bureau of Economic Analysis 
  2.  City Crime in the United States  published by Data.gov
  3. D &B Sandboxed data of 10,000 firms.

The respective service URI's are as follows:

https://api.datamarket.azure.com/DNB/DeveloperSandbox

https://api.datamarket.azure.com/data.gov/Crimes

https://api.datamarket.azure.com/BEA/GDPBYSTATESCOMPENSATION

The above service URI's were accessed using the following containers in the respective order above 

C++
DNBDeveloperSandboxContainerdatagovCrimesContainer
DNBDeveloperSandboxContainer
BEAGDPBYSTATESCOMPENSATIONContainer 

Sample: The  class which I created to retrieve and manipulate the D&B are as follows:

C++
class FirmData 
{
    private Uri serviceURI;
    private DNBDeveloperSandboxContainer context;

    public FirmData()
    {

        serviceURI = new Uri("https://api.datamarket.azure.com/DNB/DeveloperSandbox/");
        context = new DNBDeveloperSandboxContainer(serviceURI);
        context.IgnoreMissingProperties = true;
        context.IgnoreResourceNotFoundException = true;
        context.Credentials = new NetworkCredential("ff0e8a8a-4b58-4ae1-a172-4973941f0a62", 
        "HIQijEqN0Wxlq//zmc0bO0mT5WLrl7xshfcOIp7I3/A"); // Your Marketplace account key
    }

    public IList<LocationLatLong> GetFirmData(String s)
    {

        IEnumerable<LocationLatLong> query = context.LocationLatLong.Where(company => company.StateAbbrv == s);
        //IEnumerable<CityCrime> query = context.CityCrime.Where(
        //  crime => crime.City == "Newport").OrderBy(crime => crime.Year);

        try
        {


            return query.ToList();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: {0}", ex.Message);
            return null;
        }  // end try

    }
    public IList<Firmographics> GetFirmographics(String s)
    {
        IEnumerable<Firmographics> query = 
           context.Firmographics.Where(company => company.DUNSNumber == s);


        //IEnumerable<CityCrime> query = context.CityCrime.Where(crime => 
        //   crime.City == "Newport").OrderBy(crime => crime.Year);

        try
        {
            return query.ToList();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: {0}", ex.Message);
            return null;
        }  // end try

    }

    public String ceoName(String s)
    {
        if (s != null)
        {
            StringBuilder name = new StringBuilder(s.ToLower());
            name[0] = Char.ToUpper(name[0]);
            int pos = s.IndexOf(' ');
            name[pos + 1] = Char.ToUpper(name[0]);
            while (pos >= 0)
            {

                pos = s.IndexOf(' ', pos + 1);
                name[pos + 1] = Char.ToUpper(name[0]);
            }
            return name.ToString();

        }
        else
            return "unknown";
    }

    public String businessType(String s)
    {
        if (s == null)
            return "business";
        else
            return s;
    }

    public string employeeNum(string d)
    {
        if (d == "0")
            return "unknown number";
        else
            return d;
    }

    public string yearFounded(string d)
    {
        if (d == "0000")
            return "";
        else
            return " was founded in " + d;
    }
}

 The Class code snipet consist mainly of declarations for making server requests and database querying using linq.The reference link above explains this in detail.The other methods are basically used for string manipulation of the query's entities. This is the same strategy I used to create the other classes.

I also used the reliable Google Maps API  V3 to display the company location.  

Points of Interest 

A fellow developer friend of mine had earlier told me that the time frame of the challenge was pretty short but upon delving into the magic of windows azure cloud services I got to realize that it makes the developers life easy.

I am a mobile game development ,but what I learned from this contest is that every experienced developer can spend less time with setting up his/her environment to request data from a server but instead invest that time in creating a user centered application design (ie the Human -Computer interaction aspect of things).I did my best to create a unique and portable user interface to reflect the caliber of an application that it truly is.

This is a screen shot of the Application:

 

  The App was deployed on the windows Azure cloud platform. For details on how to do that see:http:Deploying an ASP.NET App to Windows Azure.

 Please find locust on the following server instances

http://locust.cloudapp.net/webform1.aspx   

Extensibility-Future Improvements

Based on the ease of obtaining data from Windows azure data market  coupled with the modular nature of  ASP.NET's  components , a couple of functionality  can easily be added to make the application more effective,They are outlined as follows.

1. Finding available real estate around the area of a specific business and the distances from the business  (this can be done quite easily if the data was available on windows azure market place.

2.Find the schools in the path between a real estate and a firm(this can actually be implemented using D&B data but I was not able to query using company descriptions and in fact it is would be time consuming to implement such a functionality if assuming there was no set back.I must confess that this functionality , would have definitely made the application a biggie.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)