Welcome to the SHOW platform repository!
Backend Language: Python (with Flask)
Backend API: REST
Database: PostgreSQL
User Auth: Opt-in
File Storage: Opt-in
The frontend is a React application written in TypeScript.
- π Documentation
- π¨βπ» Getting Started
- π³οΈ Prerequisites
- π¨ Setup
- π Two Factor Authentication
- π Sign In Logs
- π§° Useful Tools
- π Database Migrations
- π Connect To Database
- β»οΈ Restart Docker Containers
- π± Seeding
- π Linter
- π» The Team
- Starter Code
- Dev Cheatsheat (adapted from Children's Aid Society team)
- Dev Guidelines
- Install Docker Desktop (MacOS | Windows (Home) | Windows (Pro, Enterprise, Education) | Linux) and ensure that it is running
- Ask the current PL to receive access to ENV Variables
- Clone this repository and
cd
into the project folder
git clone https://github.com/uwblueprint/supportive-housing.git
cd supportive-housing
- Ensure that environment variables have been added to the following directories:
/.env
/frontend/.env
/seeding/.env
- Run the application
docker-compose up --build
-
Run the initial migration:
bash ./scripts/flask-db-upgrade.sh
-
Create an Admin user. In
seeding/.env
, ensureFIRST_NAME
,LAST_NAME
, andEMAIL
are set (you should use your Blueprint email/any email you have access to here). EnsureROLE
is set toAdmin
. Run:
bash ./seeding/invite-user.sh
IMPORTANT: If you've reset your local DB and want to re-use an email, ensure it's deleted from Firebase as well (ask the PL for access if you don't have it)
-
Signup for an account on the app! Ensure that you use the values you used in Step 3. Your password can be anything you remember
-
Verify your email address. You should receive an email in your inbox with a link - once you click the link, you're good to freely use the app! You can invite any other users through the
Employee Directory
within theAdmin Controls
Two factor authentication is used for Relief Staff users. You can enable/disable this in your local environment by setting the following environment variable in the root .env
file:
TWO_FA_ENABLED=<insert value here> # this can either be "True" or "False"
If this is enabled, follow these steps to enable code generation:
- Download Authenticator extension (Chrome recommended)
- Open the extension and click the
pencil
icon in the top right corner, followed by theplus
icon - Click
Manual Entry
- Under
Issuer
enter any name you'd like, and underSecret
enter theTWO_FA_SECRET
environment variable - Click
Advanced
, and set thePeriod
to 30 - Click
OK
, and you should see codes being generated!
Sign in logs are automatically generated every time you sign into the application with any user. If you want to control when these are created and ensure your database doesn't become bloated, you can set the following environment variable:
CREATE_SIGN_IN_LOG=<insert value here> # this can either be "True" or "False"
As mentioned in the previous section, the main command you'll use to sync your local DB will be:
bash ./scripts/flask-db-upgrade.sh
If you make any changes to the database schema, you'll need to create a migration for it and re-sync your DB. Follow the guide here to do this.
Execute this script to interact directly with the database through SQL queries. Some sample commands that can be ran are linked here.
bash ./scripts/exec-db.sh
Execute this to restart all running SHOW Docker containers and clear your volumes.
bash ./scripts/restart-docker.sh
These scripts will allow you to seed your local database with randomized data. Each step shows the environment variables (in /seeding/.env
) you should set in order to achieve your desired results. It's recommended that you execute the scripts in the following order:
- Create any number of users. Set
FIRST_NAME
,LAST_NAME
,ROLE
, andEMAIL
to your desired values.ROLE
should be one ofAdmin
,Regular Staff
, orRelief Staff
, andEMAIL
should contain a valid email.
bash ./seeding/invite-user.sh
- Create any number of tags. Set
TAG_ROWS
to your desired value. This should be a valid integer.
bash ./seeding/create-tags.sh
- Create any number of residents. Set
RESIDENT_ROWS
to your desired value. This should be a valid integer.
bash ./seeding/create-residents.sh
- Create any number of log records. Set
LOG_RECORD_ROWS
to your desired value. This should be a valid integer.
bash ./seeding/create-log-records.sh
To run the linter, use the following commands while the docker containers are running:
- Mac
docker exec -it SHOW-backend /bin/bash -c "black ."
docker exec -it SHOW-frontend /bin/bash -c "yarn fix"
- Windows
docker exec -it SHOW-backend bash -c "black ."
docker exec -it SHOW-frontend bash -c "yarn fix"
Or, if you have yarn installed locally, running yarn fix
should work as well.
Project Lead: Connor Bechthold
Product Managers: Zafir Raeid
Developers: Aathithan Chandrabalan, Daniel Kim, Kelly Pham, Kevin Pierce, Owen Sellner, Braydon Wang, Carolyn Zhang
Designers: Amanda Yu
Project Lead: Safwaan Chowdhury
Product Managers: Hiba Altaf
Developers: Connor Bechthold, Helen Guan, Kelly Pham, Daniel Kim, Kevin Pierce, Owen Sellner
Designers: Lauren Fearn, Yousuf Zia
Project Lead: Dinu Wijetunga
Product Managers: Rachel Scott & Maitry Mistry
Developers: Connor Bechthold, Helen Guan, Joyce Wangsa, Juthika Hoque, Kelly Pham, Safwaan Chowdhury
Designers: Elle Luo, Serena Li
Huge shoutout to the Internal Tools team for creating StarterCode v2!