Giter Club home page Giter Club logo

irs's Introduction

irs

Build Status

Development environment

Please make sure:

  1. Installed postgresql and during this process, the default postgres user has been created.
  2. The postgresql localhost server is running.

Viewing flask templates

To view the templates in your browser, you can run a local flask server. To see your changes, refresh the page.

 export FLASK_APP=web flask run
 export FLASK_DEBUG=1
 python -m flask run

Then you can view it on http://127.0.0.1:5000/

Database

Note: the automated setup will create a db for you as postgres user and also load the schema, pipenv and requirements as well as the pre-commit hooks

To run the automated setup, please ensure that you are at the root irs folder (run cd irs to double check) then run the script:

./setup.sh

It might prompt you for a password as it runs some commands as a sudo user. Just type in your password.

Viola! You're good to go.

Manual Setup

  1. For the database, you can either run the docker container OR you can create the create the irs database and load the schema. We recommend running the docker container.

  2. Install pipenv to manage depencies.

  3. Intall pre-commit to run code checks on commit.

Docker

For most developers, you shouldn't worry about fiddling with databases. In terms of automated unit testing however, you will need an instance of postgres running. As such, use docker to handle all the setup for you:

    $ docker run --rm -p 5432:5432 postgres

Using Pipenv

Pipenv, serves to simplify the management of dependencies in Python-based projects. It brings together Pip, Pipfile and Virtualenv to provide a straightforward and powerful approach to package management.

For you to be able to run any of the applications, everything must occur within a pipenv shell, or commands must be prefaced with pipenv run:

$ pipenv run python some_app.py

Automated Testing & Quality

There are a few testing processes which run on Travis CI for each commit. The idea is to maintain the quality of the system using automated processes. It's not supposed to make your life a misery, so raise an issue if it is getting in the way- The spice must flow!

With that in mind, these are the processes, what they are looking for and the intended goals:

Pre-commit Hooks

The pre-commit hook will run when you make a commit. This includes flake8, pylint and other code style checks. When it can, pre-commit will correct those files for you. To find out more about the specific pre-commit checks, you can find it in the wiki.

Note: You will need to re-add any files that pre-commit fixes up for you. If there weren't any and it passed everything then you may commit what your original staged files

Testing

Running pytest in the root directory will run all the unit tests. Pytest is verifying for implementation correctness and to make sure there are no regressions. The idea is to ensure that the code is exercised and we know that it works.

$ pytest

Before running pytest, spin up a development database using docker.

Coverage

Coverage is a tool to enforce test coverage. Running coverage run -m pytest in the root will run all the tests, but also track which lines of code are executed. Subsequently running coverage report prints an overview of the test coverage. Travis CI uses additional flags to fail the build when any of the files have a coverage below 100%. The goal is to exercise all of the code, have no dead bits and know for sure that all of it works.

irs's People

Contributors

arosspope avatar carolsa8 avatar chrisstime avatar davidniw avatar epiik avatar gav0 avatar inphamous avatar jacobvorr avatar jjbdlsantos avatar ndgogo avatar squishykid avatar

Watchers

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

irs's Issues

TC-CSS-01

CSS score is calculated.

  1. Image is taken of the user.
  2. Image is proccessed and passed through the function.
  3. CSS score is assigned to the user.

Expected Outcome

CSS score is created and is between 0 and 100.

TC-TBL-01

Tables are shown to the user.

  1. User enters the size of their party.
  2. List of tables are shown to the user.
  3. User selects a table from the list.
  4. Table is assigned to that group.

Expected Outcome

Interface should show available tables for the user based on their party size.

Database Test Fixture

Need a test fixture to inject the db connection into unit tests as they require it.

TC-ROB-03

Robot speaks to user to prompt them for an answer.

  1. User is detected by the robot.
  2. Robot speaks to the user.

Expected Outcome

Robot is able to speak to the user to prompt them.

TC-ROB-02

Robot processes speech from user.

  1. User speaks to the robot.
  2. Robot processes the speech.
  3. Robot displays text that was spoken.

Expected Outcome

Users speech is displayed to them.

Deploy to AWS

Lambda Functions:

  • Flask App - HTTP Trigger
  • Azure Face Recognition - S3 Trigger

