Skip to content

Commit 582fbeb

Browse files
authored
Merge pull request #73 from CodeForBaltimore/revjtanton/issue-58
docs: Updating docs
2 parents cf0703a + 6e9a0dc commit 582fbeb

24 files changed

+463
-594
lines changed

README.md

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1-
[![Build Status](https://travis-ci.org/CodeForBaltimore/Bmore-Responsive.svg?branch=master)](https://travis-ci.org/CodeForBaltimore/Bmore-Responsive) [![codecov](https://codecov.io/gh/CodeForBaltimore/Bmore-Responsive/branch/master/graph/badge.svg)](https://codecov.io/gh/CodeForBaltimore/Bmore-Responsive) [![Known Vulnerabilities](https://snyk.io/test/github/CodeForBaltimore/Bmore-Responsive/badge.svg)](https://snyk.io/test/github/CodeForBaltimore/Bmore-Responsive)
2-
<!-- TOC -->autoauto- [1. Bmore Responsive](#1-bmore-responsive)auto - [1.1. Documentation](#11-documentation)auto - [1.1.1. API Spec](#111-api-spec)auto - [1.1.2. Database Documentation](#112-database-documentation)auto- [2. Setup](#2-setup)auto - [2.1. Node and Express setup](#21-node-and-express-setup)auto - [2.2. Environment variables](#22-environment-variables)auto - [2.3. PostgreSQL](#23-postgresql)auto - [2.3.1. Sequelize](#231-sequelize)auto - [2.4. Docker](#24-docker)auto- [3. Using this product](#3-using-this-product)auto - [3.1. Testing](#31-testing)auto- [4. Sources and Links](#4-sources-and-links)autoauto<!-- /TOC -->
3-
# 1. Bmore Responsive
1+
[![Build Status](https://travis-ci.org/CodeForBaltimore/Bmore-Responsive.svg?branch=master)](https://travis-ci.org/CodeForBaltimore/Bmore-Responsive) [![codecov](https://codecov.io/gh/CodeForBaltimore/Bmore-Responsive/branch/master/graph/badge.svg)](https://codecov.io/gh/CodeForBaltimore/Bmore-Responsive)
2+
3+
<!-- TOC -->
4+
5+
- [Bmore Responsive](#bmore-responsive)
6+
- [Documentation](#documentation)
7+
- [API Spec](#api-spec)
8+
- [Database Documentation](#database-documentation)
9+
- [Setup](#setup)
10+
- [Node and Express setup](#node-and-express-setup)
11+
- [Environment variables](#environment-variables)
12+
- [Example .env](#example-env)
13+
- [PostgreSQL](#postgresql)
14+
- [Sequelize](#sequelize)
15+
- [Docker](#docker)
16+
- [Using this product](#using-this-product)
17+
- [Testing](#testing)
18+
- [Sources and Links](#sources-and-links)
19+
20+
<!-- /TOC -->
21+
22+
# Bmore Responsive
423
An API to drive disaster and emergency response systems.
524

6-
## 1.1. Documentation
25+
## Documentation
726
We've included a `docs` folder with a template [Tech Spec](/docs/Tech_Spec.md) and [Best Practices](/docs/Best_Practices.md) document, though using Github's Wiki capabilities is also a good idea. This will get you started with documenting your project. Other documents and relevant information that has no other place can live in the `docs` folder. Replace this paragraph with a brief breakdown of what you've included in your `docs` folder.
827

9-
### 1.1.1. API Spec
28+
### API Spec
1029
Our API spec is on Swagger. You can view it here https://app.swaggerhub.com/apis/codeforbaltimore/bmoreResponsive/1.0.0#/ or you can find the `swagger.json` file in our `docs` folder and use it via http://localhost:3000 when the app is running locally.
1130

12-
### 1.1.2. Database Documentation
31+
### Database Documentation
1332
Our database documentation can be found in our `docs` folder under `database.csv`. This documentation was created using SchemaSpy. Instructions for use can be found here https://github.com/bcgov/schemaspy
1433

15-
# 2. Setup
34+
# Setup
1635
A `Dockerfile` and `docker-compose` file have been included for convenience, however this may not be the best local setup for this project. For more information on how to use Docker with this project, please see the [docker section](#24-docker).
1736

1837
To work on this project you should have:
@@ -21,14 +40,14 @@ To work on this project you should have:
2140
- Docker (optional)
2241
Once you have the prerequisite software installed you can proceed to setup this application.
2342

24-
## 2.1. Node and Express setup
43+
## Node and Express setup
2544
This application is designed to work as an API driven by Express. To setup your environment first you must install all required dependencies by running the following command from the root of your project directory:
2645
```
2746
npm install
2847
```
2948
Once all dependencies are installed you will need to setup some environment variables to interact with your database and application.
3049

31-
## 2.2. Environment variables
50+
## Environment variables
3251
You will need to set some local environment variables to run this application. This is true even if you're using Docker.
3352
```
3453
touch .env
@@ -57,7 +76,19 @@ _We do not recommend using the default options for PostgreSQL. The above values
5776
- `DATABASE_HOST`: The IP address Docker is running on. You can find this by running `docker-machine ip` but it's usually `192.168.99.100` instead of `localhost`
5877
- `DATABASE_URL`: This will need to be adjusted as well, for example `DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres` would become `DATABASE_URL=postgres://postgres:[email protected]:5432/postgres`
5978

60-
## 2.3. PostgreSQL
79+
### Example .env
80+
To make this easier included below is an example `.env` file using all default values. ***We highly recommend*** you use custom values, but this should clarify what is needed for this to run.
81+
82+
```
83+
NODE_ENV=development
84+
PORT=3000
85+
DATABASE_SCHEMA=public
86+
JWT_KEY=test123
87+
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
88+
BYPASS_LOGIN=true
89+
```
90+
91+
## PostgreSQL
6192
***You will need a PostgreSQL database running locally to run this application locally.*** You may setup PostgreSQL however you wish, however we recommend using Docker using the instructions found here: https://hub.docker.com/_/postgres
6293

6394
If you are using the Docker method you may spin up your database layer by running this command:
@@ -67,7 +98,7 @@ docker run -d -e POSTGRES_PASSWORD=<your chosen password> -p 5432:5432 postgres
6798

6899
If you're running a database in another way then we trust you can sort it out on your own because you're awesome :sunglasses:
69100

70-
### 2.3.1. Sequelize
101+
### Sequelize
71102
To properly start the application the database needs to be built by Sequlize ahead of time. To do that run the following commands
72103
1. You must create your database tables without running the application by running `npm run db-create` first.
73104
2. _optional_ You can now seed your database if you wish by running `npm run db-seed`.
@@ -78,7 +109,7 @@ To create new models, migrations, and seeders you _must_ use the Sequelize CLI c
78109
- `npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string` - Creates a model under `/src/models` and a migration script.
79110
- `npx sequelize-cli seed:generate --name demo-user` - Creates a seeder for the `User` model and migration previously setup.
80111

81-
## 2.4. Docker
112+
## Docker
82113
To use the `docker-compose.yml` file included you will first need to set [environment variables](#22-environment-variables). You **MUST** set your `DATABASE_HOST` to `db` to use the `docker-compose` solution.
83114

84115
If you are running your own database, but want to use the `Dockerfile` you will need to run that this way:
@@ -97,16 +128,16 @@ You can manually set the environment variables and not use a `.env` file by sett
97128
-e DATABASE_URL=<your connection string>
98129
```
99130

100-
# 3. Using this product
131+
# Using this product
101132
You may use this product to create and manage users for your front-end. More to come!
102133
To run the application--after the above steps are completed--run `npm start`.
103134

104-
## 3.1. Testing
135+
## Testing
105136
To test your code you may write test cases to `./index.spec.js` and then run the tests with `npm test`.
106137

107138
To check your linting you may run `npm run lint` and to format and automatically fix your formatting run `npm run format`.
108139

109-
# 4. Sources and Links
140+
# Sources and Links
110141
We are also building a front-end application called [Healthcare Rollcall](https://github.com/CodeForBaltimore/Healthcare-Rollcall) to interact with this backend API. To view that project, or to contribute to it, please visit the repo here: https://github.com/CodeForBaltimore/Healthcare-Rollcall
111142

112143
We will be including multi-repo build processes with the front-end that will reference this project.

docs/Best_Practices.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Best Practices
2-
Code for Baltimore projects should be built with the intention of deploying on [Heroku](https://heroku.com). For details on Heroku Best Practices see their [developer documentation](https://devcenter.heroku.com/articles/node-best-practices).
2+
Code for Baltimore projects should be built with the intention of deploying on [Heroku](https://heroku.com) or [AWS](https://aws.amazon.com/). For details on Heroku Best Practices see their [developer documentation](https://devcenter.heroku.com/articles/node-best-practices).
33

44
## Project Management
55

6-
We are using Github Issues to track outstanding issues and work for projects.
6+
We are using Github Issues to track outstanding issues and work for projects.
77

88
### Projects
99

@@ -38,9 +38,6 @@ Example: Google has openly published style guides for many languages in wide use
3838

3939
Static code analysis tools should be used when possible, to monitor and improve code quality. This may be integrated in the local development environment, automated repository commit checks, automated CI/CD pipelines, or other steps in the code development process.
4040

41-
### SonarQube scanning
42-
Before committing or pushing any code changes those changes should be scanned with SonarQube. For convenience a `docker-compose` file has been included with this repository to facilitate local scans so that clean code can be checked and pushed before the deployment scans. See the [README](/sonarqube/README.md) in the sonarqube folder for more information.
43-
4441
## Git and Branching
4542

4643
All code work should be done in an isolated or feature branch off of the `master` branch. Before starting work on new code, developers should create their feature branch using a standard naming convention determined by the project.

docs/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!-- TOC -->
2+
3+
- [Tech Spec](#tech-spec)
4+
- [Overview](#overview)
5+
- [Scenarios](#scenarios)
6+
- [COVID-19](#covid-19)
7+
- [Automatic Checkin](#automatic-checkin)
8+
- [Organized Response](#organized-response)
9+
- [Non Goals](#non-goals)
10+
- [Minimum Viable Product](#minimum-viable-product)
11+
- [Components](#components)
12+
- [API](#api)
13+
- [CI/CD](#cicd)
14+
- [Data](#data)
15+
- [Application Architecture](#application-architecture)
16+
- [Roadmap](#roadmap)
17+
- [Contact Info](#contact-info)
18+
19+
<!-- /TOC -->
20+
21+
# Tech Spec
22+
Bmore Responsive is a Contact and Response Management System (CRMS) and API. This document will describe the application in some detail.
23+
24+
## Overview
25+
This application will allow users to add and update contact information for individuals and entities. Additionally, the system will facilitate tracking of entity status and any other pertinent information. The data collected can be used by municipalities to organize response efforts in a disaster or crisis situation.
26+
27+
## Scenarios
28+
This application and API can be used in a few different ways.
29+
30+
### COVID-19
31+
During the COVID-19 Pandemic the City of Baltimore needs a way to check-in with healthcare providers to ensure they have all of the supplies they need, if they have any patients sick with the virus, if anyone is in quarantine, etc.
32+
33+
Many healthcare facilities have a few members on staff, however the contact information for those individuals may be out of date or the facility may have experienced some changeover since the last checkin.
34+
35+
Using the API and a front-end, the City of Baltimore would be able to keep track of the facility's status via multipule contact points in an organized and efficient way.
36+
37+
### Automatic Checkin
38+
Facilities may not have time for phone calls, and the number of available city workers may not be sufficient to check in with all providers during an emergency.
39+
40+
Using our API the providers can securely check-in using a web form on their own. One-time use logins can be sent on regular intervals to preferred contacts for each facility. This can allow contacts to update facility status on their own time without the need for city workers to contact them directly.
41+
42+
### Organized Response
43+
City workers and volunteers have a need to check in with facilities during the COVID-19 pandemic. The callers need to track who has called who and when, and track the overall trends in automatic updates.
44+
45+
Using this API workers can login and see the status of the city at a glance, and they can prioritize their check-ins based on need and trend.
46+
47+
## Non Goals
48+
What will this project not accomplish?
49+
- No front-end website or app
50+
- No outside data interactions
51+
- Non-city employee full login (dashboard, etc)
52+
- Statistical or analytical endpoints
53+
54+
## Minimum Viable Product
55+
To use this product as quickly as possible we will be implementing the following features:
56+
- User creation
57+
- Contact creation
58+
- Entity creation
59+
- Contact->Entity linking
60+
- Contact single-use login check-in ability
61+
62+
## Components
63+
This application will be broken down into several components. Each will be outlined here.
64+
65+
### API
66+
The API is the application for all intents and purposes. Use of the API and possible paths of use are defined in the flowchart below.
67+
![API Flowchart](/docs/img/api-flowchart.png)
68+
69+
### CI/CD
70+
We will use TravisCI, Docker, Netlify, and AWS to provide constant code deployments and test coverage.
71+
![CI/CD Pipeline](/docs/img/cicd-pipeline.png)
72+
73+
### Data
74+
This product makes use of [PostgreSQL](https://www.postgresql.org/) for the data layer and [Sequelize](https://sequelize.org/) for database interactions. The schema is outlined below
75+
![Database Diagram](/docs/img/db-diagram.png)
76+
77+
### Application Architecture
78+
The overall application will have several components in support of the code. These will facilitate secure communication between any front end, our API, and the data layer. Additionally our architecture will be designed to be scalable for instances of heavy load.
79+
![Application Architecture](/docs/img/architecture-diagram.png)
80+
81+
## Roadmap
82+
We estimate the API will be at v1.0.0 by the end of March.
83+
84+
## Contact Info
85+
Give as much, or as little, info as you want here.

docs/Tech_Spec.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/database.csv

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/img/api-flowchart.png

94.6 KB
Loading

docs/img/architecture-diagram.png

107 KB
Loading

docs/img/cicd-pipeline.png

138 KB
Loading

docs/img/db-diagram.png

2.3 KB
Loading

docs/img/mind-map-with-drawio.png

-69.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)