Skip to content

Service-Design-Studio/1d-final-project-2023-sds-2023-team-12

Repository files navigation

Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.

60.004 - Service Design Studio 2023

A joint collaboration between SUTD, Geberal and Google

Our Mission

Our innovative application, Missing Network, serves as a comprehensive platform for users to report and seek their missing loved ones by providing detailed information, thereby facilitating the search for other missing individuals by enlistihng the help of members of the public. This user-friendly app boasts an array of features, including advanced language detection that enables users to effortlessly fill up forms in their preferred language and AI generated prompts to assist users by providing contextually relevant prompts to properly look out for and communicate with the missing individual, improving the effectiveness of the search process.

Acknowledgments

  1. Tran Cong Nam Anh Louis @LouisAnhTran (Project Manager + Technical Lead + Fullstack Developer + QA Engineer)
  2. Nada Khan Suratee @nadakhn (Deputy Project Manager + Product Designer + Frontend engineer)
  3. Cephas Yeo Zhi Hao @cephasyeo (ML/AI Engineer + QA Engineer)
  4. Saw Yi Xuan @yixuansaw (QA Engineer + Testing Engineer + Product Management)
  5. Ayu Permata Halim Mendoza @ayupermhm (Frontend Engineer + Product Management)
  6. Senna Lin Tan @sennshine (Graphic Design + Frontend Engineer)

Getting Started

Prerequisites

1. Install Ruby

Open up a command line prompt. On macOS open Terminal.app; on Windows choose "Run" from your Start menu and type cmd.exe. Any commands prefaced with a dollar sign $ should be run in the command line. Verify that you have a current version of Ruby installed:

$ ruby --version

Rails requires Ruby version 2.7.0 or later. It is preferred to use the latest Ruby version. If the version number returned is less than that number (such as 2.3.7, or 1.8.7), you'll need to install a fresh copy of Ruby.

To install Rails on Windows, you'll first need to install Ruby Installer.

For more installation methods for most Operating Systems take a look at ruby-lang.org.

2. Install SQLite 3

You will also need an installation of the SQLite3 database. Many popular UNIX-like OSes ship with an acceptable version of SQLite3. Others can find installation instructions at the SQLite3 website

Verify that it is correctly installed and in your load PATH:

$ sqlite3 --version

3. Install Rails

To install Rails, use the gem install command provided by RubyGems:

$ gem install rails

Rails will not run as expected if you are unable to install any of above required dependencies. Once you have finished installing all required above, to verify that you succesfully acquired tools and softwares without any error or system conflict, use the following command

$ rails --version

If command line prompt returns result of "Rails 7.x.x" for the above command, congratulations, you have set up all required dependencies successfully and are ready to embark on Ruby on Rails journey.

Otherwise, if command line promts fail to return output as expected, then the best workaround is properly starting from the first step again. And this time, make sure you follow every steps deligently.

Installation

1. Clone the remote repo

Clone the project remote repo to your local machine using the following command in your terminal or command line prompt.

git clone https://github.com/Service-Design-Studio/1d-final-project-2023-sds-2023-team-12.git

2. Ruby Gem libraries

After cloning the project to local machine, the following step is to ensure your local machine already acquire libraries and dependences required to run the application. Hence, to fulfill that requirement, use the following command.

This command is used to install all the required gems specified in the application's Gemfile.

bundle install

If any modification is made to the Gemfile, whether it involves removing or adding a new gem, please use either the previous command or the following command accordingly.

bundle update

3. Setup Database

  • Push migrations to database
rails db:migrate
  • Seed data to development and testing environment database
rails db:seed
  • Create database
rails db:create

4. Set up Google ML/AI API keys

  1. Create google cloud account and enable following API services, Cloud Translation API, Cloud Natuaral API

  2. Create a new project and in your project console, navigate to "API & Services" -> "Credentials" to create API key

Use the following command in your command line promptv (Unix-based)

export API_KEY=<your API key>

if you use Windows, please use the alternative command:

set API_KEY=<your API key>

Run Development

Note: All commands are executed under repository root path

1. Run Rails application

rails server

2. Run Flask application

  1. Ensure that you are in the vertexai directory!
cd vertexai
  1. Deploy the Flask application which calls the text-bison-001 model from VertexAI
python main.py

Troubleshooting

1. Inspect development database

  • Using Active Record
rails console
  • Common ActiveRecord commands
### BASIC OPERATIONS

# Create a new record in User model
user = User.create(name: "David", occupation: "Code Artist")

# return a collection with all users
users = User.all

# return the first user
user = User.first

# return the first user named David
david = User.find_by(name: 'David')

# update an entity in table
# approach 1:
user = User.find_by(name: 'David')
user.name = 'Dave'
user.save

# approach 2:
user = User.find_by(name: 'David')
user.update(name: 'Dave')

### ACITVE RECORD COMMON METHODS
# where method
users = User.where(name: 'John', age: 25)
users = User.where('age > ? AND name LIKE ?', 18, '%John%')

# Order method
Users=User.where(name: ‘DAVID’, occupation: ‘Code’).order(created_at: :desc)

# Find_by method
User=User.find_by(name: 'John', age: 25)

# Like method
Customer.where("email IS NOT NULL and email NOT LIKE '%@%’ ")

# Update all method
User. where(age: 25).update_all(name: 'John', gender: 'Male')

# Limit method
User.order(created_at: :desc).limit(20)

# Working Date and Time
User.where(“created_at > ?”,Date.new(2023,1,1))
User.where(“EXTRACT(MONTH FROM created_at)=?”,7)

2. Prepare Testing Database

Note: Database schema for Rails application are synchronized for all three development, namely development, testing and production. However, data stored in database for each environment differ from one another. Any change in schema in development environment should be reflected to testing environment.

Note: Seeding data using rails db:seed will add data to both testing and development environment, however data created in development environment will not be added to testing environment.

Run these commands

bundle exec rake db:migrate
bundle exec rake db:test:prepare

Optionally add some seed data in db/seeds.rb using the following command

rake db:seed

If any change made in schema in development, use this command to apply change to testing schema.

bin/rails db:migrate RAILS_ENV=test

Testing

1. Acceptance/System Testing Using Cucumber

Run acceptance test using the following command

bundle exec cucumber

2. Unit Testing

  • 2.1 Using Minitest Testing are defined under ./test

Run unit testing using Minitest

rails test
  • 2.2 Using Rspec

Testing are defined under ./spec

Model Unit Testing ./spec/models

Controllers Unit Testing ./spec/requests

Run unit testing using Rspec

rspec
  • 2.3 Fuzzing Using Rspec

Test for grammar in email and password field using Rspec

Fuzzing testing are defined under ./spec/fuzzing_test

Run fuzzing using Rspec

bundle exec rspec spec/email_fuzz_spec.rb
bundle exec rspec spec/password_fuzz_spec.rb

About

1d-final-project-2023-sds-2023-team-12 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published