S3:

  • Static Assets Bucket
  • Face Recognition Bucket

Route53:

  • setup domain

RDS:

  • Host the database

CloudFront:

  • [] Make pretty url like this.

Makefile or similar

Thinking about putting all the scripts in a makefile of sorts. Either an actual makefile, or to fit with the theme, a python script. This would be a central point which implements and also documents:

  • Running tests e.g. make test
  • Setup database e.g. make apply-schema
  • Linter e.g. make lint

This would be expandable as we add more features and 'dev-ops' related features.

TC-TBL-02

Table state changes as users are assigned.

  1. User selectes a table
  2. State of the table is changed.

Expected Outcome

Searching the table in the database should show that the table has been allocated.

Running the unit tests with FLASK_DEBUG=1

Running the unit testing suite with the environment variable FLASK_DEBUG=1 will cause the unit tests to fail intest_db.py, with:

AssertionError: A setup function was called after the first request was handled.  This usually indicates a bug in the application where a module was not imported and decorators or other functionality was called too late. To fix this make sure to import all your view modules, database models and everything related at a central place before the application starts serving requests.

This is a known issue as per here: ga4gh/ga4gh-server#791.

Let it be known, that people running unit tests locally should do so with export FLASK_DEBUG=0. (I don't think there is any other quick fix to this)

Autodeploy to Cloud Services

Travis:

  • Add deploy scripts lambda
  • Add deploy scripts s3 static assets

Lambda:

  • Flask App, HTTP Trigger
  • Sentiment Analysis, S3 Trigger

S3:

  • Static Assets
  • Images pending recognition

API Gateway:

  • Lambda triggers

CloudFront:

  • Amalgamate S3, Lambda
  • Make the url pretty

Route53:

  • Pretty URL

Report interface

Management UI
Sub-tasks:

  • Login-logout flow (#56)
  • Login authentication to database
  • Other things and pull requests

Exit kiosk interface

  • Bootstrap modal for pop up where you can select new table state

  • Reading from and posting (updated status) to db

  • Applying css (already created) to a table if it is now unavailable

TC-ROB-01

Robot captures image of user

  1. User stands in front of the robot.
  2. Robot captures image of the user.
  3. Robot displays image captured.

Store CSS with Customer Event

  • Take inputs: s3 filename and csss (int from 0 to 100) and store in db. (#108)
  • Need to design schema for creating the filename.
  • connect lambda - upload to s3 (#108)
  • trigger - get css - populate entry (#107).

TC-EXIT-01

Image capture of user.

  1. User stands in front of the tablet.
  2. Image is captured.
  3. Image is displayed to concierge.

Expected Outcome

Concierge is able to see the photo that has been taken.

Greeting/Robot UI Design

Endpoint in robot.py

UI Design: 9.1 of https://docs.google.com/document/d/19sFZmp3gpnUUBAwQmX9ADK9wBfQw1Miklpnxs_YiCr8/edit#heading=h.6ol07zt2rka5

Interaction: 6.1.1 of https://docs.google.com/document/d/105dhwgfuZhn7RUYRUEhM0qxlRo4OvLpqXy5B-BIrT9I/edit#heading=h.jx6ibiv1q6kz

Pages:
GET /robot Figure 9.1.1 of UI Design
GET /robot/table?people={number of people to seat} Figure 9.1.2&9.1.3 of UI Design
POST /robot/table to support GET /robot/table
GET /robot/proceed{:resid} to support successful POST /robot/table
GET /robot/full to support negative POST /robot/table

Process:

  • implement all the GET endpoints (#99)
  • implement the POST endpoint

Dashboard Reporting

  • CSS values across time (daily, weekly, monthly) entry vs exit
  • Dropdown for specific timing per filter
  • Average CSS for specified time period
  • Average CSS per staff member
  • Graph historic CSS values for staff member and show on graph.
  • Trend of selected meals from group (nice to have)

TC-EXIT-02

Interfaces from robot are also available on tablet.

  1. Tablet is opened to show same interface as robot.

Expected Outcome

Interface should be identical and have same functionality.

TC-CSS-02

CSS score is stored with table data.

  1. CSS is calculated.
  2. CSS is stored with the table reservation in the database.

Expected Outcome

Searching for a reservation should show CSS score for table.

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.