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.
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.
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.
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.
And now without further ado, please feel free to peruse my code.