Skip to content

An API that quantitatively evaluates politicians based on their social media presence.

Notifications You must be signed in to change notification settings

o-wth/politirate-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

See https://github.com/o-wth/politirate/tree/master/v3 for the monorepo.

API

Stack

Routes

A score dictionary is defined as a dictionary containing the various subscores for a single post.

  • /politicians returns a list of U.S. politicians, where each politician is represented by a dictionary containing the name, the party, the state, Twitter username, etc.
  • /posts/<politician> returns a list of all the politician's social media posts, from all platforms
  • /score/<politician> returns a politician's score, which is a function of their score dictionary over many dates, with more recent dates weighted more than older dates
  • /history/<politician> returns a dictionary of the format {date: score_dictionary}
    1. when a user makes a request to this route, we look in the MySQL database and /posts/<politician> to see if the politician has posted anything new since the last cache
    2. if so, we recalculate the score for the politician's latest posts, returns this value to the user, and cache this value in the DB
    3. if there were no new posts since the last cache, we simply return the data in the DB

Releases

No releases published

Packages

No packages published

Languages