Tags : SQL

Data matching uncovers convict school cops

Until recently, getting arrested in Philadelphia for possession of crack cocaine and admitting drug dependency would not preclude being hired or continuing to work as a police officer in the public school system.

A month-long, data-driven investigation  by The Philadelphia Inquirer found that in more than a dozen cases school police were themselves getting into trouble with the law. Even an open bench warrant issued for one officer charged with a drug offense failed to trip the school district's alarm.

In another case, an officer who showed up in court to face charges after her second arrest for drug ...

Read more ...

Scouring MAUDE data to find faulty metal hips

New York Times reporter Barry Meier knew lawsuits against the manufacturers of all-metal artificial hips were on the rise. But it wasn’t until I queried a balky Food and Drug Administration database that he was able to confirm that all-metal hip implants were quickly becoming the biggest and costliest medical implant problem since Medtronic recalled a widely used heart device in 2007.

The FDA collects voluntary reports from patients, health care providers and medical device manufacturers about problems experienced with specific devices. The federal agency compiles the reports of deaths, injuries and product malfunctions in a database known as ...

Read more ...

First Venture: Local eateries with serious health violations

Every day, thousands of Muskegon County residents pour into their favorite restaurants to dine with friends and family. Yet until now, little was known about whether those restaurants followed practices aimed at preventing people from getting sick.

While looking through more than 22,000 electronic health-inspection records spanning four years, I found numerous instances where restaurants repeatedly violated rules that help prevent foodborne illness. Schools, hospitals and food stands were cited for breaking the rules, too.

Raw chicken and crabmeat sitting out at room temperature. Food kept past its expiration date. Cockroaches, mice and fruit flies living in kitchens. Employees ...

Read more ...

SQLite: simple, open-source database manager

Your average CAR geeks - especially the old timers - follow a predictable route in tools they use for data analysis and sharing.

You start with Microsoft Excel spreadsheets, and everything’s going fine. But then someone tells you about relational databases, and suddenly you notice all of the things you can’t easily do in Excel.

Step up to Microsoft Access database manager and pretty soon you’re joining tables right and left, slipping terms like "Group By" and "normalization" into conversations and generally feeling pretty good about yourself.

But at some point, someone in your newsroom looks over your shoulder ...

Read more ...

Nursing home promises fall short

When the California legislature passed a law to drastically increase funding to nursing homes, it came with a promise that worker wages would rise, staffing would soar and patient care would improve.

The law passed in 2004. When I started working on investigative articles for California Watch in the fall of 2009, it seemed like a good idea to take a close look at whether the promises attached to hundreds of millions of dollars came true.

What we found was noteworthy. State and federal funders poured an additional $880 million into nursing homes over five years, moving the annual funding ...

Read more ...

Sharing code snippets

Folks doing CAR are blessed with a wealth of tools, which is both a blessing and a curse. For example, I frequently use two database programs, MySQL and PostgreSQL, at work. While similar in most respects, they have slightly different syntax for some common tasks such as string functions. You see this situation played out on the NICAR-L listserv all the time, when someone asks a question that usually starts with, "I know I've done this before, but I can't seem to remember the right syntax." Keeping snippets of SQL or Excel IF statements lying around in files ... Read more ...

Flying with SQL subqueries

In most cases, when you want to match data from one table in a database to another, a common approach is to use a JOIN clause in your query. For example, if you had a list of candidates in one table, and a list of donations made to candidates (with one field having a candidate ID in it), you'd probably either use JOIN clause or a WHERE clause to match them together: (pseudo-code) SELECT * FROM candidates, donations where candidates.candidate_id = donations.candidate_id; But simple joins aren't the only technique available to journalists trying to learn more about their ... Read more ...

Spatial queries unlock gas price trends

Chalk it up to the power of having a beer with a colleague in a creative environment, building a strong enough relationship with a source to ask for data and the willingness to apply mapping to a subject usually confined to business/consumer affairs reporting. The Enquirer’s "Gas Price Secrets Revealed" turned out to be a mapping story that used GIS as a key tool, but it could’ve appeared even without a map being published. The series, which ran over seven days, dispelled or confirmed several preconceptions about street retail gas pricing, while getting at some deeper issues ...

Read more ...

Basic queries show nationwide trends in HMDA data

It began with an email while I was on vacation. “Not to distract you,” my boss wrote, “but wanted to pass along that when you get back, you’re going to be taking on a … massive nationwide subprime data crunch.” At first, I wondered what I had done to deserve such a chore. It should have been obvious: Five months earlier, I had abandoned my job for a week to attend a CAR Boot Camp, where I muddled through the lessons, returned to work bragging about how much I had learned, but then did little to show I had spent ...

Read more ...