The potential of APIs are huge — from making internal enterprise architectures more efficient to enabling completely new creative services to flourish. Using third party APIs as a basis for a new service enables a team to quickly advance from an idea stage to a finished product. The disadvantage is that you build on a dependency, relying on someone else to maintain and support. In this piece we look at how one specific service is built and how they weigh the pros and cons of integrating third party APIs.
Analyzing Gender Equality in News
Olga Stern wanted to know which gender news media wrote about more — was it mostly men or mostly women? Based on data from just one Swedish newspaper she built a prototype at a hackathon that showed that only 13% of the articles wrote about women. This motivated her to create a full fledged service doing this analysis for several newspapers to spark a discussion about gender equality in media — a discussion that will hopefully bring positive social change.
During a few summer weeks Olga has built Genews.io, at tool that analyzes the gender balance in articles from 16 major Swedish newspapers. The new pool of articles in Genews shows that a bit more than 30% are about women. Fueled by three different APIs (Overview News API, Alchemy API, and Genderize API), Genews is a prime example of what can be accomplished with APIs. Let’s now walk through what API services are powering these analytics.
1) Get News: Overview News API
The first step is to collect all relevant news articles. For this Genews uses the Overview News API. Overview News indexes news articles from digital editions of national and local news as well as trade journals in order to give programmers access to editorial news data. Via the News API, it is possible to search among all the indexed news articles based on keyword, data, language and much more. Currently Overview News continuously indexes news from almost 1000 editorial news sources in Sweden. They are in the process to expand internationally, with the UK as their next market.
Overview News gives Gewnews access to the full text of articles from all the Swedish publications they are interested in. Every few minutes Genews calls the News API and retrieves the articles that have been published during that timeframe.
2) Analyze News: Alchemy API & Genderize API
Once Genews has the full text of the articles, they are put through the Genews analysis engine.
This is done by first counting how many times male and female personal names are used. The articles are run through the Alchemy Entity Extraction API, a Natural Language Processing (NLP) service that can identify and extract mentions of people, companies, cities and other entities from plain text. Genews uses it to get a list of all the personal names used in an article.
Once Genews has a complete list of all personal names mentioned in an article, the engine determines if the name is male or female. To do this they use the Genderize API, which for each name returns the likely gender as well as the probability that they are right. Since some names can be used by both men and women, if the probability is not 100% that it belongs to a specific gender Genews ignores that particular name.
Finally Genews finds all female and male pronouns in the text — words like “sister,” ”grandfather,“ ”boy,“ ”her,” and so forth. All these pronouns that refer to women or men tell Genews a lot about what the text is about. Based on the gender of all the people mentioned in an article as well as what pronouns are used, Genews then calculates the gender percentages per article.
3) Present Result with Visualizations
Why Genews is Built on APIs
“I’ve been a developer for seven years and during those years I have learned one thing — not to build everything myself”
Says Olga, as an explanation of why she is using three different APIs to build Genews. She could have built and maintained a news indexing engine to retrieve news articles. She could have developed a NLP algorithm to analyze the articles and determine the gender focus of each article. However, doing that would have been a lengthy ordeal. Instead “I’m letting other people focus on what they do best so I can focus on doing what I do best on top of that”.
Simply put, the social experiment that is Genews would not exist without external APIs that fuel several critical parts of the service. This is also true for thousands of other services. Take the Uber app with all its API integrations for mapping, location, optimization, payment, rating, and feedback services. Similarly outsourcing parts of your application to third party APIs is tempting, as you can harness so much functionality so easily and quickly.
Who Owns your Availability?
However, there are inherent risks with using third party APIs as pointed out in First or Third Party APIs. The price you pay for integrating any external service is that you are putting an incredible amount of trust in a third party:
- You trust them to deliver a reliable service.
- You trust them to maintain that service.
- You trust them to notify you of changes with transparent updates that allow the proper time to respond to versioning.
- You trust them not to change their prices or terms of service so much that it negatively impacts your service.
Olga recommends visiting the site Who Owns My Availability? and seriously consider the answer before starting to integrate third party APIs.
“If I’m taking another API it means I am having another dependency that I can’t do anything about. If it’s worth it for you, then go ahead and do it. Most of the times it is, and it adds functionalities to your service that you wouldn’t have the possibilities to have otherwise.”
Genews is a relatively small service. Even with a small team, however, they plan to expand internationally as well as commercialize their service by selling gender equality analysis reports to news publications. For this type of service, Olga’s recommendation is spot on. Without the Overview News API, the Alchemy API and the Genderize API, Genews would take far too long to build and would be too burdensome to maintain.
For more complicated services with more available resources, it is not always such an easy decision. In some cases it might make sense to develop key parts of the application in-house. This does of course come with it’s own set of risks and costs as these features not only need to be developed once but also maintained throughout the service’s entire lifecycle. The most important thing for everyone using third party APIs, i.e. most of us, is to be very aware of the risks alongside opportunities.
Genews is a relatively small service with simple functionality, but it is a model of how an impactful service can be constructed by outsourcing some complexity to existing technologies. Use available puzzle pieces, i.e. APIs, to solve problems you are not an expert in solving. With so many APIs available, finding a useful API should be quick and easy. Just be aware that the danger of doing so is that you depend on those APIs to be working for your service to function.
What have you built with APIs? What APIs have you used and why? Share your story with us in the comments!
[Disclosure: Andreas Krohn is a founder of Overview News]