PolicyFlow is a visual interactive system for exploring the time-evolving patterns of policy adoption. Our tool especially serves as a comprehensive tool to help overview of US state policies over 50 states. Our tool includes:
- 764 state policies spanning over 300 years (1691-2017)
- Those policies encompass legislations that had a great impact in history, such as medicare, abortion ban or gun control
- 18,000 policy adoption cases, each of which consists of (state, year, policy) (See the link for latest release and details about the dataset)
- Overview: provides the underlying policy diffusion network of states as shown in (a) (colored by regions) inferred from the trajectory of policy adoptions
- Context: helps users explore a context of an interest by adjusting categorical and topical, temporal and geospatial (shown with the resulting network in (c) from multiple filters)
- Structural details: allows a highlight of specific structural details in the inferred relationships (in (d))
- Assessment: supports to compare and evaluate the inferred general pattern for multiple policies against actual adoption cases for a policy
- Socio-economic attributes: allow users to analyze how such state attributes such as total population, minority diversity, citizen ideology, etc may be correlated to the influence of states.
More detailed introduction can be found in the introductory video:
Ahn, Y., & Lin, Y. R. (2020). PolicyFlow: Interpreting Policy Diffusion in Context. ACM Transactions on Interactive Intelligent Systems (TiiS), 10(2), 1-23.
Clone the repository.
https://github.com/chukunx/policyflow
cd policyflow
The frontend is running on Backbone.js, D3.js v3.5.16
and v4.2.2
, Bootstrap v3.3.7
, webpack v2.2.1
, and other tools.
-
Install dependencies, with
npm
do:npm install
-
Build
-
For development, do:
npm run dev
By this,
webpack
will watch all file changes, and automatically packjs
and resource files to/app/static/
, template files to/app/templates/
. -
For deployment, do:
npm run build
By this,
webpack
will minify the code bundle to reduce loading time. And it won't watch for changes.
-
Notes
The backend is powered by Flask. To begin with, make sure you are under /app/
.
-
Install dependencies.
You may want to create an
virtualenv
for this app, orpip install
all dependencies directly.# create virtual env virtualenv env # activation source env/bin/activate # install dependencies pip install -r requirements.txt
-
Compile the netinf executable.
Please refer to notes here to compile the executable. This step is required.
-
Dump and connect to database.
A dump file is required to setup a database at localhost.
Then config Flask's access to database by create a config file named
_config.py
under/app/
with following content:import os basedir = os.path.abspath(os.path.dirname(__file__)) # supposing "diffusion2017vis" as the database schema name, 3306 as its port SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://[your_database_user_name]:[your_database_password]@localhost:3306/policyflow' SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') SQLALCHEMY_TRACK_MODIFICATIONS = True # set to False to disable database logs in console SQLALCHEMY_ECHO = False
-
Start the server.
Start the server by executing
/server.py
.
Everything should be ready now, check out http://localhost:63001 in your browser.