Coder Social home page Coder Social logo

rm_stats's Introduction

A web app for visualizing stats related to requested moves (RMs) on Wikipedia.

See the wiki-controversial-titles repository for the code that scraped and parsed the data that gets visualized.

This repo contains client code, written with React (using create-react-app), and a simple API backend written with Flask (app.py/db.py).

Running in development mode

Pre-requisites:

  • pip install -r requirements.txt
  • have node and npm installed (I'm using node v10.16.0, npm v6.9.0)
  • npm install
  • have the csv files produced by the RM scraping/parsing code in ./datasets. Necessary files are: pols.csv, rms.csv, shortcuts.csv, votes.csv. (If you'd like a copy of these files, file an issue and let me know - I'll be happy to upload them to archive.org or something)

Start the API server: python3 -m flask run

Start the js development server: npm run start

In development, the development server proxies requests to the API server, per the proxy key in package.json.

Running in production

The production version of the site is served on Wikimedia's Toolforge server, at https://tools.wmflabs.org/rmstats/

In production, the Flask server (app.py) does double-duty, serving index.html and other static files, in addition to answering API calls under /api/*.

Pre-requisites (all these steps need to take place on Toolforge as the rmstats tool account):

  • clone this repository at /data/project/rmstats/www/python/src
  • set up a python virtualenv as described here and pip install -r requirements.txt
  • copy local datasets/ to /data/project/rmstats/www/python/src/

How it should work

$ npm run build
$ webservice --backend=kubernetes python3.5 start

In practice, the build command fails for utterly inscrutable reasons (sh: 1: react-scripts: not found - an error message with lots of google results, none of which really elucidate the cause of the problem, or offer a solution that worked for me). So instead...

How it actually works

I maintain a parallel branch site in which the contents of the build/ directory are checked in. Rather than building on the toolforge server, I build changes locally, push them to site, and work from that branch on the toolforge server. Yes, this is gross.

rm_stats's People

Contributors

colinmorris avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.