Coder Social home page Coder Social logo

cityofboston / 311 Goto Github PK

View Code? Open in Web Editor NEW
17.0 13.0 6.0 4.17 MB

New web portal for BOS:311

Home Page: https://311.digital-staging.boston.gov/

License: Other

JavaScript 97.82% HTML 1.58% Shell 0.45% Dockerfile 0.15%
react mobx graphql javascript boston-311 open-311 311 city boston city-government open-source cityofboston gov government civic-tech smart-cities doit-boston salesforce eslint open-data

311's Introduction

City of Boston

The source code for the future 311.boston.gov.

Build Status codecov Greenkeeper badge

Developers

This is a Node project using the Next.js framework for server-side rendering.

  • Development Server: npm run dev http://localhost:3000/
  • React Storybook: npm run storybook http://localhost:9001/
  • Gulp: npx gulp watch
  • Tests: npm test or npm test -- --watch
  • Lint: npm run lint (uses ESLint --fix to fix common style errors)
  • Typecheck: npx flow

Getting started

Make sure you have at least Node 8.2 installed, preferrably with nvm or equivalent so you automatically pick up our .nvmrc file. Also, npm >= 5.3 (installed by default with Node 8.2 and up) and gulp-cli.

  1. Get the Open311 api_key and URL from a friend
  2. Copy .env.sample to .env and fill in the endpoint and keys
  3. Get other API keys: Mapbox, Searchly, &c. and put them in .env
  4. npm install
  5. npx gulp watch
  6. npm run dev
  7. Visit http://localhost:3000/ in your browser

JavaScript

This project uses Babel at the “latest” preset to include ES2015–17, as well as the “next/babel” preset.

Please make full use of:

Code style is enforced by ESLint, which can be run (in --fix mode) with npm run lint. Committed code must contain no errors or warnings. On a per-file basis, certain errors may be turned off. For example, to keep a class-based component:

// eslint react/prefer-stateless-function: 0

Type-checking

We use Flow type checking to ensure that modules are integrated together in a typesafe way. All source, test, and story files should start with // @flow to enable type checking.

We use flow-typed to provide Flow types for supported NPM modules, and have added our own under /flow-typed/npm.

We use apollo-codegen to generate Flow types for the *.graphql queries and mutations in /store/modules/graphql. These are output as /store/modules/graphql/schema.flow.js and should be used when possible to establish types for GraphQL arguments and responses.

Run npx flow to check types.

Backend

This project starts a Hapi server and uses Next.js’s custom server & routing support to serve HTML and JS. It runs the Apollo GraphQL server to facilitate communication with the client code.

Server-only code, including the GraphQL schema and resolvers, is in the /server directory.

The Gulp graphql:schema and graphql:types tasks are automatically run by gulp watch to update the schema and type files when code in server/graphql changes.

Backend debugging with Charles: env NODE_TLS_REJECT_UNAUTHORIZED=0 http_proxy=http://localhost:8888/ npm run dev

Frontend

The Next.js framework turns components in the /pages directory into entry points for the app. These are wrapped in higher-order components to provide common setup for our store and Glamor CSS setup.

The MobX store is configured in the /data/store directory. Access to the GraphQL backend is mediated through the function modules in /data/dao.

Components and containers are organized under /components by page.

For UI-focused development, use React Storybook by running npm run storybook and visiting http://localhost:9001

Local use of patterns library: After running gulp and npx fractal start -- --watch in the patterns directory, change stylesheets.json to reference https://localhost:3001 instead of cob-patterns-staging.

Public domain

This project is in the worldwide public domain. As stated in LICENSE:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

Contributions

If you're interested in helping this project, there are three ways to help. Be sure to checkout our Guide to Contributing.

311's People

Contributors

fionawhim avatar greenkeeper[bot] avatar greenkeeperio-bot avatar matthewcrist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

311's Issues

Designs for All Data types

  • Get list of all data types
  • Send it to Sebastian
  • Waiting on more designs

Data Types

  • Single Value List (select dropdown)
  • Multi Value List (checkboxes)
  • String (single line)
  • Datetime
  • Text (text area)
  • Informational (help text)

Use ArcGIS geocoder

  • Write conversion between WGS84 (web mercator) and EPSG 6492 (Massachusetts)
  • Add geocoder to GraphQL
  • Use GraphQL rather than Google

Walk back Redux

Move data-fetching from Redux to getInitialProps to simplify the app.

Select Box

Need a fancier select box implementation to use instead of the browser, to hit the style that we're looking for.

Consider adopting rakt

rakt might give us more control over app structure and obviate the need for a GraphQL endpoint to fetch / submit data. Will look into this more as rakt develops.

404 page

Currently we're returning JSON for a 404

See public service requests

Current UI has ways of seeing existing service requests. We need design and implementation to bring this to new 311.

Auto-Filtered Service List

Machine learning model to interpret description and filter the list of service requests.

Data team (Luis, Andrew) will build a model, support an API service (probably on AWS Lambda). 500ms SLA for requests.

Model to be built daily at first.

MVP of service estimated at March 24 April 11.

Integrate ESLint and Flow into tooling

  • precommit hook that runs eslint --fix on the code
  • reporting of lint warnings and errors
  • reporting of Flow errors

The last two could maybe be reported in a precommit or prepush hook, but should also show up on Travis.

Location picker

Google Maps–powered location tooltip picker step in the report flow.

  • Add picker
  • Post location to backend

location picker

Date type picker

  • DATE questions
  • Add time picker to DATETIME
  • Validation for browsers that don’t support the custom control

MobX Exploration

Trying out using MobX over Redux for more approachable state management.

Cache service metadata on client

Switching from stage to stage in the submit flow will currently cause re-fetches of the same metadata.

Should cache services in Redux so that they can be prefetched and also to speed up navigating through the flow.

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.