Skip to content
Jacob LeGrone edited this page May 9, 2016 · 32 revisions

Table of Contents

Developing

Logging in as an admin user

By default, two admin level accounts are created by the seed script:

  • username: admin@localhost.com, password: password (a normal admin user)
  • username: superuser@localhost.com, password: password (an admin user with elevated privileges)

Log in with either of those credentials when you first go to localhost:3000 and then check out localhost:3000/admin.


Seeding the database

If you ever want to re-seed the database, run npm run seed while the server is running.

Alternatively run /.setup-osx or ./setup-linux while server is not running.


Installing packages

If you need to add a new package, run npm install package-name --save.

Also run npm shrinkwrap after every install or version change for a given package. If you encounter errors you'll need to fix them and re-run npm shrinkwrap until successful. This command generates a new npm-shrinkwrap.json file which is used to sync package versions between contributors and deploys.


Writing components

We use ES2015 classes to declare components.

export default class Hello extends React.Component {
    static propTypes = {
        salutation: React.PropTypes.string,
        name: React.PropTypes.string.isRequired
    }

    static defaultProps = {
        salutation: 'Hello'
    }
    
    constructor(props) {
        super(props)
        this.state = {
            // .. component state
        }
    }
    
    render() {
        return <div>{this.props.salutation} {this.props.name}</div>
    }
}

Each new component should declare its prop types, and if default property values are required, those should be explicitly defined as well rather than in the render function.


Creating & running database migrations

To create a new migration, run

npm run knex migrate:make new_migration_name

A new migration will be created at src/backend/data/migrations/timestamp_new_migration_name.js.

When you're done writing your migration, run it with

npm run migrate

For more information, see the knex.js migrations docs: http://knexjs.org/#Migrations

Frequently Asked Questions

Finding issues to work on

You can jump right in to see issues that are ready to be tackled by looking at the status-ready issue label. If you are just getting started with the project, also check out the newbie-friendly label.

You can also see an overview of where all of our issues stand at https://waffle.io/Bernie-2016/ground-control


Communication & requesting help

If you are feeling stuck/aren't familiar with any of this and want some help, please don't bang your head against a wall! Talk to me (jacoblegrone@berniesanders.com, @jlegrone in the BernieBuilders Slack).


What does this do and how do I get started?

To get started with Ground Control, once it's running, go to http://localhost:3000/admin. From there, you can see the events administration section and the call assignment creation section. To create a call assignment, do the following:

  1. Make a survey in Blue State Digital. If you are developing on Ground Control, ask Saikat for access to the BSD testbed. Make sure to use the "GROUND CONTROL - Survey" wrapper.
  2. If you wish Ground Control to be able to do dynamic stuff with the Blue State Digital fields, tag the fields with something within square brackets at the beginning. E.g. [event_id]Here's a field label.
  3. Make a constituent group that you wish to be the target of your phonebanking assignment in BSD (or figure out a SQL query to use).
  4. Go to http://localhost:3000/admin/call-assignments, click Create, and enter the BSD IDs of your survey and target interviewee group in the form.
  5. Click create

Now, if you go to http://localhost:3000 and signup/login, you shoul see your assignment on the left side. Click it to test it out and start making calls!


What stack is this project using?

We are using PostgreSQL for our database. On top of that, we are creating a GraphQL API. GraphQL is designed to make it easy to build APIs for objects that have many relationships. On the frontend, we are using React for the view layer, and React talks to GraphQL via Relay.


What's the end game?

The grand purpose of Ground Control is to be:

  1. A central portal for volunteers who want to get involved with the campaign and an admin interface to manage volunteers. We want this to be the landing page on the homepage as soon as someone wants to volunteer for Bernie.

  2. The central routing point/API for applications to integrate with the CRMs the campaign uses (BSD and VAN)

  3. Be a repository for data that does not fit neatly into BSD and VAN and give people outside of our system access to this data as well

  4. An effort to build out more organizing tools on top of what we already have (which leads to the data in #2).


What are these "CRMs" the campaign uses?

BSD is Blue State Digital and VAN is Voter Activation Network. BSD is basically a CRM including a mailer, way to create surveys, and way to look at signup data. VAN is a giant database of voter information that is used for canvassing/voter outreach efforts. Here is a rough diagram of how it fits together. Rectangles are things that exist, circles are things we are building: https://gomockingbird.com/projects/0govthz/sXMAyD.

VAN and BSD have their own APIs, and currently Ground Control makes use of the BSD API heavily for its syncing purposes.