Coder Social home page Coder Social logo

ren0nie0 / police-data-trust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeforboston/police-data-trust

0.0 0.0 0.0 109.65 MB

A national archive of police data collected by journalists, lawyers, and activists around the country.

License: MIT License

Python 21.30% Shell 0.42% Batchfile 0.05% Dockerfile 0.33% JavaScript 2.93% TypeScript 44.82% CSS 5.93% Mako 0.12% SCSS 0.22% Jupyter Notebook 23.30% HTML 0.55% Procfile 0.01%

police-data-trust's Introduction

police-data-trust

To get started:

  1. Fork a copy of the main repo to your GitHub account.

  2. Clone your fork: git clone [email protected]:YOUR_GITHUB_NAME/police-data-trust.git

  3. Add the main repo to your remotes

cd police-data-trust
git remote add upstream https://github.com/codeforboston/police-data-trust.git
git fetch upstream

Now, whenever new code is merged you can pull in changes to your local repository:

git checkout main
git pull upstream main

Installation (Full Application)

This method uses Docker to run the complete application stack.

  1. Make sure that Docker is installed on your machine.

  2. Create a .env file in the root of your local project folder, and add your preferred PostgreSQL username and password:

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=police_data
POSTGRES_HOST=db
  1. Build and run the project with docker-compose build; docker-compose up -d; docker-compose logs -f app

Installation (Frontend Only)

This method runs the frontend natively on your computer and does not require a running backend, which can be convenient.

  1. Make sure that you have node 16+ and either npm 7+ or yarn installed.
  2. Follow the install instructions in the frontend directory.

Documentation

Docs

Code Standards

Typescript Style Guide

This style guide is intended to act as a quick reference for the most common scenarios

Custom Types

For this codebase, we are using interfaces instead of type aliases.

Utilizing Types

  • We are aiming for a loose standard of explicitly typing as little as possible (relying on type inference or third-party library typing files to do the work whenever convenient), but as much as necessary (function params/args are a good example of what the compiler is bad at inferring). Erring on the side of 'stricter than absolutely necessary' definitely works for us!

  • The any type should never be utilized here. Prefer union types in the case of values that are initially null (such as values that come from API calls), or unknown in case of a type being truly impossible to discern ahead of time.

  • When typing primitive values declared with const, explicitly typing them will be necessary to prevent their type from being implied as the literal value of said primitive, rather than it's corresponding data type.

Functions

  • Always use explicit typing in the case of function params and return types.

  • If function parameters don't get modified by the function, strongly consider making them readonly to prevent mutation and have clearer code.

React

  • Prefer the .tsx file extension when JSX is involved, and .ts when it isn't.

Props

  • Refer to the React/TypeScript Cheatsheet for examples of common propTypes.

  • In the case of components that accept other React components as props, prefer typing those as React.ReactNode.

Hooks

  • Prefer type inference for useState for simple cases. If the hook initializes with a nullish value, strongly consider a union type.

  • Since useEffect and useLayoutEffect don't return values, typing them is not necessary.

  • When typing useRef, refer to the React/TypeScript cheatsheet for guidance on your specific situation.

Forms & Events

  • Type inference should be sufficient in the case of inline event handlers.

  • IDE tooling (such as VSCode autocomplete) will offer helpful suggestions for specific event handler types.

  • The React/TypeScript cheatsheet has a list of specific event types.

Organization of props and attributes

Ordering of components โ€”

  • Class definitions
  • Component / imports
  • Event handlers inside class

HTML Props/attributes order:

  • id, class, attributes
  • Like properties alphabetized (?)

Directory structure:

  • Pages: routable containers
  • Shared: components being used/planned to be used in multiple places
  • Compositions: components that have a single/limited specific context

police-data-trust's People

Contributors

acharliekelly avatar alexjball avatar ryanmahan avatar jmstudiosjoe avatar sashamaryl avatar ren0nie0 avatar arutfield avatar dylanesque avatar nancyyang94 avatar logan-dang avatar dwreeves avatar dmalone87 avatar azheng1991 avatar srsexton94 avatar mikeyavorsky avatar stianberghansen avatar darpham avatar lorenmakesgames avatar myavorsky avatar merry3750 avatar e-lipman avatar micahgoodman avatar caseydulong avatar etilden avatar stampeder525 avatar jcockhren avatar mzagaja 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.