Data Analysis on Department of Consumer Affairs Charges
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
The Charges Data Set
The NYC Open Data project provides theΒ Department of Consumer Affairs data from 2016-2017.Β Β The Department of Consumer Affairs was started in 1969 with the goal to "ensure compliance with local consumer protection and licensing laws, and State and federal regulations."Β They oversee almostΒ every industry in NYC.Β This data set describes the charges brought against NYC businesses and through analysis, can reflect how the enforcement plays out in practical terms.
It contains 50, 000 rows, which includes location data, some categorical information such as borough and business category, but not too much numerical information.Β This project had to rely heavily upon count of charges for the visualizations.Β A lot of time was spent on parsing through the Charge descriptions which were challenging to categorize.
Sample
Here's a sample of what the Charge descriptions looked like:
"NYC Admin Code Β§ 20-822(a) - SALE OF EXPIRED MEDS: Β BUSINESS OFFERED FOR SALE OVER-THE COUNTER MEDICATION LATER THAN EXPIRATION DATE ON THE LABEL."Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
"NYC Admin Code Β§ 20-708 - STORE DID NOT CONSPICUOUSLY DISPLAY THE TOTAL SELLING PRICE, AT POINT OF DISPLAY, FOR ITEM."Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
"6 RCNY Β§ 5-70(a) - NO PRICE LIST FOR SERVICES DISPLAYED"Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
"6 RCNY Β§ 5-70(a) - PRICE LIST NOT DISPLAYED CONSPICUOUSLY"Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
I parsed the first part which describes the rule and is before the dash of the description, then counted the number of charges vs each categorical description.Β I would have liked to generalize about what each rule was, and turn this into a category as well.Β However, I realized that would skew the analysis since for some categories, it's difficult to conclude what the general description might be.Β I also tried to find a source about the rules which I could then cross reference, but only found this searchable document which is difficult to scrape data from.
Data
Are you an activist citizen who is concerned about what regulationsΒ your local businesses are required to follow?Β Or perhaps a policy maker who is interested in the applicability of the current laws and rules that protect consumers?Β Would it be surprising to discover that most of the charges fall under just a few categories?Β That industries such as pharmacies and tobacco retailers get enforced more heavily?Β Or that more charges were brought against boroughs which have stronger retail business climates?Β In analyzing the data, I discovered these kinds of trends.
The App
More insights can be garnered by visiting the app and manipulating the parameters.Β I chose a very simple design and intended that the parameters could be applied to multiple plot types which can then be viewed by navigating through the tabs.Β Then, I left it in the user's control to decide how many "top" industries or charge types they were interested in analyzing.
I also provided a word cloud to highlight what the most dominant words in the text of the charge descriptions.Β I used some R packages to remove the extraneous English words and additionally, I removed words like "near", "required" and "upon" which don't relay any meaning.
The Code
And now without further ado, please feel free to peruse my code.