Concept The API scrapes headlines surrounding political subjects from news outlet websites and computes Natural Language Processing queries such as sentiment and part of speech tagging.

Poliparse api

This is a personal project which is currently still in progress (POC stage). Anyone interested in using or collaborating on the API should feel free to contact me directly.

The project is a QraphQL API which scrapes headlines surrounding political subjects from news outlet websites and computes Natural Language Processing functions such as sentiment scoring and part of speech tagging. The GraphQL structure makes queries flexible and modular, allowing the user to define the data object they want to receive before making the query - eliminating the many round-trips needed to do the same in a traditional REST API.

Tools:
Backend: GraphQL, GraphQL-Yoga, Tensorflow.js
Deployment: Heroku (WIP)

Stack GraphQL is the interface for communication, with custom modules built on Tensorflow.js coming together to provide the computational business logic the API serves.

QUERIES

The beauty of GraphQL really starts to show once we start working with multi-faceted data. In the PoliParse API, we have a number of data fields which are computed, with more to be added in the future. Using a traditional REST design would mean that users have to make many round trips to fetch the specific data they want, and then format the data in the way they want to consume it. It would also mean creating explicit route definitions for each of those endpoints, which is not an ideal solution for a computational API which is planned to grow and evolve.

Instead, the GraphQL structure allows the user to query only the data they want, and to do so in the format that they want. The relationship-based structure between data nodes makes this possible, and it eliminates the need to duplicate certain data points - establishing a “many to one” relationship, rather than inflating the size of the data stored by repeating data points.


INTEGRATION FLEXIBILITY

The modular, user-defined structure of interacting with a GraphQL API makes it a simple drop-in API to any front-end or back-end project. Being able to filter and query for the exact data you need also makes this a very lightweight integration - with the size of data chunks passed back and forth defined by the developer in their own app, rather than the API developer (me).

Calls to the API can also be made through traditional HTTP endpoints, using the POST method and supplying the query string in the body. This allows for traditional prototyping using a client such as Postman, or even using HTTP request modules/libraries which don’t yet have an explicit GraphQL structure or methods.

DOCUMENTATION & SCHEMA

GraphQL auto-generates an interactive schema explorer, as well as basic documentation. This is useful for exploring a GraphQL API before writing any code - allowing developers to click through the relationships and types defined by the schema and graph. For the PoliParse API, the Schema and Docs interface can be found on the right-most side of the screen, and can be used to explore the different types of data objects that can be queried, and how to do so.

Documentation The GraphQL-generated documentation features an interactive explorer where one can explore the relationships between data nodes and design custom queries.